You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most Python libraries that plot raster images use a (y, x) or (lat, lon) ordering of dimensions. This is the convention used by Matplotlib's pyplot with images, and many libraries that utilize it (Xarray, rasterio).
(lat, lon) ordering is also used for higher dimensional data that follows the netCDF-CF conventions, which are a standard for climate forecast data. Specifically:
https://ferret.pmel.noaa.gov/Ferret/documentation/coards-netcdf-conventions Order of dimensions:
If any or all of the dimensions of a variable have the interpretations of "date or time" (a.k.a. "T"), "height or depth"(a.k.a. "Z"), "latitude" (a.k.a. "Y"), or "longitude" (a.k.a. "X") then those dimensions should appear in the relative order T, then Z, then Y, then X in the CDL definition corresponding to the file.
By contrast Xee currently creates an Xarray dataset with dimensions in the order (time, lon, lat) in which the lon and lat coordinates are swapped. This requires the user to process (transpose) the data before using Matplotlib or similar plotting libraries.
This convention difference may have contributed to several the the Xee issues that have been raised (#45, #171, #174).
I think it may be worth changing Xee's coordinate ordering to (time, lat, lon) in order to match the convention used by netCDF-CF and Matplotlib. I realize this will be a breaking change for some users, but it will make the library easier to use for future users.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Most Python libraries that plot raster images use a (y, x) or (lat, lon) ordering of dimensions. This is the convention used by Matplotlib's pyplot with images, and many libraries that utilize it (Xarray, rasterio).
(lat, lon) ordering is also used for higher dimensional data that follows the netCDF-CF conventions, which are a standard for climate forecast data. Specifically:
By contrast Xee currently creates an Xarray dataset with dimensions in the order (time, lon, lat) in which the lon and lat coordinates are swapped. This requires the user to process (transpose) the data before using Matplotlib or similar plotting libraries.
This convention difference may have contributed to several the the Xee issues that have been raised (#45, #171, #174).
I think it may be worth changing Xee's coordinate ordering to (time, lat, lon) in order to match the convention used by netCDF-CF and Matplotlib. I realize this will be a breaking change for some users, but it will make the library easier to use for future users.
Thoughts?
Beta Was this translation helpful? Give feedback.
All reactions