home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 199032440 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 4

  • shoyer 1
  • jhamman 1
  • petercable 1
  • stale[bot] 1

author_association 3

  • MEMBER 2
  • CONTRIBUTOR 1
  • NONE 1

issue 1

  • Reading netcdf containing empty N-d string arrays causes exception · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
517056258 https://github.com/pydata/xarray/issues/1193#issuecomment-517056258 https://api.github.com/repos/pydata/xarray/issues/1193 MDEyOklzc3VlQ29tbWVudDUxNzA1NjI1OA== stale[bot] 26384082 2019-07-31T23:13:35Z 2019-07-31T23:13:35Z NONE

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Reading netcdf containing empty N-d string arrays causes exception 199032440
326135257 https://github.com/pydata/xarray/issues/1193#issuecomment-326135257 https://api.github.com/repos/pydata/xarray/issues/1193 MDEyOklzc3VlQ29tbWVudDMyNjEzNTI1Nw== jhamman 2443309 2017-08-30T22:18:25Z 2017-08-30T22:18:25Z MEMBER

@petercable - do you recall which backend/engine you were using? Did you have netcdf4 installed? I'm not able to reproduce this with either netcdf4 or h5netcdf. The scipyengine does result in an error:

Python In [4]: import xarray as xr ...: import numpy as np ...: engine = 'scipy' ...: a = np.array([[]], 'str') ...: ...: ds = xr.Dataset() ...: ds['x'] = (['dim0', 'dim1'], a, {}) ...: ds.to_netcdf('test.nc', engine=engine) ...: ...: ds = xr.open_dataset('test.nc', engine=engine) ...: ds.load() ...: print(ds)

``` ---> 10 ds = xr.open_dataset('test.nc', engine='scipy') 11 ds.load()

/Users/jhamman/Dropbox/src/xarray/xarray/backends/api.py in open_dataset(filename_or_obj, group, decode_cf, mask_and_scale, decode_times, autoclose, concat_characters, decode_coords, engine, chunks, lock, cache, drop_variables) 283 elif engine == 'scipy': 284 store = backends.ScipyDataStore(filename_or_obj, --> 285 autoclose=autoclose) 286 elif engine == 'pydap': 287 store = backends.PydapDataStore(filename_or_obj)

/Users/jhamman/Dropbox/src/xarray/xarray/backends/scipy_.py in init(self, filename_or_obj, mode, format, group, writer, mmap, autoclose) 133 filename=filename_or_obj, 134 mode=mode, mmap=mmap, version=version) --> 135 self.ds = opener() 136 self._autoclose = autoclose 137 self._isopen = True

/Users/jhamman/Dropbox/src/xarray/xarray/backends/scipy_.py in _open_scipy_netcdf(filename, mode, mmap, version) 81 try: 82 return scipy.io.netcdf_file(filename, mode=mode, mmap=mmap, ---> 83 version=version) 84 except TypeError as e: # netcdf3 message is obscure in this case 85 errmsg = e.args[0]

/Users/jhamman/anaconda/envs/xarray36/lib/python3.6/site-packages/scipy/io/netcdf.py in init(self, filename, mode, mmap, version, maskandscale) 264 265 if mode in 'ra': --> 266 self._read() 267 268 def setattr(self, attr, value):

/Users/jhamman/anaconda/envs/xarray36/lib/python3.6/site-packages/scipy/io/netcdf.py in _read(self) 591 self._read_dim_array() 592 self._read_gatt_array() --> 593 self._read_var_array() 594 595 def _read_numrecs(self):

/Users/jhamman/anaconda/envs/xarray36/lib/python3.6/site-packages/scipy/io/netcdf.py in read_var_array(self) 672 else: # not a record variable 673 # Calculate size to avoid problems with vsize (above) --> 674 a_size = reduce(mul, shape, 1) * size 675 if self.use_mmap: 676 data = self._mm_buf[begin:begin_+a_size].view(dtype=dtype_)

TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Reading netcdf containing empty N-d string arrays causes exception 199032440
270763249 https://github.com/pydata/xarray/issues/1193#issuecomment-270763249 https://api.github.com/repos/pydata/xarray/issues/1193 MDEyOklzc3VlQ29tbWVudDI3MDc2MzI0OQ== shoyer 1217238 2017-01-05T21:30:51Z 2017-01-05T21:30:51Z MEMBER

This looks like a bug to me.

The simplest thing would be to ensure that we never try to view the array with dtype='S0' (which is not valid). So some sort of special case for a size-zero trailing dimension in char_to_string is probably the right approach.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Reading netcdf containing empty N-d string arrays causes exception 199032440
270737056 https://github.com/pydata/xarray/issues/1193#issuecomment-270737056 https://api.github.com/repos/pydata/xarray/issues/1193 MDEyOklzc3VlQ29tbWVudDI3MDczNzA1Ng== petercable 6645714 2017-01-05T19:38:47Z 2017-01-05T20:01:34Z CONTRIBUTOR

I found that changing char_to_string resulted in dropping the 0 length dimension:

before:

<xarray.Dataset> Dimensions: (dim0: 1, dim1: 0) Coordinates: * dim0 (dim0) int64 0 * dim1 (dim1) int64 Data variables: x (dim0, dim1) |S1

after:

<xarray.Dataset> Dimensions: (dim0: 1) Coordinates: * dim0 (dim0) int64 0 Data variables: x (dim0) |S1

So, instead I modified conventions.decode_cf_variable to not wrap character arrays with a terminal zero length dimension as CharToStringArray:

if concat_characters: if data.dtype.kind == 'S' and data.dtype.itemsize == 1 and data.shape[-1] != 0: dimensions = dimensions[:-1] data = CharToStringArray(data)

And this appears to round-trip correctly.

EDIT: fixed output when modifying char_to_string

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Reading netcdf containing empty N-d string arrays causes exception 199032440

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 16.299ms · About: xarray-datasette