Previous: Multiple Unlimited Dimensions Next: Enumerations Table of contents Frames User guide
2007 Unidata NetCDF Workshop for Developers and Data Providers > Introduction to NetCDF-4

11.8 Compound Types
Compound types provide a portable version of C structs.
Examples
types:
  compound wind_vector_t {
    float eastward ;
    float northward ;
    }
dimensions:
    lat = 18 ;
    lon = 36 ;
    pres = 15 ;
    time = 4 ;
variables:
    wind_vector_t gwind(time, pres, lat, lon) ;
       wind:long_name = "geostrophic wind vector" ;
       wind:standard_name = "geostrophic_wind_vector" ;
data:
    gwind = {1, -2.5}, {-1, 2}, {20, 10}, {1.5, 1.5}, ...;
types:
  compound ob_t {
      int station_id ;
      double time ;
      float temperature ;
      float pressure ;
  }
dimensions:
    nstations = unlimited ;
variables:
    ob_t obs(nstations) ;
data:
    obs = {42, 0.0, 20.5, 950.0}, ... ;

Potential uses for compound types

 


Previous: Multiple Unlimited Dimensions Next: Enumerations Table of contents Frames User guide
2007 Unidata NetCDF Workshop for Developers and Data Providers > Introduction to NetCDF-4