<div dir="ltr">Thank you. Obvious in retrospect, but no less helpful!<div><br></div><div>Barry</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 30, 2016 at 8:57 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You need to change these lines:<br>
<br>
<br>
if(isfilepresent(filename)) then<br>
system("/bin/rm " + filename)<br>
end if<br>
f = addfile(filename,"c")<br>
<br>
<br>
This is removing the file if it exists and the open a new file. You<br>
can simply replace these lines with<br>
<br>
f = addfile(filename,"w")<br>
<br>
which opens an existing file with write access.<br>
<br>
Hope that helps.<br>
-dave<br>
<div><div class="h5"><br>
<br>
<br>
On Fri, Dec 30, 2016 at 6:09 AM, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com">barry.h.lynn@gmail.com</a>> wrote:<br>
> Hello:<br>
><br>
> I found this wonderful program on an e-mail exchange.<br>
><br>
> I have attached my version.<br>
><br>
> <a href="https://www.ncl.ucar.edu/Support/talk_archives/2011/0619.html" rel="noreferrer" target="_blank">https://www.ncl.ucar.edu/<wbr>Support/talk_archives/2011/<wbr>0619.html</a><br>
><br>
> (how to replace a variable in a variable in an ncl file).<br>
><br>
> However, as set up, this overwrites the old wrfinput_d02, rather than just<br>
> replacing the modified variable.<br>
><br>
> Also, when I read this variable in the new <a href="http://wrfinput_d02.nc" rel="noreferrer" target="_blank">wrfinput_d02.nc</a> file (now just<br>
> three variables), it is missing coordinate information (below), although I<br>
> seem to add this information before writing it.<br>
><br>
> If someone could explain how to replace a single variable, rather than to<br>
> overwrite the whole file that would be great (and to add coordinate<br>
> information).<br>
><br>
> Thank you<br>
><br>
> float L_OBS ( ncl0, ncl1, ncl2 )<br>
> lon2d : <ARRAY of 39204 elements><br>
> lat2d : <ARRAY of 39204 elements><br>
> _FillValue : 9.96921e+36<br>
><br>
> float xlat ( south_north, west_east )<br>
> coordinates : XLONG XLAT<br>
> stagger :<br>
> units : degree_north<br>
> description : LATITUDE, SOUTH IS NEGATIVE<br>
> MemoryOrder : XY<br>
> FieldType : 104<br>
><br>
><br>
> --<br>
> Barry H. Lynn, Ph.D<br>
> Senior Lecturer,<br>
> The Institute of the Earth Science,<br>
> The Hebrew University of Jerusalem,<br>
> Givat Ram, Jerusalem 91904, Israel<br>
> Tel: 972 547 231 170<br>
> Fax: (972)-25662581<br>
><br>
> C.E.O, Weather It Is, LTD<br>
> Weather and Climate Focus<br>
> <a href="http://weather-it-is.com" rel="noreferrer" 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>
> US 914 432 3108<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Barry H. Lynn, Ph.D<div><div>Senior 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>US 914 432 3108<br></div></div></div>
</div>