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

Re: 951010: netcdf bug?



Jim,

> To:       address@hidden
> From: Jim Mansbridge <address@hidden>
> Organization: CSIRO
> Keywords: 199510101100.AA03287

In the above message you wrote:
 
> I am using netcdf to produce restart files for a numerical model.  I
> produce the faulty file as follows.
> 
> 1) I run my numerical model and produce the restart file.  This file is
> fine and I make a copy of it called hist_09c_1.nc.
> 
> 2) I run the numerical model again and this time, instead of creating a
> new restart file, I overwrite the old one.  I now copy the restart file
> as hist_09c_2.nc.  I would expect the restart files to be identical,
> each containing one 'snapshot' of the model results.  (The time
> dimension is unlimited.)
> 
> However hist_09c_2.nc is 56 bytes longer than hist_09c_1.nc and the data
> is scrambled.  As mentioned earlier, the header information is written
> to hist_09c_2.nc twice.  The second writing is 8192 bytes into the
> file.  Likewise, the data is mostly offset by 8192 bytes although there
> must be some sort of wraparound since the file is only 56 bytes longer
> than the original.  It is hard to see where the wraparound occurs since
> most of the data are zeros.

We've talked this over and we'll need more information in order to
diagnose the problem.  Would you please specify, in detail, the sequence
of programs and functions that access the netCDF file.  For example:

    1.  run model
        2.  call nccreate()
        ...
    2.  cp hist_09c_1.nc temp.nc
    3.  run model 2nd time
        1.  call ncopen()
        3.  call ncredef()
        ...
    4.  cp hist_09c_1.nc hist_09c_2.nc

Is it possible that your program(s) are doing an lseek() on the netCDF
file descriptor or that they have the same netCDF file open more than
once, simultaneously?

--------
Steve Emmerson   <address@hidden>