# [ncl-talk] seasonality remove and trend

Dennis Shea shea at ucar.edu
Mon May 30 07:39:20 MDT 2022

```One approach:

[1] compute the climatological monthly means and then calculate the monthly
anomalies: x(time,lat,lon)

xMonClm = *clmMonTLL*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/clmMonTLL.shtml>
(x)                  ; monthly climatology   (12,lat,lon)
xMonAnom = *calcMonAnomTLL*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/calcMonAnomTLL.shtml>
(x,xMonClm)    ; (time,lat,lon);  (0,1,2)

[2]* xDtrend = dtrend_n
<https://www.ncl.ucar.edu/Document/Functions/Built-in/dtrend_n.shtml>*(xMonAnom,True,0)
; trend returned as attribute
printVarSummary(xDtrend)

======
NCL is not a statistics package. It does have some simple regression
functions.

*regline*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/regline.shtml>,
*regline_stats*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/regline_stats.shtml>,
*regCoef*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef.shtml>,
*regCoef_n*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/regCoef_n.shtml>,
*reg_multlin_stats*
<https://www.ncl.ucar.edu/Document/Functions/Contributed/reg_multlin_stats.shtml>

*bootstrap_regcoef*
<https://www.ncl.ucar.edu/Document/Functions/Bootstrap/bootstrap_regcoef.shtml>

<https://www.ncl.ucar.edu/Document/Functions/Built-in/equiv_sample_size.shtml>
<https://www.ncl.ucar.edu/Document/Functions/Built-in/rtest.shtml>

On Sun, May 29, 2022 at 2:30 PM Debasish Hazra via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi,
> I am analyzing 25 years monthly data (300 months) of a variable and would
> like to measure the trend of the variable from beginning to the end of the
> time. Questions are :
> 1. How do I remove the seasonal variability by using a 12-month running
> average prior to computing the linear trend. What function in NCL to be
> used.
> 2. Is there any weighted least square linear regression available in NCL
> to be used for regression and trend analysis ?
>
> Thanks,
> Deba
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220530/5a470e79/attachment.htm>
```