home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 831130073

This data as json

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/5223#issuecomment-831130073 https://api.github.com/repos/pydata/xarray/issues/5223 831130073 MDEyOklzc3VlQ29tbWVudDgzMTEzMDA3Mw== 4160723 2021-05-03T09:09:25Z 2021-05-03T09:09:25Z MEMBER

I checked with a very basic example:

```python import numpy as np import xarray as xr

p_var = np.full((2, 2), np.datetime64('2000-01-01'), dtype='datetime64[ns]') ds = xr.Dataset({'p__var': (('main', 'idx'), var)}) ds.to_netcdf('test.nc', engine='netcdf4') # works! ```

The only difference with the example in your notebook is that in the example above ds.p__var.encoding returns an empty dictionary. If you reset the encoding in your notebook example, e.g., ds_out_no_scale.p__var.encoding = {} you will be able to save the Dataset to a netcdf4 file. Not sure why...

(side note: with mask_and_scale=True, masking missing values withnan causes the dtype to change to float, because type(np.nan) is float).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  868907284
Powered by Datasette · Queries took 0.707ms · About: xarray-datasette