<div dir="ltr"><div><div><div><br>In addition to the CDO, the netCDF operators (NCO; <a href="http://nco.sourceforge.net/">http://nco.sourceforge.net/</a> ) could perform the averaging. Specifically,<br><a href="http://nco.sourceforge.net/nco.html#ncra">http://nco.sourceforge.net/nco.html#ncra</a><br><br></div>   %> ncra ERA_Plev.nc  <a href="http://ERA_Plev.Means.nc">ERA_Plev.Means.nc</a><br><br></div><div>The above will average all variables on the file with a 'time' (record) dimension. There are assorted options that allow such actions as subsetting.<br></div><div><br></div>The CDO and NCO are invoked from the command line. They are designed to do a specific task in a computational and memory efficient manner. <br>Also, there is no 'programming' involved! <br><br>NCL is a general purpose language. As a result, it does have some overhead. <br><br></div>Good luck<br> </div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 8, 2018 at 12:52 PM, Soma Roy <span dir="ltr"><<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">Thank you Adam Phillips.<div dir="auto">I will check this. Another way I think, using CDO first 'split' time steps or 'timmean' entire file then perform the operations over different variables in NCL.</div><span class="HOEnZb"><font color="#888888"><div dir="auto"><br></div><div dir="auto">Soma</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mar 9, 2018 01:15, "Adam Phillips" <<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Soma,<div>Please remember to always respond to the ncl-talk email list when responding. That way others can assist and can also see the answers to queries. </div><div><br></div><div>Your emailed reply stated:</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">> How much space is then required to process all the variables in single run? <span style="font-size:12.8px">I am using NCL in my laptop (i5 with 8GB ram)and free space in that drive is 86 GB.</span><br></span><br></div><div>I cannot answer that question precisely. Your machine will be using part of its' memory for core functionality and other tasks. What you can do is to try to conserve memory in your script as best as you can. The sample coding snippets I sent you will assist in that task. Try what I suggested and let ncl-talk know if you have further issues. Note that beyond what I stated in my original reply, another avenue you might have to take to save memory is to read in the variables in  different scripts. </div><div>Adam</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 8, 2018 at 8:35 AM, Soma Roy <span dir="ltr"><<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying to access multiple variables from a file and need to average over time for each variables.</div><div><br></div><div>I am running the following codes:</div><div><br></div><div><div>   fn  = "ERA_Plev.nc"                      ; define filename</div><div>   in  = addfile(fn,"r")                         ; open netcdf file</div><div>   printVarSummary(in)</div><div><br></div><div>T=in->t       ; temperature</div><div>U=in->u      ; U wind</div><div>V=in->v      ; V wind</div><div><br></div><div>printVarSummary(T)</div><div>printVarSummary(U)</div><div>printVarSummary(V)</div><div><br></div><div>;T1 = dim_avg_n(T,0)</div><div>;T@units = "K"</div><div><span style="white-space:pre-wrap">                                                           </span></div><div>end</div></div><div><br></div><div>Summary of the file is like below;<br></div><div><br></div><div><div>Variable: in</div><div>Type: file</div><div>File path: ERA_Plev.nc</div><div>Number of global attributes:     2</div><div>Number of dimensions:    4</div><div>Number of variables:     18</div><div>fatal:NclMalloc Failed:[errno=12]</div><div>Segmentation fault (core dumped)</div></div><div><br></div><div>When I am calling only Temperature using the codes below;</div><div><br></div><div><div>fn  = "ERA_Plev.nc"               ; define filename</div><div>in  = addfile(fn,"r")                         ; open netcdf file</div><div>   printVarSummary(in)</div><div><br></div><div>T=in->t     ; temperature</div><div>;U=in->u     ; U wind</div><div>;V=in->v     ; V wind</div><div><br></div><div>printVarSummary(T)</div><div>;printVarSummary(U)</div><div>;printVarSummary(V)</div><div><br></div><div>;T1 = dim_avg_n(T,0)</div><div>;T@units = "K"</div><div><span style="white-space:pre-wrap">                                                               </span></div><div>end</div></div><div> </div><div>It shows</div><div><br></div><div><div>Variable: T</div><div>Type: short</div><div>Total Size: 1042566000 bytes</div><div>            521283000 values</div><div>Number of Dimensions: 4</div><div>Dimensions and sizes:   [time | 120] x [level | 25] x [latitude | 721] x [longitude | 241]</div><div>Coordinates:</div><div>            time: [994176..994890]</div><div>            level: [50..125]</div><div>            latitude: [90..-90]</div><div>            longitude: [60..120]</div><div>Number Of Attributes: 7</div><div>  scale_factor :        0.00218919045579553</div><div>  add_offset :  252.4797479951041</div><div>  _FillValue :  -32767</div><div>  missing_value :       -32767</div><div>  units :       K</div><div>  long_name :   Temperature</div><div>  standard_name :       air_temperature</div></div><div><br></div><div><br></div><div>I have to call several other variables from this file (14 GB) and I need to average over time such that 'Dimensions' of each variables will be like below;</div><div><br></div><div>[time | 1]*

<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">[level | 25] x [latitude | 721] x [longitude | 241]</span>

</div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></div><div>Which function I have to use in this case?</div><div><br></div><div><br></div><div>When I am trying to call  other variables from the file I am getting the error message as;</div><div><br></div><div><div>Variable: in</div><div>Type: file</div><div>File path: ERA_Plev.nc</div><div>Number of global attributes:     2</div><div>Number of dimensions:    4</div><div>Number of variables:     18</div><div>fatal:NclMalloc Failed:[errno=12]</div><div>Segmentation fault (core dumped)</div></div><div><br></div><div>Please kindly inform me how to resolve this issue.</div><div><br></div><div><br></div><div>Thank you,</div><div>Soma</div><div><br></div><div>

<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div></div></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2873624000662104019m_7114100082087912925gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a>   </font></span><span><font color="#888888"><a href="tel:(303)%20497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</blockquote></div></div>
</div></div><br>______________________________<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></div>