Skip to content

DV3D: FileVariable object has no attribute name #1256

@chaosphere2112

Description

@chaosphere2112

This one's for @ThomasMaxwell

I ran this script you provided for the gallery against the current release branch:

'''
Created on Jun 18, 2014

@author: tpmaxwel
'''
import vcs, cdms2, sys

x = vcs.init()
f = cdms2.open( sys.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.interact()

and I receive this traceback:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-7-684d23924db8> in <module>()
----> 1 x.plot(v0, v1, d)

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/Canvas.pyc in plot(self, *actual_args, **keyargs)
   2615 
   2616         # Plot the data
-> 2617         a = self.__plot( arglist, keyargs )
   2618 
   2619         # Continuation to remove arglist from duplicating its contents

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/Canvas.pyc in __plot(self, arglist, keyargs)
   3691                     dn = arglist[3].plot(arglist[0],arglist[1],template=arglist[2],bg=bg,x=self,**keyargs)
   3692             else:
-> 3693                 returned_kargs = self.backend.plot(*arglist,**keyargs)
   3694                 if not keyargs.get("donotstoredisplay",False):
   3695                   nm,src = self.check_name_source(None,"default","display")

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/VTKPlots.pyc in plot(self, data1, data2, template, gtype, gname, bg, *args, **kargs)
    461           gm.addPlotAttribute( 'filename', cdms_file )
    462           gm.addPlotAttribute( 'url', cdms_file )
--> 463       returned.update(self.plot3D(data1,data2,tpl,gm,ren,**kargs))
    464     elif gtype in ["text"]:
    465       if tt.priority!=0:

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/vcs/VTKPlots.pyc in plot3D(self, data1, data2, tmpl, gm, ren, **kargs)
    631           interface = None
    632           roi = None # ( 0, 0, 50, 50 )
--> 633           g.gminit( data1, data2, roi=roi, axes=gm.axes, n_overview_points=n_overview_points, n_cores=gm.NumCores, renwin=ren.GetRenderWindow(), plot_attributes=gm.getPlotAttributes(), gmname=gm.g_name, cm=gm.cfgManager, **kargs  ) #, plot_type = PlotType.List  )
    634           self.plotApps[ gm ] = g
    635           self.plotRenderers.add( g.plot.renderer )

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DV3D/Application.pyc in gminit(self, var1, var2, **args)
     63             if self.plot == None:
     64                 self.plot = RectGridPlot(**args)
---> 65                 self.plot.gminit( var1, var2, **args )
     66                 self.plot.ParameterValueChanged.connect(self.canvas.processParameterChange)
     67             else:

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DV3D/StructuredGridPlot.pyc in gminit(self, var1, var2, **args)
    638         var_list = [ var1 ]
    639         if id(var2) <> id(None): var_list.append( var2 )
--> 640         self.variable_reader = StructuredDataReader( vars=var_list, otype=self.type, **args )
    641         self.variable_reader.execute( )
    642         if "cm" in args:

/Users/fries2/bin/uvcdat/2.2-rc1/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/DV3D/StructuredVariableReader.pyc in __init__(self, **args)
    111                     self.df = cdms2.open( self.fileSpecs )
    112                 else:
--> 113                     self.varSpecs = [ var.name for var in self.vars ]
    114                     plot_attributes = args.get( 'plot_attributes', None )
    115                     if plot_attributes <> None:

AttributeError: 'FileVariable' object has no attribute 'name'

According to @doutriaux1, var.name has been removed, and we use var.id now.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions