<div dir="ltr">untested<br>----------------<br>undef("decadal_mean")<br>function decadal_mean(x_annual[*][*][*], long_name[1]:string)<br>local dim_annual, dim_decade, x_decade, nyr, nyr_annual<br>begin<br> dim_annual = dimsizes(x_annual)<br> dim_decade = dim_annual<br> dim_decade(0) = dim_annual(0)/10<br><br> x_decade = new(dim_decade, typeof(x_annual), getFillValue(x_annual))<br><br> nyr_annual = dim_annual(0) ; clarity<br> do nyr=0,nyr_annual-1,10<br> x_decade(nyr/10+1,:,:) = dim_avg_n(x_annual(nyr:nyr+9,:,:), 0)<br> end do<br><br> copy_VarMeta(x_annual(::10,:,:), x_decade)<br> x_decade@long_name = long_name<br><br> return(x_decade)<br>end<br>;----------------------------------------<br>; MAIN<br>;----------------------------------------<br><br>; .........<br>; .........<br>; .........<br><br> T_decade = decadal_mean(T_annual, "Decadal Me an Temperature")<br> printVarSummary(T_decade)<br> printMinMax(T_decade, 0)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 25, 2017 at 12:03 AM, 임수연 <span dir="ltr"><<a href="mailto:soottong@gmail.com" target="_blank">soottong@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">Dear All<div><br></div><div>I want to calculate decadal mean from annual data.</div><div>The dimension of annual data(T_annual) is:</div><div>[year|2000] x [lat|10] x [lon|19]</div><div>And the dimension what I want to get(T_decade) is:</div><div>[decade|200] x [lat|10] x [lon|19]</div><div><br></div><div>I attempted to use avg function:</div><div>------------------------------<wbr>---------------</div><div>T_decade = new((/200,10,19/),float)</div><div><br></div><div>T_decade!0 = "decade"</div><div>T_decade!1 = "lat"</div><div>T_decade!2 = "lon"</div><div>T_decade&lat = T_annual&lat</div><div>T_decade&lon = T_annual&lon</div><div><br></div><div>Do i = 0,199</div><div> n = 10*i</div><div> T_decade(i,:,:)=avg(T_annual(<wbr>n:n+9,:,:))</div><div>End Do</div><div>------------------------------<wbr>---------------</div><div><br></div><div>and it seems not a good way.</div><div>Could you advise me how to calculate decadal mean from annual data?</div><div>Thank you.</div><div><br></div><div>Soo</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>