<div dir="ltr"><div>Did you even try any of these functions?</div><div>Here is one approach using all years.</div><div><br></div><div>================================<br></div><div> fn = "<a href="http://zo_hist_1850-2005_ens_1-100.nc">zo_hist_1850-2005_ens_1-100.nc</a>" ; define filename<br> in = addfile(fn,"r") ; open netcdf file<br> ; zo:[time|1872] x [ens|100] x [depth|1] x [lat|45] x [lon|90]<br> x = in->zo(:,:,0,:,:) <br> printVarSummary(x) ; [time | 1872] x [ens | 100] x [lat | 45] x [lon | 90]</div><div> printMinMax(x,0)</div><div> print("============")</div><div><br></div><div> xClm = clmMonTLLL(x) ; climatologies for each ensemble member<br> printVarSummary(xClm) ; <b>[month | 12] </b>x [ens | 100] x [lat | 45] x [lon | 90]<br> printMinMax(xClm,0)<br> print("============")<br><br> xAnom = calcMonAnomTLLL(x,xClm) ; anomalies from each ensemble member climatology<br> printVarSummary(xAnom) ; [<b>time | 1872] x [ens | 100] x [lat | 45] x [lon | 90]</b><br> printMinMax(xAnom,0)<br> print("============")</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 11, 2019 at 3:48 AM Sri.durgesh Nandini-Weiss 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 bgcolor="#FFFFFF">
<br>
<div>
<p><font face="Helvetica, Arial, sans-serif">Hello everyone,</font></p>
<p><font face="Helvetica, Arial, sans-serif">I am doing a simple
calculation on monthly means data e.g. temp from 1850-2000.</font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font face="Helvetica, Arial, sans-serif">I would like to calculate
the mean, standard deviation (e.g temp<font style="font-size:11pt" size="2"><span lang="en-US"> from 1986-2006). For this
</span></font><font style="font-size:11pt" size="2"><span lang="en-US">the seasonal cycles of the respective periods
should be removed otherwise its probably not Gaussian so i
want to extract the seasonal cycle out of my data.<br>
</span></font></font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US">Are the below steps the correct
way to do this? My script is successful in retrieving the
anomalies.</span></font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US">however i want which function
is correct? (rmvmean or </span></font><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US">calcMonAnomTLLL)</span></font><br>
<font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US"><span style="font-size:16.4773px;font-family:sans-serif">rmvmean</span><span style="font-size:16.4773px;font-family:sans-serif">(x)</span><span style="font-size:16.4773px;font-family:sans-serif">: remove mean
(and </span><span style="font-size:16.4773px;font-family:sans-serif">returns deviation from mean) <br>
</span></span></font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US"><span style="font-size:16.4773px;font-family:sans-serif"> </span></span></font><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US"><span style="font-size:16.4773px;font-family:sans-serif"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US"></span></font><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US">calcMonAnomTLLL(x): </span></font>Anomalies
from Annual Cycle: calcMonAnomTLL: contributed.ncl<br>
<br>
</span> </span></font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US">;=================================================================<br>
; Concepts illustrated:<br>
; - Calculates long term monthly means (monthly
climatology) from monthly data: (time,lev,lat,lon) version <br>
; - Compute monthly anomalies using monthly climatology<br>
; - Calculates climatological anomalies by subtracting the
long term mean from each point. <br>
; - Assumes monthly data. If the input data contains
metadata (e.g. coordinate variables and attributes), these
will be retained. <br>
;==================================================================<br>
yrStrt = 1986<br>
yrLast = 2006<br>
<br>
f = addfile("<a href="http://zo_hist_1850-2005_ens_1-100.nc" target="_blank">zo_hist_1850-2005_ens_1-100.nc</a>","r")<br>
TIME = f->time<br>
TIME = TIME-31<br>
YYYY = cd_calendar(TIME,-1)/100 ; entire
file<br>
iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast) ;this
is from 1 Jan 1986 to 1 Dec 2006<br>
<br>
zo =
f->zo(iYYYY,:,:,:,:)
; [time | 240] x [ens:100] x [depth:1] x [lat | 192] x [lon
| 288]<br>
zo@_FillValue = 9.96921e+36<br>
printVarSummary(zo)<br>
printMinMax(zo,0)<br>
<br>
zo1 = dim_avg_n_Wrap( zo,
2) ;[time | 240] x
[ens:100] x [lat | 192] x [lon | 288]<br>
printVarSummary(zo1)<br>
<br>
;==================================================================<br>
; Compute monthly climatology<br>
;==================================================================<br>
<br>
zo2 = clmMonTLLL( zo1
) ; [month | 12] x
[ens | 100] x [lat | 45] x [lon | 90]<br>
printVarSummary(zo2) <br>
<br>
;==================================================================<br>
; Compute monthly anomalies from the above climatology to
remove seasonal cycle<br>
;==================================================================<br>
<br>
zAnom = calcMonAnomTLLL (zo1,zo2)<br>
printVarSummary(zAnom)
;[time | 240] x [ens | 100] x [lat | 45] x [lon | 90]<br>
<br>
zAnom@long_name = "Anomalies from monthly Climatology"<br>
printVarSummary(zAnom)<br>
printMinMax(zAnom, 0)<br>
<br>
</span></font></p>
<p style="margin-bottom:0in;line-height:100%" lang="x-none"><font style="font-size:11pt" size="2" face="Helvetica, Arial,
sans-serif"><span lang="en-US"><br>
</span></font></p>
<p><font size="2" face="Helvetica, Arial, sans-serif">Or should i
be using rmMonAnnCycLLLT (removes the annual cycle from the
monthly data) instead?</font></p>
<p><font size="2">Would be grateful for some guidance on this!</font></p>
<p><font size="2">Sri<br>
</font></p>
</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>