issues: 2127671156
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2127671156 | I_kwDOAMm_X85-0a90 | 8728 | Lingering memory connections when extracting underlying `np.arrays` from datasets | 16925278 | open | 0 | 6 | 2024-02-09T18:39:34Z | 2024-02-26T06:02:15Z | CONTRIBUTOR | What is your issue?I know that generally, However, I generally assume that certain operations should break this connection, for example:
- extracting the underlying In other words, I would expect that using Here's an example that illustrates how in these cases, the objects are still linked in memory: (apologies for the somewhat hokey example) ``` import xarray as xr import numpy as np Create a datasetds = xr.Dataset(coords = {'lon':(['lon'],np.array([178.2,179.2,-179.8, -178.8,-177.8,-176.8]))}) print('\nds: ') print(ds) Create a new dataset that uses the values of the first datasetds2 = xr.Dataset({'lon1':(['lon'],ds.lon.values)}, coords = {'lon':(['lon'],ds.lon.values)}) print('\nds2: ') print(ds2) Change ds2's 'lon1' variableds2['lon1'][ds2['lon1']<0] = 360 + ds2['lon1'][ds2['lon1']<0]
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/8728/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |