<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Use addfiles to read all 24 files and select the variable which you
want to write to the new file.<br>
<br>
Assume your 24 files are netCDF and their names start with
'infile':<br>
<br>
<font color="#3333ff"><tt>...<br>
filelist = systemfunc("ls infile*.nc")</tt><tt><br>
</tt><tt><br>
</tt><tt>f = addfiles(filelist,"r")</tt><tt><br>
</tt><tt><br>
</tt><tt>pres_pa = wrf_user_getvar(wrfin,"pres",-1) </tt></font>
<div><font color="#3333ff"><tt>t_k =
wrf_user_getvar(wrfin,"tk",-1)</tt></font></div>
<br>
<font color="#3333ff"><tt>system("rm -rf "+file_out)</tt><span
class=""><tt><br>
</tt><tt>wrfpost = addfile(file_out,"c")<br>
...<br>
<br>
</tt></span></font>-Karin<br>
<br>
<div class="moz-cite-prefix">Am 19.01.18 um 13:33 schrieb Noelia
otero:<br>
</div>
<blockquote type="cite"
cite="mid:CAG7o=LsrLxXj2DE5EPXQBpZFObZ=ECgRx+XbJiLx2ZWSSHzTfQ@mail.gmail.com">
<div dir="ltr">Hi Karin,
<div><br>
</div>
<div>Yes, I know..that's why I am not sure how I can do it. If I
have 24 files for one day, I just wanted to extract some
variables and storage the daily values in one single file. </div>
<div>Is there any way? If I use system("rm -rf" +file_out) my
file with previous value is removed...so I would have a new
file with the current time, which I don't want.. any
suggestion? </div>
<div><br>
</div>
<div>Thanks!</div>
<div>Noelia</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2018-01-19 13:30 GMT+01:00 Karin
Meier-Fleischer via ncl-talk <span dir="ltr"><<a
href="mailto:ncl-talk@ucar.edu" target="_blank"
moz-do-not-send="true">ncl-talk@ucar.edu</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> Hi Noelia,<br>
<br>
NCL can't create a new file when it already exits. You
have to make sure that the file doesn't exist or delete it
before using addfile.<br>
<br>
<font color="#3333ff"><tt>system("rm -rf "+file_out)</tt><span
class=""><tt><br>
</tt><tt>wrfpost = addfile(file_out,"c")</tt></span></font><br>
<br>
-Karin<br>
<br>
<div class="m_-3521044922961557663moz-cite-prefix">Am
19.01.18 um 13:15 schrieb Noelia otero via ncl-talk:<br>
</div>
<blockquote type="cite">
<div>
<div class="h5">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>I have hourly files from WRF and I wanted to
create daily files (with the hourly outputs,
Time=24). I was using addfile(, "c")....I know
the error I got it is caused by "c", once the
first file is created I can´t opened again..(If
I am not wrong, right?) Is there any way to do
it?</div>
<div><br>
</div>
<div>
<div>
<div>print(file_in)</div>
<div>; wrfout_d01_2010-01-01_00:00:<a
href="http://00.nc" target="_blank"
moz-do-not-send="true"><wbr>00.nc</a></div>
<div>wrfin = addfile(file_in,"r")</div>
<div><br>
</div>
<div>; I want the output: file_out=<a
href="http://met_wrfout_d01_2010-01-01.nc"
target="_blank" moz-do-not-send="true">met_wrfout_d01_2010-<wbr>01-01.nc</a> </div>
<div>wrfpost = addfile(file_out,"c")
;create new netCDF file<br>
</div>
<div><br>
</div>
<div>pres_pa = wrf_user_getvar(wrfin,"pres",-<wbr>1)</div>
<div>t_k = wrf_user_getvar(wrfin,"tk",-1)</div>
</div>
<div><br>
</div>
<div>
<div>wrfpost->t_k= t_k</div>
<div>wrfpost->pres_pa= pres_pa</div>
</div>
<div>
<div><br>
</div>
<div>Time = wrf_user_getvar(wrfin,"Times",<wbr>-1)</div>
<div>lat = wrf_user_getvar(wrfin,"lat",-<wbr>1)</div>
<div>lon = wrf_user_getvar(wrfin,"lon",-<wbr>1)</div>
<div><br>
</div>
<div>wrfpost->time = Time</div>
<div>wrfpost->lat= lat</div>
<div>wrfpost->lon= lon</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>Best</div>
<div>Noelia</div>
<div><br>
</div>
</div>
<br>
<fieldset
class="m_-3521044922961557663mimeAttachmentHeader"></fieldset>
<br>
</div>
</div>
<pre>______________________________<wbr>_________________
ncl-talk mailing list
<a class="m_-3521044922961557663moz-txt-link-abbreviated" href="mailto:ncl-talk@ucar.edu" target="_blank" moz-do-not-send="true">ncl-talk@ucar.edu</a>
List instructions, subscriber options, unsubscribe:
<a class="m_-3521044922961557663moz-txt-link-freetext" href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" moz-do-not-send="true">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a>
</pre>
</blockquote>
<br>
<pre class="m_-3521044922961557663moz-signature" cols="72">--
Dipl. Geophys. Karin Meier-Fleischer
Visualization, NCL, CDO
Application Support
Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a - D20146 Hamburg - Germany
Phone: <a href="tel:+49%2040%20460094126" value="+4940460094126" target="_blank" moz-do-not-send="true">+49 (0)40 460094 126</a>
Fax: <a href="tel:+49%2040%20460094270" value="+4940460094270" target="_blank" moz-do-not-send="true">+49 (0)40 460094 270</a>
E-Mail: <a class="m_-3521044922961557663moz-txt-link-abbreviated" href="mailto:meier-fleischer@dkrz.de" target="_blank" moz-do-not-send="true">meier-fleischer@dkrz.de</a>
URL: <a class="m_-3521044922961557663moz-txt-link-abbreviated" href="http://www.dkrz.de" target="_blank" moz-do-not-send="true">www.dkrz.de</a>
Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784
</pre>
</div>
<br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" moz-do-not-send="true">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" moz-do-not-send="true">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
</body>
</html>