home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where type = "issue" and user = 37649 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue · 1 ✖

state 1

  • closed 1

repo 1

  • xarray 1
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? fasiha 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 os

ds.to_netcdf(filename + '2')

os.rename(filename + '2', filename)

```

Problem description

<snipped very long stacktrace, can produce if desired> OSError: [Errno -51] NetCDF: Unknown file format: b'/path/to/foo.nc' I encountered this problem when opening a netCDF file, modifying it, and trying to save it back. This is with netCDF4==1.3.1 and scipy==1.0.1. (Potentially related: #2019?)

Expected Output

If instead of to_netcdf overwriting the just-opened file, I write to a new file and then os.rename (see the three commented lines above) the new file to the original location, all is well. ncdump reports that my change took.

Output of xr.show_versions()

INSTALLED VERSIONS commit: None python: 3.6.4.final.0 python-bits: 64 OS: Darwin OS-release: 17.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.2 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.1 netCDF4: 1.3.1 h5netcdf: None h5py: None Nio: None zarr: None bottleneck: None cyordereddict: None dask: None distributed: None matplotlib: None cartopy: None seaborn: None setuptools: 39.0.1 pip: 9.0.3 conda: None pytest: None IPython: 6.2.1 sphinx: None
{
    "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 xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 18.668ms · About: xarray-datasette