issues: 309949357
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 309949357 | MDU6SXNzdWUzMDk5NDkzNTc= | 2029 | Can't re-save netCDF after opening it and modifying it? | 37649 | closed | 0 | 4 | 2018-03-30T01:16:11Z | 2019-01-06T10:46:40Z | 2018-03-31T22:30:50Z | NONE | Code Sample, copy-pastable```python import xarray as xr import numpy as np import pandas as pd filename = 'foo.nc' print('creating fresh file') temp = 15 + 8 * np.random.randn(2, 2, 3) precip = 10 * np.random.rand(2, 2, 3) lon = [[-99.83, -99.32], [-99.79, -99.23]] lat = [[42.25, 42.21], [42.63, 42.59]] ds = xr.Dataset( { 'temperature': (['x', 'y', 'time'], temp), 'precipitation': (['x', 'y', 'time'], precip) }, coords={ 'lon': (['x', 'y'], lon), 'lat': (['x', 'y'], lat), 'time': pd.date_range('2014-09-06', periods=3), 'reference_time': pd.Timestamp('2014-09-05') }) ds.to_netcdf(filename) del ds ds = xr.open_dataset(filename, autoclose=True) print('opened file') print(ds['temperature']) ds['temperature'][0, 0, 0] += 1000 ds.to_netcdf(filename) ### Crashes import osds.to_netcdf(filename + '2')os.rename(filename + '2', filename)``` Problem description
Expected OutputIf instead of Output of
|
{
"url": "https://api.github.com/repos/pydata/xarray/issues/2029/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
completed | 13221727 | issue |