Regridding problem using xesmf with masks

Hi all,

I am trying to use xesmf.Reggrider between two grids that have a mask.
I use the command in a jupyter notebook (found in the documentation):
regridder = xe.Regridder(afs_in_msks, aft_out_mskt, method=“patch”, periodic=True, extrap_method=“nearest_s2d”)
but I have an error message:
TypeError: Regridder.init() got an unexpected keyword argument ‘extrap_method’
If I can’t use some extrap_method, I do not know ho to manage target points that do not receive any value … Does any one know what is happening ?
Thanks for your help,
Laure

1 Like

You should get a quicker answer here: Discussions · pangeo-data/xESMF · GitHub

Just a quick guess, but how did you install xesmf, and which version did you install?

If you installed from PyPI: there’s unfortunately a old version on PyPI under the xesmf name (the sole maintainer of the original xesmf package is missing), so instead of:

pip install xesmf

you would need to use

pip install pangeo-xesmf

If you installed from conda-forge you won’t have that issue (but then it would still be interesting to know the version).


If that doesn’t help, you should definitely ask the maintainers directly.

Hi,
Thanks for your rapid answer. I will try pangeo-esmf and let you know.

Just a heads up that @rabernat mentioned on the Pangeo Weekly Checkin yesterday that due to new capabilities in geopandas, it is efficient to do regridding only using geopandas and xarray, creating the weights through polygon geometry calculations.

He said he would soon post an example to Discourse so watch this space! :slight_smile:

2 Likes