-
Notifications
You must be signed in to change notification settings - Fork 6
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
Comparison with xESMF #48
Comments
Hi Ben, Thanks for the feedback! If xESMF works for you there is no reason to move over. However;
then this package could be for you. Note that your regridding has to be from rectilinear -> rectilinear, and not between different Coordinate Reference Systems. Notebooks comparing xarray-regrid to CDO and xESMF are available on the docs. For example: https://xarray-regrid.readthedocs.io/en/latest/notebooks/benchmarks/benchmarking_conservative.html If you do try xarray-regrid on your workflow it would be great to hear how it runs better/worse than xESMF (CPU time as well as memory use). |
Thanks so much @BSchilperoort for the prompt response!!! Your points are indeed pretty compelling. I'm not sure exactly when, but I'll probably give this a try at some point, and I'll make sure to report back. Thanks again! |
Adding my 2C on advantages this package offers:
The obvious limitation is non-rectilinear grids, where the flexibility of ESMF is hard to beat. |
An nice example for point 1: trying to regrid a large fixed land surface dataset. Here's the 30 arc second ETOPO geoid, which is 21600x43200: import xarray as xr
import xarray_regrid
ds = xr.open_dataset(
"https://www.ngdc.noaa.gov/thredds/dodsC/global/ETOPO2022/30s/30s_geoid_netcdf/ETOPO_2022_v1_30s_N90W180_geoid.nc",
chunks={},
)
ds = ds.rename(lon="longitude", lat="latitude").drop_vars("crs")
bounds = dict(south=-90, north=90, west=-180, east=180)
target = xarray_regrid.Grid(
resolution_lat=1,
resolution_lon=1,
**bounds,
).create_regridding_dataset()
%timeit ds.regrid.conservative(target);
This is basically an intractable problem for xesmf. I tried using their chunked parallel weight generation scheme and it still ran for 20 minutes then crashed. |
To be clear, this benchmarks the weight generation and graph creation, correct? Does it compute smoothly too? |
Then I have to actually download the file 😆 . But yes I'll try that |
ETA 1hr, NCEI server having a bad day I guess. I used With -1 chunks, regridding takes about 9s and uses ~15GB of memory. With 1000x1000 chunks, 4s and ~2GB of memory. Pretty good since the data itself is 3.5GB. |
Hey, this popped up on my GitHub feed and it looks interesting.
I'm already using xESMF which seems to have been around for much longer. I'm wondering:
Generalizing my personal request to an actionable feature request, it would be helpful if the docs compared xarray-regrid with existing regridders.
Thanks so much for publishing this project!
The text was updated successfully, but these errors were encountered: