Skip to content

GetMaxNorm error when available vector data area is 'smaller' than vector graphics method? #184

@jypeter

Description

@jypeter

@doutriaux1 I get an error when plotting vectors and datawc_x2-datawc_x1 is bigger than the longitude range of the variable I'm plotting. Maybe this is just due to the fact that I'm trying to make a plot of an area that is 360+180 degrees large

I know, I test weird stuff :(

The error

This works!
Ready for next?
This also works!
Ready for next?
This FAILS...
Traceback (most recent call last):
  File "test_vector.py", line 32, in <module>
    vwnd[::5, ::5])
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/vcs/Canvas.py", line 2564, in plot
    a = self.__plot(arglist, keyargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/vcs/Canvas.py", line 3893, in __plot
    returned_kargs = self.backend.plot(*arglist, **keyargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/vcs/VTKPlots.py", line 608, in plot
    vtk_backend_grid, vtk_backend_geo, **kargs))
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/vcs/vcsvtk/pipeline2d.py", line 317, in plot
    self._plotInternal()
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm14/lib/python2.7/site-packages/vcs/vcsvtk/vectorpipeline.py", line 115, in _plotInternal
    maxNorm = vectors.GetMaxNorm()
AttributeError: 'NoneType' object has no attribute 'GetMaxNorm'

The 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()
vect_gm = x.createvector()

vect_gm_large = x.createvector()
vect_gm_large.datawc_x1 = -180
vect_gm_large.datawc_x2 = 360

print 'This works!'
x.plot(vect_gm, uwnd[::5, ::5], vwnd[::5, ::5])

raw_input('Ready for next?')

print 'This also works!'
x.clear()
x.plot(vect_gm_large, uwnd(longitude=(-180, 360))[::5, ::5],
       vwnd(longitude=(-180, 360))[::5, ::5])

raw_input('Ready for next?')

print 'This FAILS...'
x.clear()
x.plot(vect_gm_large, uwnd[::5, ::5],
       vwnd[::5, ::5])

# The end

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions