[ncl-talk] Question on Segmented spectrum (mean spectrum)

Lyndz olagueralyndonmark429 at gmail.com
Thu Sep 16 22:46:49 MDT 2021

```Dear NCL experts,

I have a script that computes for the mean spectrum similar to example 5
here:
https://www.ncl.ucar.edu/Document/Functions/Built-in/specx_anal.shtml

I am applying this to 40 summers. Here's the part that I am confused

spcavg = new (ntim/2, typeof(x))
spcavg = 0.0
dm = 1
sm = 12
pct = 0.10
r1zsum = 0.0
do n=0,nseg-1
dof    = specx_anal(x(n,:),dm,sm,pct)
spcavg = spcavg + dof at spcx
r1     = dof at xlag1
r1zsum = r1zsum  + 0.5*(log((1+r1)/(1-r1)))
end do

This part only works if I set:
*spcavg = new (ntim/80, typeof(x)) *

Am I correct to assume that spcavg is always ntim/df?
df is 2*nseg = 80.

Sincerely,
Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210917/72f717f0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spectral_mean_plot.ncl
Type: application/octet-stream
Size: 2514 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210917/72f717f0/attachment.obj>
```