Skip to content

netcdf4-python creates fixed length unicode string attributes in netcdf4 files #575

Description

@shoyer

Over on the h5py issue tracker @krischer has noticed incompatibilities with strings set with setncattr by newer versions of netCDF4-python:
h5py/h5py#719 (comment)

These strings are saved in the HFD5 file as fixed width unicode:

      DATATYPE  H5T_STRING {
         STRSIZE 6;
         STRPAD H5T_STR_NULLTERM;
         CSET H5T_CSET_UTF8;
         CTYPE H5T_C_S1;
      }

I'm guessing this is related to the recent rewrite of string attribute handling in #529.

This very strange. netCDF-C reports that these are character arrays (NC_CHAR), but clearly they're saved as UTF-8 in the HDF5 file. Perhaps this is a bug in netCDF-C?

cc @mangecoeur

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions