home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 831779578

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
831779578 MDU6SXNzdWU4MzE3Nzk1Nzg= 5036 In-place operation on DataArray coordinate throws error but still modifies the coordinate values 39047984 closed 0     1 2021-03-15T12:51:21Z 2021-11-09T20:28:13Z 2021-11-09T20:28:13Z NONE      

Example: Py import xarray as xr import numpy as np data = np.random.rand(4, 3) locs = np.arange(3.) times = np.arange(4.) foo = xr.DataArray(data, coords=[times, locs], dims=["time", "space"]) foo

When trying to do an in-place modification of the coordinate values Py foo.coords['time'] += 10. I get Py ValueError: Cannot assign to the .values attribute of dimension coordinate a.k.a IndexVariable 'time'. Please use DataArray.assign_coords, Dataset.assign_coords or Dataset.assign as appropriate. However, when looking at the values of the coordinate, they seem to have been modified by the operation:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.7 (default, May 7 2020, 21:25:33) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 5.4.0-66-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.6 libnetcdf: None xarray: 0.16.2 pandas: 1.2.0 numpy: 1.19.4 scipy: 1.5.3 netCDF4: None pydap: None h5netcdf: None h5py: 3.1.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.2.2 cartopy: None seaborn: None numbagg: None pint: 0.16.1 setuptools: 49.6.0.post20201009 pip: 20.3.3 conda: 4.9.2 pytest: 6.1.2 IPython: 7.19.0 sphinx: 3.3.0
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5036/reactions",
    "total_count": 1,
    "+1": 1,
    "-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.967ms · About: xarray-datasette