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
Extrapolation does not seem to be working on 2D data arrays. The area outside the input grid is NaN in the interpolated data when using kwargs={"fill_value": None} as arguments to the interp function (the extrapolation does work when using scipy.interpolate.interpn and passing fill_value=None along with bounds_error=False).
This figure shows the example data arrays from the code snippet provided here:
What did you expect to happen?
Area outside the input grid filled with extrapolated data.
you probably need to set kwargs={"fill_value": "extrapolate"} for this to work. As far as I remember, scipy is unfortunately a bit inconsistent in what value of fill_value corresponds to extrapolation, and in this case we're actually using interp1d under the hood (not sure in which situation interp1d is chosen over interpn, though).
That works thanks. I just checked the example in the docs now and that uses kwargs={"fill_value": None} in the 2D example with the result evaluating to NaNs. That one also works and returns actual values when using "extrapolate" instead so it looks like something might have changed in xarray or scipy.
What happened?
Extrapolation does not seem to be working on 2D data arrays. The area outside the input grid is NaN in the interpolated data when using
kwargs={"fill_value": None}
as arguments to theinterp
function (the extrapolation does work when usingscipy.interpolate.interpn
and passingfill_value=None
along withbounds_error=False
).This figure shows the example data arrays from the code snippet provided here:
What did you expect to happen?
Area outside the input grid filled with extrapolated data.
Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:53)
[GCC 9.4.0]
python-bits: 64
OS: Linux
OS-release: 5.13.0-1031-gcp
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4
xarray: 0.20.2
pandas: 1.3.5
numpy: 1.19.5
scipy: 1.7.3
netCDF4: 1.5.8
pydap: None
h5netcdf: None
h5py: 3.7.0
Nio: None
zarr: 2.11.3
cftime: 1.6.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2022.02.0
distributed: None
matplotlib: 3.5.2
cartopy: None
seaborn: 0.11.2
numbagg: None
fsspec: 2022.5.0
cupy: None
pint: 0.18
sparse: None
setuptools: 59.8.0
pip: 22.1.1
conda: 4.12.0
pytest: 7.1.2
IPython: 7.33.0
sphinx: None
The text was updated successfully, but these errors were encountered: