issues: 573031381
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
573031381 | MDU6SXNzdWU1NzMwMzEzODE= | 3813 | Xarray operations produce read-only array | 1828519 | open | 0 | 7 | 2020-02-28T22:07:59Z | 2023-03-22T15:11:14Z | CONTRIBUTOR | I've turned on testing my Satpy package with unstable or pre-releases of some of our dependencies including numpy and xarray. I've found one error so far where in previous versions of xarray it was possible to assign to the numpy array taken from a DataArray. MCVE Code Sample```python import numpy as np import dask.array as da import xarray as xr data = np.arange(15, 301, 15).reshape(2, 10) data_arr = xr.DataArray(data, dims=('y', 'x'), attrs={'test': 'test'}) data_arr = data_arr.copy() data_arr = data_arr.expand_dims('bands') data_arr['bands'] = ['L'] n_arr = np.asarray(data_arr.data) n_arr[n_arr == 45] = 5 ``` Which results in: ```ValueError Traceback (most recent call last) <ipython-input-12-90dae37dd808> in <module> ----> 1 n_arr = np.asarray(data_arr.data); n_arr[n_arr == 45] = 5 ValueError: assignment destination is read-only ``` Expected OutputA writable array. No error. Problem DescriptionIf this is expected new behavior then so be it, but wanted to check with the xarray devs before I tried to work around it. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3813/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |