-
Notifications
You must be signed in to change notification settings - Fork 35
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
move xarray's pseudonetcdf backend here #137
Comments
@jhamman - I'm on board, but it may take me a bit. First, I have a few clarifying questions. A lot of my datasets are very large, so I suspect I'll need lazy loading. Each variable is essentially a subclass of an array, which means that it has attributes and special methods, but ultimately the data access depends on the array. That means that when I use memmap's for binary files the data is only retrieved from disk as it is indexed. So, I want to summarize my understanding -- basically, I'll echo back what I think I understand from your docs. Imagining that I code this (correctly) in a module called xarray_plugin within PseudoNetCDF, would the registry look like:
In terms of functionality, would this change anything operationally? Like, would the user need to import both xarray and PseudoNetCDF to get access to PseudoNetCDF as a backend? Anything like that? Or does the entry point automatically load with xarray? Lastly, do I read the Thanks for helping walk me through this. I see the value in taking this approach and I love your accessor approach too. |
You've got the details all basically right.
No. We should be able to make this a seamless transition for users. No extra imports would be needed as the entrypoints are automatically picked up. I hope this is mostly a fork-lift exercise from Xarray's repo to this one. I think you can keep existing lazy-loading behavior as is.
|
Quick bump on this. @barronh - have you had a chance to look into this at all? |
Sorry, I'll make this happen by Apr 8. |
@jhamman - If it really is a fork-lift, I'm really sorry it took me so long. I have started the process in https://github.com/barronh/pseudonetcdf/tree/xarray-backend. For now, I literally copied and pasted from Right now, I have a few questions.
So, to test, I started with a fresh
To make sure the test was sound, I also tried changing the engine from 'pnc' to 'xc' and got the following error:
This felt good because So, if you agree this is working, I'd like to figure out if the Assuming this was merged, what else would be necessary on my side? |
Sounds like great progress @barronh. I'm glad to hear it turned out to be a fairly straightforward process for you.
I would first experiment with leaving this out of your implementation and see if your type checker complains. If that doesn't work, Xarray is only supporting Python 3.9+ so if you have completely isolated this import from the rest of pseudonetcdf, this may need to be feature only supported by modern Python versions.
@snowman2 or @headtr1ck may have some ideas. pydata/xarray#7523 recently allowed you to refresh the list of current backends so you may be able to do something like the test you explain above in your test suite.
We would just add a deprecation warning on the Xarray side and then remove the engine in a few months (like we just did here). User's wouldn't notice the difference though so long as we keep the |
I think it should be easy to make this backend python 3.6 compatible. You probably will have to change some typing, but it is not really important since the backend is usually wrapped by xarrays again. The typing of the backend was mostly meant for internal consistency, so feel free to even remove it completely. If there is an external backend it takes precedence over an internal one. How one can test this, I'm not sure. Maybe call xarrays list_engines and test if the module of the backend is pseudonetcdf and not xarray? For testing, I think the best approach would be to copy all tests related to this backend as well, but ofc xarray requires python >=3.9, therefor also these tests. |
This has been completed in v3.4.0. |
Xarray now has a plugin system for registering backends. For the more specialized backends (like pseudonetcdf), we'd like to work toward moving the backend entrypoint to 3rd party packages. For example, rioxarray now ships with its own xarray backend. Could the same be done here?
The text was updated successfully, but these errors were encountered: