Re: NetCDF Digest - Vol 1 : Issue 32


Should I send responses to netcdfgroup or somewhere else?
Anyway, here goes.

> NetCDF Group Digest   Monday,  1 Mar 1993
>               Volume 1 : Issue 32
> Today's Topics:
> 02/28 The Maverick -- Appending data.
> ------------------------------------------------------------
> Subject: Appending data.
> From:    atae@xxxxxxxxxxxxxxxxxx (The Maverick)
> To:      "netcdfgroup@xxxxxxxxxxxxxxxx"
> Date:    Sun, 28 Feb 93 20:24:32 EST
> Hi
> I would like to add data to a netCDF file one record at a time. The reason
> is I have data files containing many Megabytes of data records. Storing the 
> data in an array before writing into a netCDF file is not feasible. Is there 
> a simple way to do this ? I read in the User's Guide that only one variable
> can have unlimited dimension. In this case I am forced to find out the number
> of records in order to set the dimensions of the data. This is also very
> cumbersome. Is there a way around this ? I know netCDF data is meant to be 
> appendable (-->FAQ) and I have looked in the Users' Guide but there is no 
> mention of "append" in the index. Your help would be greatly appreciated.
>       best regards
>               Ata <(|)>.
> End of NetCDF Digest [Volume 1 Issue 32]
> ****************************************

The function NCVARPUT can append data to files.  See Sec 7.5 of the user's
guide.  In practice, you would use NCVARPUT as you would use a FORTRAN 
direct-access write statement.  In other words, you need to supply a starting 
record number when appending.  You supply this value in the "start"
argument to NCVARPUT.  The "record number" would be the current value
of the unlimited dimension plus one.  

If you are creating a new file, you need to increment some record counter
starting from zero.  If you are appending to an existing file, you can
inquire as to the number of records using NCDIMINQ, which will return the
current value of the unlimited dimension.

I hope this is of some help.
  William Weibel                |  UCLA Department of Atmospheric Sciences
  weibel@xxxxxxxxxxxxxx         |       Los Angeles, CA  90024-1565
  Tel. (310)206-4441            |               U.S.A.  
  Fax  (310)206-5219            |