[ncl-talk] read/write HDF5 files
Michael Toy - NOAA Affiliate
michael.toy at noaa.gov
Fri May 13 17:43:06 MDT 2022
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
More information about the ncl-talk
mailing list