def simplevector(): import vcs, cdms2, sys x = vcs.init() f = cdms2.open(vcs.prefix+"/sample_data/clt.nc") v = f["v"] u = f["u"] dv3d = vcs.get3d_vector() dv3d.BasemapOpacity = 0.15 x.plot( u, v, dv3d ) x.interact()
def build(self): print "Processing vars %s from file %s" % ( str(self.varnames), self.file_path ) plot_args = [] for varname in self.varnames: var = self.file[varname] var = var( lon=( self.roi[0], self.roi[1] ), lat=( self.roi[2], self.roi[3] ), squeeze=1, ) if self.roi else var( squeeze=1, ) plot_args.append( var ) self.canvas = vcs.init() self.canvas.drawlogooff() self.gm = vcs.get3d_scalar( self.template ) if ( self.ptype == '3d_scalar' ) else vcs.get3d_vector( self.template ) for pitem in self.parameters.items(): self.gm.setParameter( pitem[0], pitem[1] ) plot_args.append( self.gm ) plot_kwargs = { 'cdmsfile': self.file.id, 'window_size': (900,600) } self.canvas.setantialiasing(False) display = self.canvas.plot( *plot_args, **plot_kwargs ) self.plot = self.canvas.backend.plotApps[ vcs.elements[display.g_type][display.g_name] ]
''' Created on Jun 18, 2014 @author: tpmaxwel ''' import vcs, cdms2, sys x = vcs.init() f = cdms2.open(vcs.prefix + "/sample_data/geos5-sample.nc") dv3d = vcs.get3d_scalar() dv3d.ToggleVolumePlot = vcs.on dv3d.Camera = { 'Position': (-161, -171, 279), 'ViewUp': (.29, 0.67, 0.68), 'FocalPoint': (146.7, 8.5, -28.6) } dv3d_v = vcs.get3d_vector() v = f["uwnd"] dv3d.VerticalScaling = 4.0 dv3d.ScaleColormap = [-46.0, 46.0, 1] dv3d.ScaleTransferFunction = [10.0, 77.0, 1] x.plot(v, dv3d) x.png("uwnd_volume.png")
''' Created on Jun 18, 2014 @author: tpmaxwel ''' import vcs, cdms2, sys x = vcs.init() f = cdms2.open( vcs.prefix+"/sample_data/geos5-sample.nc" ) dv3d = vcs.get3d_vector() dv3d.VerticalScaling = 4.0 dv3d.BasemapOpacity = 0.0 dv3d.ScaleColormap = [50.0, 75.0, 1] dv3d.ZSlider = [26.0], vcs.on dv3d.GlyphDensity = 3.0 dv3d.GlyphSize = 0.6 dv3d = vcs.get3d_vector() v0 = f("uwnd") v1 = f("vwnd") x.plot( v0, v1, dv3d ) x.png("wnd_vector.png")
import vcs, cdms2, sys x = vcs.init() f = cdms2.open(vcs.sample_data + "/geos5-sample.nc") dv3d = vcs.get3d_vector() dv3d.VerticalScaling = 4.0 dv3d.BasemapOpacity = 0.5 dv3d.ScaleColormap = [50.0, 75.0, 1] dv3d.ZSlider = [26.0], vcs.on dv3d.GlyphDensity = 3.0 dv3d.GlyphSize = 0.6 dv3d = vcs.get3d_vector() v0 = f["uwnd"] v1 = f["vwnd"] x.plot(v0, v1, dv3d) x.interact()
''' Created on Jun 18, 2014 @author: tpmaxwel ''' import vcs, cdms2, sys x = vcs.init() f = cdms2.open( vcs.prefix+"/sample_data/geos5-sample.nc" ) dv3d = vcs.get3d_scalar() dv3d.XSlider = [254.0], vcs.on dv3d.YSlider = [48.3], vcs.on dv3d.ZSlider = [35.0], vcs.on dv3d.VerticalScaling = 7.0 dv3d.ScaleColormap = [-18.0, 61.0, 1] dv3d.Camera={'Position': (-161, -171, 279), 'ViewUp': (.29, 0.67, 0.68), 'FocalPoint': (146.7, 8.5, -28.6)} dv3d_v = vcs.get3d_vector() v = f["uwnd"] x.plot( v, dv3d ) x.png("slice.png")