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

20000530: NetCDF definitions



Linda,

> To: "'address@hidden'" <address@hidden>
> From: "Mann, Linda" <address@hidden>
> Subject: NetCDF definitions
> Organization: UCAR/Unidata
> Keywords: 200005301359.e4UDxTT11409

In the above message, you wrote:

> I am trying to create a NetCDF file using C data structures.  In section
> 3.2.3 of the NetCDF User's Guide "More on General Array Section Access gives
> an example.  It also references section 7.9  "Write a Mapped Array of
> Values:  nc_put_varm_type".  
> 
> My question is how do you define (nc_def_var) the componets of the data
> structure.
> 
> example:      struct {
>                  char par_name[12] ;
>                  float par_value ;
>               } PARDATA ;
> 
>               struct {
>                  char    group_name[12] ;
>                  char    group_names_array[4096][12] ;
>                  char    group_units_array[4096][12] ;
>                  PARDATA group_par[4096][20] ;
>               } GROUPDATA[200] ;
> 
> Linda Mann
> Wyle Laboratories
> Hampton Va.
> (757) 865-0000 (ext. 272)

There are many, different, netCDF datasets that would be compatible with
the above, in-memory, C structure.  In CDL notation, one of the more
obvious ones is the following:

    dimensions:
        name_len = 12;
        par_count = 20;
        name_count = 4096;
        group_count = 200;

    variables:
        char par_name(group_count, name_count, par_count, name_len);
        float par_value(group_count, name_count, par_count);
        char group_name(group_count, name_len);
        char group_names_array(group_count, name_count, name_len);
        char group_units_array(group_count, name_count, name_len);

One could use non-standard conventions when accessing the netCDF dataset
to avoid the large storage allocation requirements (assuming such
storage wasn't necessary) -- at the risk of making the netCDF dataset
non-standard and, hence, non-portable.

Regards,
Steve Emmerson   <http://www.unidata.ucar.edu>