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

Re: 970828: netCDF 2.4 implementation



>To: address@hidden
>From: address@hidden
>Subject: netCDF 2.4 implementation
>Organization: Dept of Atmospheric and Oceanic Sciences, McGill University 
>Keywords: 199708280527.XAA05087

Hi Rick,

>      I get a puzzling bug when trying to save data to a netCDF file
> using ncvarput: a small portion of the array fails to be stored,
> even though the array itself is well defined and of the proper type,
> and the origin and interval vectors are also properly defined.
> 
>             origin[0] = match;
>             origin[1] = 0;
>             origin[2] = 0;
>             origin[3] = 0;
>             interval[0] = 1;                                            /* 
> set storage for single date, and */
>             interval[1] = LEVELS;                                       /* 
> all available levels, lats and lons */
>             interval[2] = LATS;
>             interval[3] = LONS;
>             ncvarput(ncid, par_id, origin, interval, short_grid);       /* 
> store the (packed) grids */
> 
> using
>         short short_grid[LEVELS][LATS][LONS];
>         long origin[4], interval[4];
> 
> The lost data is always at the end of the array short_grid, which
> is evident when visualizing the data at the topmost level.  I have
> tried a variety of different ways to store the data but invariably 
> I lose a bit at the end.  I am wondering whether this is a bug
> that someone experienced with netCDF might recognize.  Any help
> is appreciated.  Thankyou in advance.

The only previous time I've seen this, it was a symptom of neglecting to call 

  ncclose(ncid);

before exiting.  The ncclose() call flushes the buffer that's used to
improve the efficiency of netCDF I/O, and is required before your
program exits to make sure all the data gets to the disk.

If you're sure you have called ncclose(), we'll need an example that
fails in order to reproduce and diagnose the problem on the current
3.3.1 version of netCDF.

--Russ

_____________________________________________________________________

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