[ncl-talk] Writing to NETCDF4 HDF5 files
Dave Allured - NOAA Affiliate
dave.allured at noaa.gov
Sun Apr 21 16:53:39 MDT 2019
Barry,
Are you reading and writing the same file in the same script run? If so,
it is strange to have the same file open at the same time on two different
file handles "a" and "f". Try opening the file on only one file handle,
one time only per run, and mode "w". "w" supports both read and write on
the same file. (See addfile docs.) Alternatively, it might be sufficient
to have two addfiles, but use the same file handle both times.
Otherwise, I need more diagnostics. Identify the exact line that gave the
error. I think it is the second addfile, but we shouldn't rely on a
guess. Also show ncdump -hs, preferably in a text attachment with .txt
suffix. Also show your NCL version and the versions of netcdf and HDF5
libraries linked to NCL. Also ensure the file on disk is not write
protected.
On Sun, Apr 21, 2019 at 12:06 PM Barry Lynn <barry.h.lynn at gmail.com> wrote:
> Hi:
>
> Back to this problem again, but not like before. I can read my wrf output
> files without any difficulty.
>
> I compiled WRF with netcdf4 and hdf5 compression. I ran real.exe to
> produce wrfinput_d03.nc
>
> I read a variable L_OBS from the file without any problem.
>
> filename="../RUN/wrfinput_d03.nc"
>
> a_asc = (/"fort.80.d03"/)
>
> a = addfile(filename,"r")
>
> l_obs_new := a->L_OBS
>
>
> But, I cannot write it back (after modifying it -- this works fine with
> classic netcdf.
>
>
> f = addfile(filename,"w")
>
> f->L_OBS = l_obs_new
>
>
> I get this error (the file is definitely present, as I read from it):
>
>
> fatal:["NclNetCDF4.c":2746]:NetCDF: HDF error
>
> fatal:["NclAdvancedFile.c":2871]:_NclFileFillHLFS: Error opening file
> <../RUN/wrfinput_d03.nc>
>
>
> Thank you.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190421/56f952ef/attachment.html>
More information about the ncl-talk
mailing list