[ncl-talk] Question on Example#5 of specx_anal

Lyndz olagueralyndonmark429 at gmail.com
Sun Mar 6 18:22:23 MST 2022


I have the following portion in my script for computing the spectrum of a
time series:
---------------------------------------------------------------------
ntim  =dimsizes(rain)    *; 4879*
nseg = 40
nlen  = ntim/nseg
x = onedtond(rain,(/nseg,nlen/))
printVarSummary(x)    *; 40 x 121*


*spcavg = new (ntim/80, typeof(x))*

spcavg = 0.0
dm = 1
sm = 1
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
---------------------------------------------------------------------


I would like to ask why this line:
spcavg = new (ntim/80, typeof(x))

only works when I set *ntim/80. *Is this a requirement in NCL that this
should be ntim/nseg*2 ? If I set this to
spcavg = new (ntim, typeof(x))

It gives me an error at this line *spcavg = spcavg + dof at spcx*: :
fatal:Plus: Dimension size, for dimension number 0, of operands does not
match, can't continue

I'll appreciate any help on this.

-Lyndz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220307/27fc4a1d/attachment.html>


More information about the ncl-talk mailing list