html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/1193#issuecomment-517056258,https://api.github.com/repos/pydata/xarray/issues/1193,517056258,MDEyOklzc3VlQ29tbWVudDUxNzA1NjI1OA==,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}",,199032440
https://github.com/pydata/xarray/issues/1193#issuecomment-326135257,https://api.github.com/repos/pydata/xarray/issues/1193,326135257,MDEyOklzc3VlQ29tbWVudDMyNjEzNTI1Nw==,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 `scipy`engine 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}",,199032440
https://github.com/pydata/xarray/issues/1193#issuecomment-270763249,https://api.github.com/repos/pydata/xarray/issues/1193,270763249,MDEyOklzc3VlQ29tbWVudDI3MDc2MzI0OQ==,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}",,199032440
https://github.com/pydata/xarray/issues/1193#issuecomment-270737056,https://api.github.com/repos/pydata/xarray/issues/1193,270737056,MDEyOklzc3VlQ29tbWVudDI3MDczNzA1Ng==,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:
```
Dimensions: (dim0: 1, dim1: 0)
Coordinates:
* dim0 (dim0) int64 0
* dim1 (dim1) int64
Data variables:
x (dim0, dim1) |S1
```
after:
```
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}",,199032440