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

Re: 20001110: How to append data to an existing netCDF file?



>From: address@hidden (Zhenjiang Li)
>Subject: How to append data to an existing file?
>Organization: University of South FLorida
>Keywords: 200011110432.eAB4WSD24699 netCDF extend

Hi George,

> I can not find any instructions from the user's guide about
> the appending data to an existing file without destroying 
> the existing data? is it a flaw in netcdf? 

No, it's not a flaw.  You can append data to an existing file by using
the "unlimited dimension", also called the "record dimension".  You
can append data to any netCDF variable that uses the unlimited
dimension without "destroying existing data" or rewriting the file.
This only appends data to the end of the file, so the time required is
proportional to the amount of data you append, not the amount of data
previously in the file.

For instructions, see the numerous mentions of the unlimited dimension
and record variables in any of the netCDF Users Guides for C, Fortran
77, or Fortran 90, links to which are available from

  http://www.unidata.ucar.edu/packages/netcdf/docs.html

For example, for appending data using the C interface, see sections
2.2, 2.3, 6.1, 7.6, 7.7, 9.1, and Appendix B.  The way you append data
is by just writing additional records of a record variable, using
ordinary nc_put_var calls.

> people don;t want to creat new file every time the data are
> generated and have to be stored.  This is an very important 
> subject in any software package. Why don't you guys just offer
> more lines in this topics? I am disappointed.

We're sorry about your disappointment, but if you read the
documentation on record variables and the unlimited dimension, maybe
you will be pleasantly surprised.  I just checked that there is an
index entry for "appending data" that points to the sections on the
unlimited dimension and the chapter on variable I/O.

--Russ