hdf5: added unknown storage specification

In case HDF5 adds more storage specifications, netcdf4 should be able to
cope with them by default. Further specializations could be added
nonetheless.
This commit is contained in:
Tobias Kölling 2020-09-02 16:13:23 +02:00
parent 89e656d7a5
commit 4c27730ae3
4 changed files with 17 additions and 6 deletions

View File

@ -293,11 +293,13 @@ NOTE: The NC_MAX_DIMS, NC_MAX_ATTRS, and NC_MAX_VARS limits
/** In HDF5 files you can set storage for each variable to be either
* contiguous or chunked, with nc_def_var_chunking(). This define is
* used there. */
* used there. Unknown storage is used for further extensions of HDF5
* storage models, which should be handled transparently by netcdf */
/**@{*/
#define NC_CHUNKED 0
#define NC_CONTIGUOUS 1
#define NC_COMPACT 2
#define NC_CHUNKED 0
#define NC_CONTIGUOUS 1
#define NC_COMPACT 2
#define NC_UNKNOWN_STORAGE 3
/**@}*/
/** In HDF5 files you can set check-summing for each variable.

View File

@ -1140,6 +1140,10 @@ get_chunking_info(hid_t propid, NC_VAR_INFO_T *var)
{
var->storage = NC_COMPACT;
}
else
{
var->storage = NC_UNKNOWN_STORAGE;
}
return NC_NOERR;
}

View File

@ -1709,8 +1709,10 @@ rec_print_metadata(NC_GRP_INFO_T *grp, int tab_count)
strcat(storage_str, "contiguous");
else if (var->storage == NC_COMPACT)
strcat(storage_str, "compact");
else
else if (var->storage == NC_CHUNKED)
strcat(storage_str, "chunked");
else
strcat(storage_str, "unknown");
LOG((2, "%s VARIABLE - varid: %d name: %s ndims: %d "
"dimids:%s storage: %s", tabs, var->hdr.id, var->hdr.name,
var->ndims,

View File

@ -988,7 +988,7 @@ pr_att_specials(
} else if(contig == NC_COMPACT) {
pr_att_name(ncid, varp->name, NC_ATT_STORAGE);
printf(" = \"compact\" ;\n");
} else {
} else if(contig == NC_CHUNKED) {
size_t *chunkp;
int i;
pr_att_name(ncid, varp->name, NC_ATT_STORAGE);
@ -1002,6 +1002,9 @@ pr_att_specials(
printf("%lu%s", (unsigned long)chunkp[i], i+1 < varp->ndims ? ", " : " ;\n");
}
free(chunkp);
} else {
pr_att_name(ncid, varp->name, NC_ATT_STORAGE);
printf(" = \"unknown\" ;\n");
}
/* _Filter (including deflate and shuffle) */