Xesmf regridding projected coordinate system

Hello Pangeo people :wave:

I am trying to use xesmf for regridding an image with a projected coordinate system (UTM Easting/Northing in meters, instead of lat/lon in degrees) but I’m not able to accurately transform my data. I am able to create a Regridder function and run it, but the plot of my transformed data does not match the plot of my input data.

All of the examples of curvilinear coordinate transformation I have found use lat/lon, so my question is: is using projected/UTM grids not supported by xESMF or is this probably an issue in my code?

An example code using a ~650KB version of my data (and the steps/naming convention of the curvilinear tutorial) is in this gist and uses this little chunk of data, if that is helpful.

Thanks for the help and especially for maintaining such a great package!


Yeah I suspect Xesmf doesn’t deal with projections. See Example - Reproject — rioxarray 0.11.0 documentation

cc @JessicaS11 @scottyhq

This is indeed a tricky problem to sort through. We’ve recently managed to make something work using xesmf and custom projections.

We’ve done this by manually creating a target dataset with coordinates that xesmf can interpret. Below is an example from our code base that does this for the web-mercator projection (epsg:3857).

Once we have this target grid dataset generated, we use xesmf directly:

regridder = xe.Regridder(ds_in, ds_target, ...)
ds_regridded = regridder(ds_in)
1 Like