 
 
 
  
 
 
 
   
 
2007 Unidata NetCDF Workshop for Developers and Data Providers  > Using NetCDF-4 Features, Part 1  
 
12.11 Multiple Unlimited Dimensions in NetCDF-4
It is possible to have more than one unlimited dimension in a
netCDF-4/HDF5 file.
 
-  Create multiple unlimited dimensions with multiple calls to
nc_def_dim.
-  Dimensions are visible in all sub-groups.
-  New inq function allows for the scanning of file metadata:
/* Find all dimids for a location. This finds all dimensions in a
 * group, or any of it's parents. */
EXTERNL int 
nc_inq_dimids(int ncid, int *ndims, int *dimids, int include_parents);
 
-  Multiple unlimited dimensions cannot be used with the classic
model.
      /* Create a file with two unlimied dims and nothing else. */
      if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR;
      if (nc_def_dim(ncid, REMUS, NC_UNLIMITED, &dimid[0])) ERR;
      if (nc_def_dim(ncid, ROMULUS, NC_UNLIMITED, &dimid[1])) ERR;
      /* Check it out before the enddef. */
      if (nc_inq_dim(ncid, dimid[0], name_in, &len_in)) ERR;
      if (len_in != NC_UNLIMITED || strcmp(name_in, REMUS)) ERR;
      if (nc_inq_dim(ncid, dimid[1], name_in, &len_in)) ERR;
      if (len_in != NC_UNLIMITED || strcmp(name_in, ROMULUS)) ERR;
      if (nc_inq_dimids(ncid, &ndims_in, dimids_in, 0)) ERR;
      if (ndims_in != 2 || dimids_in[0] != 0 || dimids_in[1] != 1) ERR;
      if (nc_inq_unlimdim(ncid, &unlimdimid_in[0])) ERR;
      if (unlimdimid_in[0] != 1) ERR;
      if (nc_inq_unlimdims(ncid, &nunlimdims_in, unlimdimid_in)) ERR;
      if (nunlimdims_in != 2 || unlimdimid_in[0] != 1 || unlimdimid_in[1] != 0) ERR;
      
      /* Automatically enddef and close. */
      if (nc_close(ncid)) ERR;
 
 
 
 
 
 
 
 
 
2007 Unidata NetCDF Workshop for Developers and Data Providers  > Using NetCDF-4 Features, Part 1