<div dir="ltr"><pre>"sum over all these 4 files to have a total temperature value"<br><br></pre><pre>sum or average?<br><br>=====================<br></pre><pre><br>   diri = "./"
   fili = systemfunc("cd "+diri+" ; ls FOO*.nc")
   nfili= dimsizes(fili)
   print("nfili="+nfili)
<br>   f    = addfiles(diri+fili,"r") <br>   tmp  = f[:]->TEMP<br></pre><pre>   printVarSummary(tmp)      ; tmp(time,lat,lon) <br>                             ;       0   1   2        <br></pre><pre>   tavg = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_avg_n_Wrap.shtml"><strong>dim_avg_n</strong>_<b>Wrap</b></a>(tmp,0)   ; _Wrap ==> return meta data<br></pre><pre>   printVarSummary(tavg)     ; tavg(lat,lon)<br></pre><pre>or<br></pre><pre>   tsum = <a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/dim_sum_n_Wrap.shtml"><b>dim_sum_n_Wrap</b></a> (tmp,0)<br></pre><pre>   printVarSummary(tsum)     ; tsum(lat,lon)

 =============<br></pre><pre>You could use the NCO or CDO from an NCL script.<br><br></pre><pre>Use <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml"><b>systemfunc</b></a> <br><br></pre><pre>    path = ....<br></pre><pre>    systemfunc("...")   ; use CDO or NCO to create a file;; say  FOO_Avg.nc<br></pre><pre>    favg = addfile("FOO_Avg.nc", r)  ; read the file created by NCO or CDO<br></pre><pre>    tavg = favg->T...<br></pre><pre><br>other examples are at:<br><a href="https://www.ncl.ucar.edu/Applications/"><b><br>https://www.ncl.ucar.edu/Applications/</b></a><br><br></pre><pre>See under <b>Miscellaneous<br><br></b></pre><pre><b>Specifically:  <a href="https://www.ncl.ucar.edu/Applications/system.shtml">System interactions and scripting</a></b></pre><pre><br><br></pre><pre><br><a href="https://www.ncl.ucar.edu/Applications/system.shtml"><b>https://www.ncl.ucar.edu/Applications/system.shtml</b></a></pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 18, 2022 at 8:40 AM Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</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>Dear Joe,</div><div>So many thanks for your advice, but this calculation is part of my NCL script, and can not shift to NCO.</div><div>Best wishes,<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 18, 2022 at 7:03 PM Joseph Zambon <<a href="mailto:jbzambon@ncsu.edu" target="_blank">jbzambon@ncsu.edu</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><div>Setareh,</div><div><br></div>NCO utilities might be the easiest way to attack that problem.<div><br></div><div>e.g. <a href="http://nco.sourceforge.net/nco.html#ncbo" target="_blank">http://nco.sourceforge.net/nco.html#ncbo</a></div><div><a href="http://nco.sourceforge.net/nco.html#ncap2" target="_blank">http://nco.sourceforge.net/nco.html#ncap2</a></div><div><br></div><div>-Joe</div><div><br></div><div><br><div>
<div>Joseph B. Zambon, Ph.D.<br>Research Assistant Professor<br><br>Ocean Observing and Modeling Group<br>Department of Marine, Earth and Atmospheric Sciences<br>North Carolina State University<br>Jordan Hall rm 4140<br>919.515.7928<br><a href="mailto:jbzambon@ncsu.edu" target="_blank">jbzambon@ncsu.edu</a><br><a href="http://www.joezambon.com" target="_blank">www.joezambon.com</a></div>
</div>
<div><br><blockquote type="cite"><div>On Feb 18, 2022, at 10:29, Setareh Rahimi via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:</div><br><div><div dir="ltr"><div>Dear NCL users,</div><div>I have 4 netcdf files containing temperature ( T(time,lat,lon)). I need to sum over all these 4 files to have a total temperature value . May I ask you to kindly advise me how I can  do this please?</div><div>many thanks in advance,</div><div>Best wishes,<br></div><div><br>-- <br><div dir="ltr">S.Rahimi<br><br></div></div></div>
_______________________________________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></div></blockquote></div><br></div></div></blockquote></div><br clear="all"><br>-- <br><div dir="ltr">S.Rahimi<br><br></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote></div>