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

[Support #MWB-826938]: NetCDF .cdl to .nc conversion using ncgen



Hi Chad,

An 11KB CDL file can easily result in a 133MB binary file, because of
fill values, written when you create a file but don't write all the data.
See the section of the C or Fortran Users Guide on fill values for more
information:

  http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c.html#Fill-Values
  
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-f77.html#NF_005fSET_005fFILL

or the description of the "_FillValue" attribute in the Appendix on Attribute
Conventions:

  
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf.html#Attribute-Conventions

You can avoid the use of fill values with the "-x" option to ncgen:

     -x   Don't initialize data with fill values.  This can speed
          up  creation  of  large netCDF files greatly, but later
          attempts to read unwritten data from the generated file
          will not be easily detectable.

By way of explanation for your case, you have specified values for the time
variable, which is a "record variable" that uses the unlimited dimension.
According to the netCDF Users Guide:

  To grow variables along an unlimited dimension, write the data using
  any of the netCDF data writing functions, and specify the index of
  the unlimited dimension to the desired record number. The netCDF
  library will write however many records are needed (using the fill
  value, unless turned off) to fill in any intervening records.

I hope this helps ...

--Russ

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



Ticket Details
===================
Ticket ID: MWB-826938
Department: Support netCDF
Priority: Normal
Status: Closed