home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 661076732

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
661076732 MDU6SXNzdWU2NjEwNzY3MzI= 4239 Xarray dimension interpolation strips coordinate attributes 19657652 closed 0     1 2020-07-19T21:19:35Z 2021-04-27T07:00:07Z 2021-04-27T07:00:07Z NONE      

What happened: DataArray.interp strips the dimension coordinate attributes.

What you expected to happen: Preserved coordinate attributes.

Minimal Complete Verifiable Example:

Input:

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

data = xr.DataArray( np.random.rand(5), dims='x', coords={'x': ('x', np.arange(5), {'foo': 'bar'})} )

print(data.x.attrs) # initial attributes print(data.sel(x=2).x.attrs) # sel and isel preserve attributes print(data.interp(x=2.5).x.attrs) # interp does not preserve attributes with xr.set_options(keep_attrs=True): print(data.interp(x=2.5).x.attrs) # keep_attrs does nothing ```

Output:

python {'foo': 'bar'} {'foo': 'bar'} {} {}

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.8.3 | packaged by conda-forge | (default, Jun 1 2020, 17:43:00) [GCC 7.5.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: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.15.1 pandas: 1.0.4 numpy: 1.18.4 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.1.3 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.17.2 distributed: 2.18.0 matplotlib: 3.2.1 cartopy: 0.18.0 seaborn: None numbagg: None setuptools: 47.3.0.post20200616 pip: 20.1.1 conda: 4.8.3 pytest: None IPython: 7.15.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4239/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

  • 1 row from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.57ms · About: xarray-datasette