[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #MSV-188900]: C++ API for NETCDF version 4.0



Lynton,

In reference to your telephone question about whether in netCDF-4
user-defined types could be inherited in sub-Groups if defined in
ancestor Groups, I think I gave you the wrong answer when I said
that they couldn't and there was no type inheritance hierarchy in
netCDF-4.

I just tried using the following CDL and "ncgen4 -b" to create a
netCDF-4 file, then used ncdump to look at the resulting file, and
everything appeared to show that the type inheritance worked as
you would expect!

netcdf gg-enums {
types:
  ubyte enum cloud_class_t {Clear = 0, 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) ;
                cloud_class_t primary_cloud:_FillValue = Missing ;
data:

 primary_cloud = Clear, Stratus, Clear, Cumulonimbus, _ ;

group: G1 {
  types:
    ubyte enum lightning_t {None = 0, Cloud_to_cloud = 1, Cloud_to_ground = 2,
        Ground_to_cloud = 3} ;
  variables:
        float var ;
        cloud_class_t gcloud ;
  data:

   var = 3 ;

   gcloud = Stratus ;

  group: G1A {
    variables:
        lightning_t zap ;
    data:

     zap = Cloud_to_cloud ;
    } // group G1A
  } // group G1
}

Note that variable zap in a Group G1A uses a type defined in its
parent Group G1, and similarly variable "var" in G1 uses a type
defined in the root Group.  That this works surprised me, and also
is inconsistent with our documentation.  I'll have to ask Ed how
it happens that this works, even though from what I've been told
about lack of inheritance in HDF5 it shouldn't.  Maybe all type
names are really global, even though defined in a Group.

--Russ

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: MSV-188900
Department: Support netCDF
Priority: Normal
Status: Closed