issues: 554376164
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
554376164 | MDU6SXNzdWU1NTQzNzYxNjQ= | 3718 | losing shallowness of ds.copy() on ds from xr.open_dataset | 15570875 | open | 0 | 1 | 2020-01-23T20:02:55Z | 2020-01-23T21:39:05Z | NONE | MCVE Code Sample``` import numpy as np import xarray as xr xlen = 4 x = xr.DataArray(np.linspace(0.0, 1.0, xlen), dims=('x')) varname = 'foo' xr.Dataset({varname: xr.DataArray(np.arange(xlen, dtype='float64'), dims=('x'), coords={'x': x})}).to_netcdf('ds.nc') with xr.open_dataset('ds.nc') as ds: ds2 = ds.copy() ds2[varname][0] = 11.0 print(f'ds.equals = {ds.equals(ds2)}') with xr.open_dataset('ds.nc') as ds: ds2 = ds.copy() print(f'ds.equals = {ds.equals(ds2)}') ds2[varname][0] = 11.0 print(f'ds.equals = {ds.equals(ds2)}') ``` Expected OutputI expect the code to write out
However, when I run it, the last line is
Problem DescriptionThe code above writes a small In the first context manager block, a value in The second context manager block is the same as the first, except that I don't understand how evaluating I only observe this behavior when I'm rather perplexed by this. Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3718/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |