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 #56

Open
chaosphere2112 opened this issue Nov 22, 2016 · 0 comments
Open

Error reading a variable with cdms2 #56

chaosphere2112 opened this issue Nov 22, 2016 · 0 comments
Assignees
Milestone

Comments

@chaosphere2112
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]]

Migrated from: CDAT/cdat#1250

@doutriaux1 doutriaux1 modified the milestone: 3.0 May 5, 2017
@doutriaux1 doutriaux1 modified the milestones: 3.0, 3.1 Mar 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants