home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 545762025

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
545762025 MDU6SXNzdWU1NDU3NjIwMjU= 3664 Regression 0.14.0 -> 0.14.1: __setattr__ no longer updates matching index 13662783 closed 0     2 2020-01-06T14:42:50Z 2020-01-06T16:03:16Z 2020-01-06T15:37:17Z CONTRIBUTOR      

MCVE Code Sample

This came up in the following (simplified) case: ```python import numpy as np import xarray as xr

x = [1, 2, 3, 4] data = [1., 2., 3. , 4.] dims = ["x"] coords = {"x": x} da = xr.DataArray(data, coords, dims) da1 = da.sel(x=[1, 3]) da2 = da.sel(x=[2, 4]) da2["x"].values = da1["x"].values da3 = da2 - da1 print(da3) ```

In 0.14.1, this results in an empty DataArray da3: python <xarray.DataArray (x: 0)> array([], dtype=float64) Coordinates: * x (x) int64

0.14.0 (and before), no issues: python <xarray.DataArray (x: 2)> array([1., 1.]) Coordinates: * x (x) int32 1 3

Interestingly, the values of da["x"] are okay, print(da2["x"]") gives: array([1, 3])

However, the index has not been updated, print(da2.indexes["x"]): Int64Index([2, 4], dtype='int64', name='x')

Expected Output

I'm expecting output as in 0.14.0 and before. I've briefly stepped through the code for da2["x"].values = da1["x"].values; I don't see any changes there between 0.14.0 and 0.14.1, so I'm guessing it's due to some change in the indexes. Apparently the index no longer uses the same array?

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: None.None libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.14.1 pandas: 0.25.3 numpy: 1.17.3 scipy: 1.3.2 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: 1.1.1 cfgrib: None iris: None bottleneck: None dask: 2.6.0 distributed: 2.6.0 matplotlib: 3.1.1 cartopy: None seaborn: None numbagg: None setuptools: 41.6.0.post20191030 pip: 19.3.1 conda: None pytest: None IPython: 7.9.0 sphinx: 2.2.1
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3664/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
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.81ms · About: xarray-datasette