Improve xarray support
Current support for xarray is fairly primitive. Some features that would be nice are:
- Add support for using xarray.Dataset directly instead of extracting the NetCDF object.
- Being able to subset the Dataset's data prior to reading so the entire array isn't used.
- Some of this may be better handled using input iterables classes as wrappers.
- See also issue #6
- Add multidimensional indexing support by using the latlon_to_xy routines.
- Make isel, sel, and other indexing features work correctly.
This list will be updated as needed.
It would be nice to have this as an extension to xarray. That way you could call something like
with xr.open_dataset('/path/to/file.nc') as xd:
t = xd.wrf.getvar('temp')
proj4 = xd.wrf.proj4
cart_proj = xd.wrf.cartopy
See: http://xarray.pydata.org/en/stable/internals.html#extending-xarray
I have used it here: https://github.com/snowman2/pangaea/blob/master/pangaea/xlsm.py
Looks like it would not be bad to try to merge with salem. See: https://github.com/fmaussion/salem/issues/82
Any news about an improved xarray support ? It would be nice at first to be able to get data from xarray datasets, like
with xr.open_dataset('/path/to/file.nc') as ds:
t = wrf.getvar(ds, 'temp')
I'm also wondering about this one. It's not straightforward to use getvar on a large number of WRF output files (see issue 94); seems xarray could help with this.
@Timothy-W-Hilton Thanks for bumping this!
I'd be interested in hearing about the wrf-python maintainers' perspective on this as well. I've been working a fair bit with WRF output in xarray (especially in the context of MetPy and CF conventions, see this abstract), and would be glad to collaborate on these efforts going forward if it seems to be a good fit.
We, the GeoCAT team at NCAR, do have plans to refactor wrf-python to be compatible with Xarray. However, the team's priority at the moment is rolling out model-agnostic computational routines (called GeoCAT.comp). These new functions operate directly on Xarray data arrays. The repo for these new functions is here: https://github.com/NCAR/geocat-comp
We don't yet have a timeframe for turning our focus back to wrf-python. However, if this is something that someone in the community wanted to bite off we'd be happy to provide guidance.
@clyne Thank you for the update! After the hecticness of the AMS Meeting and a few pending projects settle down, I'll see if (and in what ways) I could be of any help with this.
Terrific. BTW much of the GeoCAT Team will be at AMS, and there will be talk on the GeoCAT project:
"GeoCAT: The NCL Pivot to Python" Monday, January 13, 2020 2:00 PM - 2:15 PM Boston Convention and Exhibition Center - 157AB
On Jan 9, 2020, at 10:03 PM, Jon Thielen [email protected] wrote:
@clyne Thank you for the update! After the hecticness of the AMS Meeting and a few pending projects settle down, I'll see if (and in what ways) I could be of any help with this.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
John Clyne National Center for Atmospheric Research 303.497.1236 (w), 303.809.1922 (c) [email protected]
Thanks, @clyne, for the update! It's nice to know that the slowdown in wrf-python development these past six months doesn't indicate it's being phased out. I'm also open to helping out, though 2020 doesn't really have a lot of space for a large new project for me.