Skip to content

model.GridType differences from 3.1.1 #43

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

Closed
MBARIMike opened this issue Dec 21, 2016 · 5 comments
Closed

model.GridType differences from 3.1.1 #43

MBARIMike opened this issue Dec 21, 2016 · 5 comments

Comments

@MBARIMike
Copy link
Contributor

MBARIMike commented Dec 21, 2016

GridType in Version 3.1.1 has len() method and other attributes:

# These attributes all come from the array object.
def __len__(self): return len(self.array)
@property
def type(self): return self.array.type
def _get_shape(self): return self.array.shape
def _set_shape(self, shape): self.array.shape = shape
shape = property(_get_shape, _set_shape)

Should they be added to maintain compatibility?

@MBARIMike MBARIMike changed the title model.GridType has no len() model.GridType differences from 3.1.1 Dec 21, 2016
@MBARIMike
Copy link
Contributor Author

Upon further inspection I see that the GridType returned is different. In Version 3.1.1 I get a dictionary:

>>> from pydap.client import open_url
>>> ds = open_url('http://dods.mbari.org/opendap/data/auvctd/surveys/2010/netcdf/Dorado389_2010_300_00_300_00_decim.nc')
>>> ds['temperature']
{'temperature': <pydap.model.BaseType object at 0x7f18464a7650>, 'time': <pydap.model.BaseType object at 0x7f18464a7750>}

With Version 3.2.0 I get something different:

>>> from pydap.client import open_url
>>> ds = open_url('http://dods.mbari.org/opendap/data/auvctd/surveys/2010/netcdf/Dorado389_2010_300_00_300_00_decim.nc')
>>> ds['temperature']
<GridType with array 'temperature' and maps 'time'>

Perhaps this is an improvement and I should change my code?

@taeold
Copy link

taeold commented Dec 21, 2016

This explains some of the compatibility issue I saw in pydata/xarray#1174 - namely, datatype returned by pydap.client in version 3.2 is dictionary-like but not quite so, missing couple of functions like __len__ and iteritems/items.

Does it make sense to implement these functions? From my understanding of the code, GridType/StructureType appeared well equipped to implement those functions (am I naive in thinking so?).

@MBARIMike
Copy link
Contributor Author

It wasn't too hard for me to make a work-around in my code, but it'd be nice to have the same behavior that we have 3.1.1.

@jenfly
Copy link

jenfly commented Mar 21, 2017

I'd love to have this compatibility as well! I'm new to Pydap - I've been using Xarray and now I'm trying to get it to work with engine=pydap in order to handle NASA's new authentication procedures. But the engine=pydap option doesn't work in xarray.open_dataset() anymore because of these changes to GridType. I can try to make my own versions with workarounds, but going forward it would be great to restore compatibility between Xarray and Pydap again. Is there any particular reason these attributes were removed?

@laliberte
Copy link
Member

I'm going to close this one following PR #48. If it turns out to be insufficient, I'll reopen.

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

4 participants