<div dir="ltr"><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>I have the following portion in my script for computing the spectrum of a time series:</div><div>---------------------------------------------------------------------</div><div>ntim  =dimsizes(rain)    <b><font color="#ff0000">; 4879</font></b><br>nseg = 40<br>nlen  = ntim/nseg<br>x = onedtond(rain,(/nseg,nlen/))<br>printVarSummary(x) 

  <b><font color="#ff0000">; 40 x 121</font></b><br><br><i>spcavg = new (ntim/80, typeof(x))<br></i></div><div><i><br></i></div><div>spcavg = 0.0<br>dm = 1<br>sm = 1<br>pct = 0.10<br>r1zsum = 0.0<br>do n=0,nseg-1<br>  dof    = specx_anal(x(n,:),dm,sm,pct)<br>  spcavg = spcavg + dof@spcx<br>  r1     = dof@xlag1<br>  r1zsum = r1zsum  + 0.5*(log((1+r1)/(1-r1)))<br>end do<br></div><div>---------------------------------------------------------------------</div><div><br></div><div><br></div><div>I would like to ask why this line:</div><div>spcavg = new (ntim/80, typeof(x))<br><br></div><div>only works when I set <b style="color:rgb(255,0,0)">ntim/80. </b><font color="#000000">Is this a requirement in NCL that this should be ntim/nseg*2 ? If I set this to </font></div><div>spcavg = new (ntim, typeof(x))<font color="#000000"><br></font></div><div><br></div><div>It gives me an error at this line <i>spcavg = spcavg + dof@spcx</i>: :</div><div>fatal:Plus: Dimension size, for dimension number 0, of operands does not match, can't continue<br></div><div><br></div><div>I'll appreciate any help on this.</div><div><br></div><div>-Lyndz</div><div><br></div><div><br></div><div><br></div></div></div></div></div></div></div></div></div></div></div>