vcs icon indicating copy to clipboard operation
vcs copied to clipboard

vector type does not work? (2.8.0)

Open jypeter opened this issue 7 years ago • 0 comments

@doutriaux1 I have used the following script to display (bg=0) and save to png (bg=1 to avoid black png...), and the type parameter does not seem to change anything!

The quality of the png output is also a bit disappointing (to be polite), but I will try to open another issue about it

Script

#!/usr/bin/env python

import cdms2, vcs

f_in = cdms2.open(vcs.sample_data + "/geos5-sample.nc")
uwnd = f_in('uwnd', time=slice(0,1), lev=slice(0,1), squeeze=1)
vwnd = f_in('vwnd', time=slice(0,1), lev=slice(0,1), squeeze=1)
f_in.close()

x = vcs.init()
bg_type = 1

vect_gm = x.createvector()
vect_gm.scale = 10

print 'vect_gm.type', vect_gm.type
x.plot(vect_gm, uwnd[::5, ::5], vwnd[::5, ::5], bg=bg_type)
x.png('vect_arrows')
x.pdf('vect_arrows')

raw_input('Ready for next?')

print 'Trying to change the arrow type...'
x.clear()
vect_gm.type = 'solidarrows'
print 'vect_gm.type', vect_gm.type
x.plot(vect_gm, uwnd[::5, ::5], vwnd[::5, ::5], bg=bg_type)
x.png('vect_solidarrows')
x.pdf('vect_solidarrows')

raw_input('Ready for next?')

print 'Trying to change the arrow type...'
x.clear()
vect_gm.type = 'barbs'
print 'vect_gm.type', vect_gm.type
x.plot(vect_gm, uwnd[::5, ::5], vwnd[::5, ::5], bg=bg_type)
x.png('vect_barbs')
x.pdf('vect_barbs')

# The end

Resulting output and plots

(cdatm14) bash-4.1$ python -i test_vector_type.py
vect_gm.type arrows
Ready for next?
Trying to change the arrow type...
vect_gm.type solidarrows
Ready for next?
Trying to change the arrow type...
vect_gm.type barbs

vect_arrows vect_solidarrows vect_barbs

jypeter avatar Apr 27 '17 12:04 jypeter