home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 617375423

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/3991#issuecomment-617375423 https://api.github.com/repos/pydata/xarray/issues/3991 617375423 MDEyOklzc3VlQ29tbWVudDYxNzM3NTQyMw== 5821660 2020-04-21T19:45:02Z 2020-04-21T19:45:02Z MEMBER

@lamorton You can look at this in two different ways. First, try to use dtype="|S9" on both occasions, since this will apply the zero-termination which is needed for the string to be interpreted correctly by netcdf (IIRC).

python import h5py f = h5py.File("error_demo.h5",mode='w') f.create_dataset('name',shape=(),dtype="|S9",data=np.array([b'f(Pt,TE)'],dtype='|S9')) f.close() for i in range(20): xr.load_dataset("error_demo.h5") <xarray.Dataset> Dimensions: () Data variables: name <U8 'f(Pt,TE)'

Second, use backend='h5netcdf' to read it sidestepping netcdf:

python import h5py f = h5py.File("error_demo.h5",mode='w') f.create_dataset('name',shape=(),dtype="|S8",data=np.array([b'f(Pt,TE)'],dtype='|S8')) f.close() for i in range(20): ds = xr.load_dataset("error_demo.h5", backend='h5netcdf') <xarray.Dataset> Dimensions: () Data variables: name |S8 b'f(Pt,TE)'

From your expectations It seems that the zero-padding is the culprit, since the output of the 'h5netcdf' backend doesn't quite fit.
Unfortunately I do not have links at hand with further comments on string handling differences between netcdf/hdf5. There are quite some...

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