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

Re: questions



>From: address@hidden (Celeste M Matarazzo)
>Organization: University of California, LLNL
>Keywords: 199405200431.AA15219 netCDF

Celsete,

>I'm a new users of the netcdf library and I have a few questions for you.
>
>1) Is there a way to determine the number of records already written for
>variables with an unlimited dimension?   For Example,  I open a netcdf file
>and I want to append to a variable data after the last record. 

Use the ncinquire function (NetCDF User's Guide, pp 55-56) to get the ID of 
the unlimited dimension and and then use ncdiminq (NetCDF User's Guide, p 70)
to get the current length of the unlimited dimension.

>2) What I tried to do in one of my applications is keep track of the
>   record count and then write a record_count variable to the file.
>   I wanted to write the record_count variable just before I closed the file.
>
>   When I tried to do this my code dumped core.  The debugger says is
>   crashed inside the routine ncredef.  In particular in xdr_NC_dim
>   at the line   *dpp = (NC_dim *) malloc(sizeof(NC_dim));
>
>   Throughout this application, I use ncredef and ncendef many times and it
>   works fine.
>
>   It is baffling to me because when I moved the call to the function
>   that writes the scalar record_count  variable to the file to another place
>   in the application (e.g., after one record of data is written to the file)
>   It works.
>
>   I don't expect that I made myself very clear.  Perhaps you can
>   give me some insight about writing files that mix variables with an
>   unlimited dimension with  scalar variables.
>
>   And this will all be moot if you have a answer to question one.

I assume that the response to 1) will suffice.

>Thank you for your assistance.

Tom Yoksas