home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 247703455

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
247703455 MDU6SXNzdWUyNDc3MDM0NTU= 1500 Support for attributes with different dtypes when serialising to netcdf4 2941720 open 0     4 2017-08-03T13:18:12Z 2020-03-17T14:18:39Z   CONTRIBUTOR      

At the moment, bool and dates aren't supported as attributes when serializing to netcdf4:

```python

da = xr.DataArray(range(5), attrs={'test': True}) da <xarray.DataArray (dim_0: 5)> array([0, 1, 2, 3, 4]) Dimensions without coordinates: dim_0 Attributes: test: True

da.to_netcdf('test_bool.nc') ... TypeError: illegal data type for attribute, must be one of dict_keys(['S1', 'i1', 'u1', 'i2', 'u2', 'i4', 'u4', 'i8', 'u8', 'f4', 'f8']), got b1

da = xr.DataArray(range(5), attrs={'test': pd.to_datetime('now')}) da <xarray.DataArray (dim_0: 5)> array([0, 1, 2, 3, 4]) Dimensions without coordinates: dim_0 Attributes: test: 2017-08-03 13:02:29

da.to_netcdf('test_dt.nc') ... TypeError: Invalid value for attr: 2017-08-03 13:02:29 must be a number string, ndarray or a list/tuple of numbers/strings for serialization to netCDF files ```

I assume bool attributes aren't supported by netcdf4-python and dates are difficult (could always just write these as a string), but this would be really nice to have if possible.

As an aside, using h5netcdf works for bools, but coerces them to int64.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1500/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 4 rows from issue in issue_comments
Powered by Datasette · Queries took 0.81ms · About: xarray-datasette