<div dir="ltr"><div><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/calculate_daily_values.shtml"><b>calculate_daily_values</b></a></div><div><br></div><div>This is 'calendar aware'<br>                time:calendar = "noleap" ;<br> =================<br></div><div>  f = addfile("...","r")</div><div>  x = f->pr              <br></div><div>  nDim    = 0<br></div><div>  xDayAvg = <strong>calculate_daily_values</strong>(x, "avg", nDim, False)
</div><div><pre>              ;xDaySum = <strong>calculate_daily_values</strong>(x, "sum", nDim, False)
              ;xDayMin = <strong>calculate_daily_values</strong>(x, "min", nDim, False)
              ;xDayMax = <strong>calculate_daily_values</strong>(x, "max", nDim, False)
</pre></div><div>  <b>printVarSummary</b>(xDayAvg)</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Oct 13, 2019 at 10:54 AM Xueyan Zhang via ncl-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@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">Hi ncl_talk,<div><br></div><div>I have a variable like this:</div><div>dimensions:<br>        time = 2920 ;<br>        lat = 224 ;<br>        lon = 464 ;<br>variables:<br>        float time(time) ;<br>                time:calendar = "noleap" ;<br>                time:long_name = "observation time" ;<br>                time:units = "days since 2098-01-01 00:00:00" ;<br>        float lat(lat) ;<br>                lat:long_name = "latitude                 " ;<br>                lat:units = "degrees_north  " ;<br>        float lon(lon) ;<br>                lon:long_name = "longitude                " ;<br>                lon:units = "degrees_east   " ;<br>        float pr(time, lat, lon) ;<br>                pr:long_name = "Precipitation" ;<br>                pr:units = "mm" ;<br>                pr:_FillValue = 1.e+20f ;<br></div><div><br></div><div>the time value is 0,0.125..364.875</div><div>I want to calculate the mean value of pr among time dimension but using every 8 time index, like pr_mean (0) = (pr(0,:,:)+

pr(1,:,:)+

pr(2,:,:)+

pr(3,:,:)+

pr(4,:,:)+

pr(5,:,:)+

pr(6,:,:)+

pr(7,:,:))/8</div><div><br></div><div>I only thought about using loops but it is too slow. Any ideas?</div><div><br></div><div>Thanks!</div><div><br></div><div>Xueyan</div></div>
_______________________________________________<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/mailman/listinfo/ncl-talk</a></blockquote></div>