home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 798676024

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
798676024 MDU6SXNzdWU3OTg2NzYwMjQ= 4854 `bounds_error=True` ignored in 1D interpolation 2405019 closed 0     0 2021-02-01T20:17:34Z 2021-02-10T21:42:06Z 2021-02-10T21:42:06Z CONTRIBUTOR      

What happened:

Attempted to interpolate outside coordinate range while passing bounds_error=True through kwargs dictionary (which internally gets passed to scipy.interpolate.interp1d). Instead if interp function raising a ValueError nans are returned.

What you expected to happen:

I expected a ValueError exception to be raised when I've passed in the kwargs bounds_error=True.

Minimal Complete Verifiable Example:

```python import xarray as xr import numpy as np

da = xr.DataArray( np.sin(0.3 * np.arange(12).reshape(4, 3)), [("time", np.arange(4)), ("space", [0.1, 0.2, 0.3])], )

this should return nans, as the default is to fill with nans

da.interp(time=3.5)

<xarray.DataArray (space: 3)> array([nan, nan, nan]) Coordinates: * space (space) float64 0.1 0.2 0.3 time float64 3.5

this should raise ValueError, but bounds_error is ignored

da.interp(time=3.5, kwargs=dict(bounds_error=True))

<xarray.DataArray (space: 3)> array([nan, nan, nan]) Coordinates: * space (space) float64 0.1 0.2 0.3 time float64 3.5

```

Anything else we need to know?:

I've made a pull-request to fix the issue

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 2.7.15.final.0 python-bits: 64 OS: Linux OS-release: 3.10.0-957.27.2.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: None.None xarray: 0.10.7 pandas: 0.23.0 numpy: 1.14.3 scipy: 1.1.0 netCDF4: None h5netcdf: None h5py: 2.7.1 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.5 distributed: 1.21.8 matplotlib: None cartopy: None seaborn: None setuptools: 39.1.0 pip: 10.0.1 conda: 4.6.4 pytest: 3.5.1 IPython: 5.7.0 sphinx: 1.7.4
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4854/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 0 rows from issue in issue_comments
Powered by Datasette · Queries took 0.707ms · About: xarray-datasette