New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jypeter opened this Issue Apr 27, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@jypeter

jypeter commented Apr 27, 2017

@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

@doutriaux1 doutriaux1 added the bug label Apr 27, 2017

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017

@doutriaux1 doutriaux1 modified the milestones: 2.12, 3.0 Jul 13, 2017

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Jul 13, 2017

@danlipsa ping.

@doutriaux1

This comment has been minimized.

Member

doutriaux1 commented Sep 5, 2017

@danlipsa @jypeter is that still true?

@doutriaux1 doutriaux1 modified the milestones: 3.0, 2.12 Sep 5, 2017

@jypeter

This comment has been minimized.

jypeter commented Sep 11, 2017

@doutriaux1 I have just tried this in 2.12, and I get another (but similar) error. Before it broke on maxNorm = vectors.GetMaxNorm(), and now it breaks on vectors.GetRange(self._vectorRange, -1)

>>> x.plot(vect_gm_large, uwnd[::5, ::5],
...        vwnd[::5, ::5])
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm16/lib/python2.7/site-packages/vcs/Canvas.py", line 2690, in plot
    a = self.__plot(arglist, keyargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm16/lib/python2.7/site-packages/vcs/Canvas.py", line 4020, in __plot
    returned_kargs = self.backend.plot(*arglist, **keyargs)
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm16/lib/python2.7/site-packages/vcs/VTKPlots.py", line 680, in plot
    vtk_backend_grid, vtk_backend_geo, **kargs))
  File "/home/share/unix_files/cdat/miniconda2/envs/cdatm16/lib/python2.7/site-packages/vcs/vcsvtk/pipeline2d.py", line 300, in plot
    vectors.GetRange(self._vectorRange, -1)
AttributeError: 'NoneType' object has no attribute 'GetRange'
@danlipsa

This comment has been minimized.

Contributor

danlipsa commented Jan 29, 2018

Working on it ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment