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

Error reading a variable with cdms2 #1250

Open
jbeezley opened this issue Apr 30, 2015 · 3 comments
Open

Error reading a variable with cdms2 #1250

jbeezley opened this issue Apr 30, 2015 · 3 comments
Labels

Comments

@jbeezley
Copy link
Contributor

I get the following error when trying to slice a variable originating on an opendap server:

 $ python -c "import cdms2; cdms2.open('http://esgcet.llnl.gov/dap/ipcc4/20c3m/ncar_ccsm3_0/pcmdi.ipcc4.ncar_ccsm3_0.20c3m.run6.atm.mo.xml').variables['ua'][0, 0, :, :]"
ncvargets: ncid 65536: NetCDF: Variable has no data in DAP request
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<prefix>/cdms2/variable.py", line 82, in __getitem__
    return AbstractVariable.__getitem__(self, key)
  File "<prefix>/cdms2/avariable.py", line 1399, in __getitem__
    return self.getSlice(numericSqueeze=1, raw=0, isitem=1, *speclist)
  File "<prefix>/cdms2/avariable.py", line 656, in getSlice
    result = self.subSlice(*specs, **keys)
  File "<prefix>/cdms2/avariable.py", line 567, in subSlice
    axis = self.getAxis(i).subaxis(slice.start, slice.stop, slice.step, wrap=(numericSqueeze==0))
  File "<prefix>/cdms2/axis.py", line 1256, in subaxis
    fullBounds = self.getBounds()
  File "<prefix>/cdms2/axis.py", line 1931, in getBounds
    boundsArray = self.getExplicitBounds()
  File "<prefix>/cdms2/axis.py", line 1949, in getExplicitBounds
    boundsArray = numpy.ma.filled(boundsVar)
  File "/Library/Python/2.7/site-packages/numpy-override/numpy/ma/core.py", line 582, in filled
    return np.array(a)
  File "<prefix>/cdms2/avariable.py", line 138, in __array__
    return numpy.ma.filled(self.getValue(squeeze=0))
  File "<prefix>/cdms2/fvariable.py", line 161, in getValue
    return self.getSlice(Ellipsis, squeeze=squeeze)
  File "<prefix>/cdms2/avariable.py", line 656, in getSlice
    result = self.subSlice(*specs, **keys)
  File "<prefix>/cdms2/avariable.py", line 549, in subSlice
    d = self.expertSlice (slicelist)
  File "<prefix>/cdms2/fvariable.py", line 84, in expertSlice
    result = apply(self._obj_.getitem,slist)
IOError: Unknown error

However accessing the components one at a time works:

$ python -c "import cdms2; print cdms2.open('http://esgcet.llnl.gov/dap/ipcc4/20c3m/ncar_ccsm3_0/pcmdi.ipcc4.ncar_ccsm3_0.20c3m.run6.atm.mo.xml').variables['ua'][1, 10, 0, 0]"
-1.70405423641

netCDF4 python also reads it fine:

$ python -c "from netCDF4 import Dataset; print Dataset('http://esgcet.llnl.gov/dap/ipcc4/20c3m/ncar_ccsm3_0/pcmdi.ipcc4.ncar_ccsm3_0.20c3m.run6.atm.mo.xml').variables['ua'][1, 10, :, :]"
[[-1.70405424 -1.72662032 -1.74810171 ..., -1.62960672 -1.65557122  -1.68037927]
 [-1.28498518 -1.27757108 -1.26952016 ..., -1.30228746 -1.2974571   -1.29165149]
 [-0.92818403 -0.89008546 -0.85163492 ..., -1.038167   -1.00244784  -0.96571213]
 ..., 
 [ 5.33871937  5.37260056  5.40242577 ...,  5.21467352  5.259552     5.30097008]
 [ 4.2086339   4.22407246  4.23648071 ...,  4.14485407  4.16894293   4.19023132]
 [ 2.89284873  2.89466238  2.89463282 ...,  2.87655139  2.88376951   2.88921022]]
@jbeezley jbeezley added the cdms2 label Apr 30, 2015
@doutriaux1
Copy link
Contributor

@jbeezley that is odd indeed. Will look into this... I suspect a numpy 1.9 issue, we are overdue for a major overhaul of the numpy inheritance anyway.... 1.9.2 breaks evrything.

@durack1
Copy link
Member

durack1 commented May 6, 2015

@jbeezley I think you already know this, but at least in netcdf-c 4.3.3.1 there does appear to be something problematic with the DAP integration as per Unidata/netcdf-c#115.

At least in the current UV-CDAT/master we're still using 4.3.2 https://github.com/UV-CDAT/uvcdat/blob/master/CMake/cdat_modules/netcdf_pkg.cmake

@jbeezley
Copy link
Contributor Author

jbeezley commented May 6, 2015

Yes, that will probably prevent us from updating the netCDF library, but the issue here seems to be unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants