Menu ▾ ▴

#146 Typo in Canvas.py

Normal_bug
open
5
2012-12-10
2004-04-08
No

Trying to override the cdms time units I get the
following error:

Python 2.2.3 (#1, Sep 23 2003, 13:30:27)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-85)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.
>>> import cdms, vcs, cdtime
>>> f = cdms.open('04epaa.pd.gmts.x1.nc')
>>> v = f('gm_ts')
>>> p = vcs.init()
>>> p.plot(v, time=cdtime.reltime(30.0, 'days since
1900-1-1'))
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/usr/local/cdat-4.0beta/lib/python2.2/site-packages/vcs/Canvas.py",
line 3423, in plot
a = self.__plot( arglist, keyargs )
File
"/usr/local/cdat-4.0beta/lib/python2.2/site-packages/vcs/Canvas.py",
line 3805, in __plot
arglist[0] = tv = self._reconstruct_tv(arglist,
keyargs)
File
"/usr/local/cdat-4.0beta/lib/python2.2/site-packages/vcs/Canvas.py",
line 375, in _reconstruct_tv
ar.date = str(ctime)
NameError: global name 'ar' is not defined

I'm new to CDAT so I'm not sure the cdtime call is
correct, however this looks like a bug to me. Further
investigation in the source confirms this:

In cdat-4.0b2/Packages/vcs/Lib/Canvas.py:

493 time = keyargs.get('time')
494 if time is not None:
495 ctime = time.tocomp()
496 ar.date = str(ctime)

surely should be:

496 arg.date = str(ctime)

Discussion


Log in to post a comment.