home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 537934462

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
537934462 MDU6SXNzdWU1Mzc5MzQ0NjI= 3621 ".indexes" not updated when setting values through ".values" 1277781 closed 0     1 2019-12-14T16:27:27Z 2019-12-16T18:38:10Z 2019-12-16T18:38:10Z CONTRIBUTOR      

MCVE Code Sample

```python import xarray as xr

da1 = xr.DataArray([1,2],dims=['x'],coords={'x':[0,1]})

print(da1.indexes) da1['x'].values = [1,2] print(da1.indexes) print('--------') print(da1['x'])

x: Int64Index([0, 1], dtype='int64', name='x') x: Int64Index([0, 1], dtype='int64', name='x') -------- <xarray.DataArray 'x' (x: 2)> array([1, 2]) Coordinates: * x (x) int32 1 2 ```

Expected Output

```python x: Int64Index([0, 1], dtype='int64', name='x') x: Int64Index([1, 2], dtype='int64', name='x')


<xarray.DataArray 'x' (x: 2)> array([1, 2]) Coordinates: * x (x) int32 1 2 ```

Problem Description

  • .indexes gets out of sync with the values stored in the array
  • this is unfortunate as alignment with other array is done through .indexes

The issue does not occur if I a, either do not call ".indexes" before setting the value, or b, call da1['x'] = [1,2] instead of da1['x'].values = [1,2]

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 22:01:29) [MSC v.1900 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: None LOCALE: None.None libhdf5: 1.10.5 libnetcdf: 4.6.3 xarray: 0.14.1 pandas: 0.25.1 numpy: 1.17.1 scipy: 1.3.1 netCDF4: 1.5.2 pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.4.0 distributed: 2.5.1 matplotlib: 3.1.1 cartopy: None seaborn: 0.9.0 numbagg: None setuptools: 41.2.0 pip: 19.2.3 conda: None pytest: 5.1.2 IPython: 7.8.0 sphinx: 2.2.0
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3621/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
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.639ms · About: xarray-datasette