stcorp / harp

Data harmonization toolset for scientific earth observation data
http://stcorp.github.io/harp/doc/html/index.html
BSD 3-Clause "New" or "Revised" License
57 stars 19 forks source link

Allow empty string attributes for HDF5 files #165

Closed svniemeijer closed 6 years ago

svniemeijer commented 6 years ago

Currently we assumed that HDF5 files were not able to contain empty strings. However, a nccopy -7 on a netCDF3 file with an empty string attribute does produce a file with an empty attribute string:

current HARP:

      ATTRIBUTE "units" {
         DATATYPE  H5T_STRING {
            STRSIZE 7;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_ASCII;
            CTYPE H5T_C_S1;
         }
         DATASPACE  SCALAR
      }

Result from nccopy:

      ATTRIBUTE "units" {
         DATATYPE  H5T_STRING {
            STRSIZE 1;
            STRPAD H5T_STR_NULLTERM;
            CSET H5T_CSET_UTF8;
            CTYPE H5T_C_S1;
         }
         DATASPACE  NULL
      }
svniemeijer commented 6 years ago

Implemented in efac81a44644de57a796f454331bb8ffe058d078