Skip to content
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

Plot vector for sub-region: "datawc" for vector plot not working #2186

Closed
lee1043 opened this issue Jul 18, 2017 · 18 comments
Closed

Plot vector for sub-region: "datawc" for vector plot not working #2186

lee1043 opened this issue Jul 18, 2017 · 18 comments
Assignees
Milestone

Comments

@lee1043
Copy link

@lee1043 lee1043 commented Jul 18, 2017

I am testing uvcdat 2.10 with currently displayed examples on gallery.

Target:

https://raw.githubusercontent.com/UV-CDAT/UV-CDAT_scientific_examples/master/plots/example_850mb_rh_ts_gph_jja_clim.png

However I am not able to reproduce this example which plots vector for sub region.

Below script is simple version of above example, including only vector part.

import vcs
import cdms2 as cdms

var = 'ua'
odir = '/cmip5_css02/data/cmip5/output1/NIMR-KMA/HadGEM2-AO/historical/mon/atmos/Amon/r1i1p1/'+var+'/1/' # Provide your data directory
nc = var+'_Amon_HadGEM2-AO_historical_r1i1p1_186001-200512.nc'
f = cdms.open(odir+nc)
u = f(var,lev=85000,time=slice(0,1))
f.close()

var = 'va'
odir = '/cmip5_css02/data/cmip5/output1/NIMR-KMA/HadGEM2-AO/historical/mon/atmos/Amon/r1i1p1/'+var+'/1/' # Provide your data directory
nc = var+'_Amon_HadGEM2-AO_historical_r1i1p1_186001-200512.nc'
f = cdms.open(odir+nc)
v = f(var,lev=85000,time=slice(0,1))
f.close()

# Set ploting range ---
lat1=-60
lat2=80
lon1=0
lon2=360

x = vcs.init()

vec = vcs.createvector()
vec.datawc_x1 = lon1
vec.datawc_x2 = lon2
vec.datawc_y1 = lat1
vec.datawc_y2 = lat2

x.plot(u,v,vec)

x.png('test.png')

Error occurs at below part. Without having below part, the script works with no error.

vec.datawc_x1 = lon1
vec.datawc_x2 = lon2
vec.datawc_y1 = lat1
vec.datawc_y2 = lat2

Error message given as below:

/export_backup/lee1043/anaconda2/envs/uvcdat-nightly/lib/python2.7/site-packages/numpy/ma/core.py:3349: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
  self.__setitem__(slice(i, j), value)
Traceback (most recent call last):
  File "test_vector.py", line 32, in <module>
    x.plot(u,v,vec)
  File "/export_backup/lee1043/anaconda2/envs/uvcdat-nightly/lib/python2.7/site-packages/vcs/Canvas.py", line 2690, in plot
    a = self.__plot(arglist, keyargs)
  File "/export_backup/lee1043/anaconda2/envs/uvcdat-nightly/lib/python2.7/site-packages/vcs/Canvas.py", line 4019, in __plot
    returned_kargs = self.backend.plot(*arglist, **keyargs)
  File "/export_backup/lee1043/anaconda2/envs/uvcdat-nightly/lib/python2.7/site-packages/vcs/VTKPlots.py", line 680, in plot
    vtk_backend_grid, vtk_backend_geo, **kargs))
  File "/export_backup/lee1043/anaconda2/envs/uvcdat-nightly/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'
@lee1043
Copy link
Author

@lee1043 lee1043 commented Jul 18, 2017

@doutriaux1 This is the vector issue that I mentioned at the meeting. Do you have any comment on this?

@doutriaux1 doutriaux1 added this to the 3.0 milestone Sep 5, 2017
@jypeter
Copy link
Member

@jypeter jypeter commented Sep 12, 2017

@lee1043 Seems to be the same error I reported in CDAT/vcs#184

@danlipsa
Copy link
Contributor

@danlipsa danlipsa commented Feb 7, 2018

@lee1043 Can you try this with the current master. It should be fixed. Thanks!

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@danlipsa @doutriaux1 Can I install the current master version by installing nightly version in conda?

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 yes.

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 thanks for clarifying.

@danlipsa thanks for following up this issue. The current master works in Linux but not in Mac.

In Linux, it generates the image with below messages appearing.
test

/export_backup/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/vcs/VTKPlots.py:1012: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
  data[:] = numpy.ma.masked_invalid(data, numpy.nan)
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

But in Mac, it does not work with below messages appearing:

/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/vcs/VTKPlots.py:998: MaskedArrayFutureWarning: setting an item on a masked array which has a shared mask will not copy the mask and also change the original mask array in the future.
Check the NumPy 1.11 release notes for more information.
  data[:] = numpy.ma.masked_invalid(data, numpy.nan)
/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.maximum.reduce will be axis=0, not the current None, to match np.maximum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/numpy/ma/core.py:6385: MaskedArrayFutureWarning: In the future the default for ma.minimum.reduce will be axis=0, not the current None, to match np.minimum.reduce. Explicitly pass 0 or None to silence this warning.
  return self.reduce(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/vcs/Canvas.py", line 2690, in plot
    a = self.__plot(arglist, keyargs)
  File "/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/vcs/Canvas.py", line 4020, in __plot
    returned_kargs = self.backend.plot(*arglist, **keyargs)
  File "/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/lib/python2.7/site-packages/vcs/VTKPlots.py", line 680, in plot
    vtk_backend_grid, vtk_backend_geo, **kargs))
  File "/Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207/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'

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 can you post the result of conda list vcs please?

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1

In Linux:

conda list vcs
# packages in environment at /export_backup/lee1043/anaconda2/envs/uvcdat-nightly-20180207:
#
vcs                       2.12.2018.02.06.23.43.6cde70bfadcd1941ea5bfeb04aeed0d7c93dd1f0          py27_0    uvcdat/label/nightly
vcsaddons                 2.12.2018.01.22.16.22.f8e69cf2caa8484dc99bef3dce9671727415b428          py27_0    uvcdat/label/nightly

In Mac:

conda list vcs
# packages in environment at /Users/lee1043/anaconda2/envs/uvcdat-nightly-20180207:
#
vcs                       2.12             py27h3d7bbef_0    uvcdat
vcsaddons                 2.12             py27h2382082_0    uvcdat

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 your mac is not using the nightly

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 @danlipsa Another interesting point.... When I name the code as test.py in Linux and run it by commend python test.py, it automatically generates test.pyc and complains it cannot import modules. This does not happen in Mac. Any idea? Should I open new issue for this?

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 That is weird.

conda create -n uvcdat-nightly-20180207 uvcdat -c uvcdat/label/nightly -c conda-forge -c uvcdat

This is how I installed in Mac, which is identically used in Linux as well.

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 I will look into this. Also test.py is a dangerous name, please use test_jiwoo.py or something like that

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 Understood. Is the name test.py reserved in purpose in CDAT? I am just concerned that I may not only one who prefer that name when testing something. That could be potential issue for other users as well.

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 it's because I never posted the uvcdat nightly for mac. Posting in a minute, will elt you know.

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 got it. thanks!

@doutriaux1
Copy link
Contributor

@doutriaux1 doutriaux1 commented Feb 7, 2018

@lee1043 I think it's a python thing.
@lee1043 try again the mac nightly create command it works now

@lee1043
Copy link
Author

@lee1043 lee1043 commented Feb 7, 2018

@doutriaux1 it works in mac now, thanks.

@danlipsa
Copy link
Contributor

@danlipsa danlipsa commented Feb 7, 2018

@lee1043 Thanks for testing.

@danlipsa danlipsa closed this Feb 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants