-
Notifications
You must be signed in to change notification settings - Fork 5
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
Convert to an xarray 'decorator' #25
base: master
Are you sure you want to change the base?
Conversation
- add new open_dataset() method - override xr.Dataset.__getitem__ - minimum changes to pass tests
This approach uses the existing code, instead of repeating it with modifications (which would make maintenance harder).
Hi @shoyer —if you can spare the time, I'd like to ask for a brief pointer on something here. In this branch I've converted py-GDX from a One of the features of the older version was 'lazy' or deferred loading—individual variables would not be read from the underlying file until they were accessed. As you can see, in this branch I had to override (or wrap, basically) So this does not really respect the spirit of an accessor. It also didn't support, e.g., the So my question is basically, what is the minimum viable form of a DataStore? Would I also need to subclass or otherwise modify Any advice would be much appreciated! |
I can't recommend using xarray's DataStore API here, and in fact, I'm pretty sure it isn't even really needed in xgcm. In addition to being a sloppy abstraction (mixing an abstract base class with some highly specific implementation details), it just doesn't do that much beyond loading a dictionary of Dask is a nice way to make lazy computed arrays (with eagerly known shape), but it seems like you may need lazily computed keys? If so, I'm afraid nothing in xarray currently solves this problem and a |
That's helpful, thanks! I suppose for the time being I will stick with the accessor approach. For the longer run, I will look more closely into dask and consider whether it offers a solution. |
Will close #18
TODO:
lazy=True
.