<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Dave,</div><div class=""><br class=""></div><div class="">1.  My mistake.  The line should have read “W = ff->W”.</div><div class=""><br class=""></div><div class="">2.  I’m embarrassed to say that I tried my script out again, and it works now.  I don’t know what I was doing before that was causing it to corrupt the file.</div><div class=""><br class=""></div><div class="">Problem solved.</div><div class=""><br class=""></div><div class="">Thank you for your response.</div><div class=""><br class=""></div><div class="">— Mike</div><div class=""><br class=""></div><br class="">
<div><br class=""><blockquote type="cite" class=""><div class="">On May 13, 2022, at 7:57 PM, Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov" class="">dave.allured@noaa.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">1.  Something does not make sense here.  Why "W = f_in->W" rather than "W = ff->W" ??</div><div class=""><br class=""></div><div class="">2.  Instead of addfile(“wrfinput_d01”,”w”), try addfile(“wrfinput_d01.h5”,”w”).  It is a long shot.</div><div dir="ltr" class=""><br class=""></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 13, 2022 at 7:43 PM Michael Toy - NOAA Affiliate via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" class="">ncl-talk@mailman.ucar.edu</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hello,<br class="">
<br class="">
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”).<br class="">
<br class="">
Here’s my script:<br class="">
<br class="">
ff = addfile(“wrfinput_d01”,”w”)<br class="">
W = f_in->W    ; read the variable W (vertical velocity)<br class="">
.<br class="">
.<br class="">
“make some changes to W”<br class="">
.<br class="">
.<br class="">
ff->W=W     ; write the new values of W back to the file<br class="">
<br class="">
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:<br class="">
setfileoption(“h5”,”FileStructure”,”Advanced”)<br class="">
However, I tried this, and it didn’t work.<br class="">
<br class="">
I would appreciate any assistance with this.  Thank you.<br class="">
<br class="">
Best regards,<br class="">
Mike<br class=""></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>