I am try to implement NetCDF compound data types in the julia package NCDatasets.jl.
I came across a strange issue where ncdump does not accept the NetCDF file generated by ncgen.
ncgen is given the following CDL:
netcdf weather_data {
types:
byte enum cloud_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, Overcast = 3};
compound obs_t {
float temperature;
int humidity;
cloud_t sky_condition; // Nested Enum
};
dimensions:
station = 3;
variables:
obs_t weather_reports(station);
data:
weather_reports =
{22.5, 65, Clear},
{18.0, 90, Cumulonimbus},
{15.4, 82, Overcast};
}
Note the nested enum. ncgen seem to be work fine
ncgen -o compound_enum_issue.nc compound_enum_issue.cdl
but ncdump compound_enum_issue.nc fails with:
netcdf compound_enum_issue {
types:
byte enum cloud_t {Clear = 0, Cumulonimbus = 1, Stratus = 2, Overcast = 3} ;
compound obs_t {
float temperature ;
int humidity ;
cloud_t sky_condition ;
}; // obs_t
dimensions:
station = 3 ;
variables:
obs_t weather_reports(station) ;
data:
NetCDF: Invalid argument
Location: file dumplib.c; fcn ncenum_typ_tostring line 959
weather_reports = {22.5, 65, Clear}, {0, 5915024, Clear},
Only the first value is correct.
I am using netcdf version 4.10.0 distributed by julia on Linux.
I have similar issue with other NetCDF version installed on my system.
Maybe ncgen did not create correctly data in the first place.
Or do you see a problem with my CDL?
I am try to implement NetCDF compound data types in the julia package NCDatasets.jl.
I came across a strange issue where
ncdumpdoes not accept the NetCDF file generated byncgen.ncgenis given the following CDL:Note the nested enum.
ncgenseem to be work finencgen -o compound_enum_issue.nc compound_enum_issue.cdl
but
ncdump compound_enum_issue.ncfails with:Only the first value is correct.
I am using netcdf version 4.10.0 distributed by julia on Linux.
I have similar issue with other NetCDF version installed on my system.
Maybe ncgen did not create correctly data in the first place.
Or do you see a problem with my CDL?