mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-27 07:30:33 +08:00
65fd9fe1a5
re: https://github.com/Unidata/netcdf-c/issues/982 It is possible to define an enum type that has no enum constant with value zero. However, HDF5 has a default fill value of zero that it used to fill all chunks. In the event that this situation occurs, ncdump, say, will fail because there is no enum const to print for the value zero. The solution is to create a special enum constant called "_UNDEFINED" that has the value zero. It is only used in the case that there is no constant in the enum that already covers zero. A test case is added in netcdf-c/ncdump to validate this solution. Note: the changes occur primarily in libsrc4, so they also work for NCZarr.
14 lines
415 B
Plaintext
14 lines
415 B
Plaintext
netcdf tst_enum_undef {
|
|
types:
|
|
ubyte enum cloud_class_t {Cumulonimbus = 1, Stratus = 2, Stratocumulus = 3,
|
|
Cumulus = 4, Altostratus = 5, Nimbostratus = 6, Altocumulus = 7,
|
|
Cirrostratus = 8, Cirrocumulus = 9, Cirrus = 10, Missing = 255} ;
|
|
dimensions:
|
|
station = 5 ;
|
|
variables:
|
|
cloud_class_t primary_cloud(station) ;
|
|
data:
|
|
|
|
primary_cloud = _UNDEFINED, Stratus, _UNDEFINED, Cumulonimbus, Missing ;
|
|
}
|