<div dir="ltr"><div>Barry,</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Apr 21, 2019 at 12:06 PM Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com">barry.h.lynn@gmail.com</a>> wrote:<br></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"><div dir="ltr"><div dir="ltr">Hi:<div><br></div><div>Back to this problem again, but not like before. I can read my wrf output files without any difficulty.</div><div><br></div><div>I compiled WRF with netcdf4 and hdf5 compression. I ran real.exe to produce <a href="http://wrfinput_d03.nc" target="_blank">wrfinput_d03.nc</a></div><div><br></div><div>I read a variable L_OBS from the file without any problem.</div><div><br></div><div>
<p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">filename="../RUN/<a href="http://wrfinput_d03.nc" target="_blank">wrfinput_d03.nc</a>"</span></p>
<p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>a_asc = (/"fort.80.d03"/)</span></p>
<p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>a = addfile(filename,"r")</span></p>
<p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>l_obs_new := a->L_OBS<span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"><br></span></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space">But, I cannot write it back (after modifying it -- this works fine with classic netcdf.</span></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"><br></span></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>f = addfile(filename,"w")</span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space">
</span></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>f->L_OBS = l_obs_new</span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">I get this error (the file is definitely present, as I read from it):</span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">fatal:["NclNetCDF4.c":2746]:NetCDF: HDF error</span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-style:normal;font-variant-caps:normal;font-weight:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">fatal:["NclAdvancedFile.c":2871]:_NclFileFillHLFS: Error opening file <../RUN/<a href="http://wrfinput_d03.nc" target="_blank">wrfinput_d03.nc</a>></span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">
</span></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><br></p><p class="gmail-m_9222510627474806117gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:21px;line-height:normal;font-family:"Courier New";color:rgb(0,0,0)"><span class="gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_9222510627474806117gmail-Apple-converted-space">Thank you.</span></span></p></div></div></div>
</blockquote></div></div>