-
Notifications
You must be signed in to change notification settings - Fork 155
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
support xarray.Dataset as input to get_cartopy and getvar #6
Comments
Thank you for the feedback. I plan on improving xarray support in the future 1.1 release, so this is definitely on my to-do list. For now, a workaround for get_cartopy is to use the 'getproj' function by supplying the MAP_PROJ, TRUELAT1, TRUELAT2, MOAD_CEN_LAT, STAND_LON, POLE_LAT, POLE_LON global attributes from the WRF file as keyword arguments to getproj (note: it's case insensitive). This will return one of the Projection subclasses. You can then call the Projection.cartopy() method to get the cartopy object. As long as the projection is not a RotatedPole projection, you should have all you need. For the RotatedPole projection, you need to use the Projection.cartopy_xlim() and Projection.cartopy_ylim() methods to set the map boundaries, since the builtin stuff with cartopy doesn't work correctly with RotatedPole (however, it might be fixed now). This requires supplying a GeoBounds argument, which is just the corner points from XLAT and XLONG. |
Thanks, that's great to hear! Thanks to the xarray developer(s), it's even easier:
Cheers! |
Nice, didn't know about that. I might be able to sneak this change in now, since this requires no change to the underlying netcdf reading code. It might not get documented until version 1.1. |
I guess it's related to pydata/xarray#4809. |
Hi, So is there a way to work with the get_cartopy using xarray.open_mfdataset() |
it would be great if the
get_cartopy
andgetvar
functions would accept axarray.Dataset
asvar
input. Obviously, this can only work properly if theDataset
was loaded with a standardxarray.open_dataset
call and the metadata were not modified, but still, it would be very convenient.The text was updated successfully, but these errors were encountered: