[ncl-talk] read/write HDF5 files

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Fri May 13 19:57:08 MDT 2022


1.  Something does not make sense here.  Why "W = f_in->W" rather than "W =
ff->W" ??

2.  Instead of addfile(“wrfinput_d01”,”w”), try
addfile(“wrfinput_d01.h5”,”w”).  It is a long shot.


On Fri, May 13, 2022 at 7:43 PM Michael Toy - NOAA Affiliate via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello,
>
> I want to modify one of the fields of a WRF “wrfinput” file.  I have no
> problem doing this if the file is netCDF, but this one is an HDF5 file
> (“Hierarchical Data Format (version 5) data”).
>
> Here’s my script:
>
> ff = addfile(“wrfinput_d01”,”w”)
> W = f_in->W    ; read the variable W (vertical velocity)
> .
> .
> “make some changes to W”
> .
> .
> ff->W=W     ; write the new values of W back to the file
>
> These lines execute just fine, but the resulting file is corrupted and
> unreadable.  The problem, I guess, is that I haven’t correctly accounted
> for the fact that wrfinput_d01 is an HDF5 file.  I’ve checked online and it
> looks like I have to add following line at the top of my script:
> setfileoption(“h5”,”FileStructure”,”Advanced”)
> However, I tried this, and it didn’t work.
>
> I would appreciate any assistance with this.  Thank you.
>
> Best regards,
> Mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220513/ca00bddc/attachment.html>


More information about the ncl-talk mailing list