<div dir="ltr">Dave: <div><br></div><div>Thank you. You hit the nail on the head. I only tried your first suggestion, opening the file once with "w").<br><div>
<p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"> </span></p>
<p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>filename="../RUN/<a href="http://wrfinput_d03.nc">wrfinput_d03.nc</a>"</span></p>
<p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>a_asc = (/"fort.80.d03"/)</span></p>
<p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-Apple-converted-space"> </span>a = addfile(filename,"w")</span></p><p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">l_obs_new := a->L_OBS</span></p>
<p class="gmail-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-s1" style="font-variant-ligatures:no-common-ligatures"> </span><span style="font-variant-ligatures:no-common-ligatures">a->L_OBS = l_obs_new</span></p><p class="gmail-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 style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-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 style="font-variant-ligatures:no-common-ligatures">works just fine, passing the last line (as you surmised it did not before).</span></p>
</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 22, 2019 at 1:53 AM Dave Allured - NOAA Affiliate <<a href="mailto:dave.allured@noaa.gov">dave.allured@noaa.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><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" target="_blank">barry.h.lynn@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid 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_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>a_asc = (/"fort.80.d03"/)</span></p>
<p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>a = addfile(filename,"r")</span></p>
<p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>l_obs_new := a->L_OBS<span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"><br></span></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"><br></span></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>f = addfile(filename,"w")</span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space">
</span></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space"> </span>f->L_OBS = l_obs_new</span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br></span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">fatal:["NclNetCDF4.c":2746]:NetCDF: HDF error</span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures">
</span></p><p class="gmail-m_5060970875688043832gmail-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_5060970875688043832gmail-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_5060970875688043832gmail-m_9222510627474806117gmail-s1" style="font-variant-ligatures:no-common-ligatures"><span class="gmail-m_5060970875688043832gmail-m_9222510627474806117gmail-Apple-converted-space">Thank you.</span></span></p></div></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior Associate Scientist, Lecturer,</div><div><div><span style="color:rgb(136,136,136)">The Institute of the Earth Science, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">The Hebrew University of Jerusalem, </span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Givat Ram, Jerusalem 91904, Israel </span><br style="color:rgb(136,136,136)"></div><span style="color:rgb(136,136,136)">Tel: 972 547 231 170</span><br style="color:rgb(136,136,136)"><span style="color:rgb(136,136,136)">Fax: (972)-25662581</span></div></div><div><span style="color:rgb(136,136,136)"><br></span></div><div>C.E.O, Weather It Is, LTD<br>Weather and Climate Focus<br><a href="http://weather-it-is.com" target="_blank">http://weather-it-is.com</a><br>Jerusalem, Israel<br>Local: 02 930 9525<br>Cell: 054 7 231 170<br>Int-IS: x972 2 930 9525<br><br></div></div></div></div></div>