Closed lee1043 closed 3 months ago
Hi @jasonb5, is there any chance this could be fixed in #533?
@lee1043 This will be resolved in another PR after #533, it needs to be fixed for all the regridding tools.
Close this issue as it was resolved by #533.
Result of the minimal example code above after updating the xcdat to the latest main branch.
Close this issue as it was resolved by #533.
Result of the minimal example code above after updating the xcdat to the latest main branch.
Thank you for confirming!
What happened?
When NaN value exists in the original field, interpolation using regrid2 replaces NaN values to zero, then interpolates, which introduces error in the resulted field.
unmapped_to_nan=True
that was discussed in #528 forxesmf
is not available forregrid2
, wondering if that could be added.What did you expect to happen? Are there are possible answers you came across?
Original field has NaN values over the ocean, and when interpolate, it should look like one in the middle (example used xesmf). However, regrid2 injects zeros to NaN values before interpolation, then interpolates, resulting zero over land and gradation values along coastlines.
Minimal example code to reproduce the above plot is attached below.
Minimal Complete Verifiable Example (MVCE)
Relevant log output
No response
Anything else we need to know?
Sample input files used above:
Environment
xcdat 0.6.1
xr.show_versions()
INSTALLED VERSIONS ------------------ commit: None python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] python-bits: 64 OS: Darwin OS-release: 22.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: (None, 'UTF-8') libhdf5: 1.14.2 libnetcdf: 4.9.2 xarray: 2023.11.0 pandas: 2.1.3 numpy: 1.23.5 scipy: 1.11.4 netCDF4: 1.6.5 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.3 nc_time_axis: 1.4.1 iris: None bottleneck: None dask: 2023.12.0 distributed: 2023.12.0 matplotlib: 3.7.1 cartopy: 0.22.0 seaborn: 0.12.2 numbagg: None fsspec: 2023.12.0 cupy: None pint: None sparse: 0.14.0 flox: None numpy_groupies: None setuptools: 67.7.2 pip: 23.1.2 conda: None pytest: None mypy: None IPython: 8.18.1 sphinx: None