[ncl-talk] Removing seasonal cycle from monthly data
Dennis Shea
shea at ucar.edu
Mon Nov 11 20:11:33 MST 2019
Did you even try any of these functions?
Here is one approach using all years.
================================
fn = "zo_hist_1850-2005_ens_1-100.nc" ; define filename
in = addfile(fn,"r") ; open netcdf file
; zo:[time|1872] x [ens|100] x [depth|1] x
[lat|45] x [lon|90]
x = in->zo(:,:,0,:,:)
printVarSummary(x) ; [time | 1872] x [ens | 100] x [lat | 45] x
[lon | 90]
printMinMax(x,0)
print("============")
xClm = clmMonTLLL(x) ; climatologies for each ensemble member
printVarSummary(xClm) ; *[month | 12] *x [ens | 100] x [lat | 45] x
[lon | 90]
printMinMax(xClm,0)
print("============")
xAnom = calcMonAnomTLLL(x,xClm) ; anomalies from each ensemble member
climatology
printVarSummary(xAnom) ; [*time | 1872] x [ens | 100] x [lat | 45] x
[lon | 90]*
printMinMax(xAnom,0)
print("============")
On Mon, Nov 11, 2019 at 3:48 AM Sri.durgesh Nandini-Weiss via ncl-talk <
ncl-talk at ucar.edu> wrote:
>
> Hello everyone,
>
> I am doing a simple calculation on monthly means data e.g. temp from
> 1850-2000.
>
> I would like to calculate the mean, standard deviation (e.g temp from
> 1986-2006). For this 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.
>
> Are the below steps the correct way to do this? My script is successful in
> retrieving the anomalies.
>
> however i want which function is correct? (rmvmean or calcMonAnomTLLL)
> rmvmean(x): remove mean (and returns deviation from mean)
>
> calcMonAnomTLLL(x): Anomalies from Annual Cycle: calcMonAnomTLL:
> contributed.ncl
>
> ;=================================================================
> ; Concepts illustrated:
> ; - Calculates long term monthly means (monthly climatology) from
> monthly data: (time,lev,lat,lon) version
> ; - Compute monthly anomalies using monthly climatology
> ; - Calculates climatological anomalies by subtracting the long term
> mean from each point.
> ; - Assumes monthly data. If the input data contains metadata (e.g.
> coordinate variables and attributes), these will be retained.
> ;==================================================================
> yrStrt = 1986
> yrLast = 2006
>
> f = addfile("zo_hist_1850-2005_ens_1-100.nc","r")
> TIME = f->time
> TIME = TIME-31
> YYYY = cd_calendar(TIME,-1)/100 ; entire file
> iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast) ;this is from 1 Jan
> 1986 to 1 Dec 2006
>
> zo = f->zo(iYYYY,:,:,:,:) ; [time
> | 240] x [ens:100] x [depth:1] x [lat | 192] x [lon | 288]
> zo at _FillValue = 9.96921e+36
> printVarSummary(zo)
> printMinMax(zo,0)
>
> zo1 = dim_avg_n_Wrap( zo, 2) ;[time
> | 240] x [ens:100] x [lat | 192] x [lon | 288]
> printVarSummary(zo1)
>
> ;==================================================================
> ; Compute monthly climatology
> ;==================================================================
>
> zo2 = clmMonTLLL( zo1 ) ;
> [month | 12] x [ens | 100] x [lat | 45] x [lon | 90]
> printVarSummary(zo2)
>
> ;==================================================================
> ; Compute monthly anomalies from the above climatology to remove seasonal
> cycle
> ;==================================================================
>
> zAnom = calcMonAnomTLLL (zo1,zo2)
> printVarSummary(zAnom) ;[time |
> 240] x [ens | 100] x [lat | 45] x [lon | 90]
>
> zAnom at long_name = "Anomalies from monthly Climatology"
> printVarSummary(zAnom)
> printMinMax(zAnom, 0)
>
>
> Or should i be using rmMonAnnCycLLLT (removes the annual cycle from the
> monthly data) instead?
>
> Would be grateful for some guidance on this!
>
> Sri
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20191111/b7cea4c5/attachment.html>
More information about the ncl-talk
mailing list