# [ncl-talk] Question about specx_anal and mean spectrum

Dennis Shea shea at ucar.edu
Sun Aug 8 13:34:19 MDT 2021

```Generally, a one-dimensional series [,say,  x(time) ] can be converted to
(say) two-dimensions via *onedtond*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/onedtond.shtml>.

ntim  =*dimsizes*(x)
nseg = 40
nlen  = ntim/nseg
x2d =* onedtond*(x,(/nseg,nlen/))

----------

ndays = 30+31+31+30         ;  #of days in the JJAS season
nyrStrt= 1979
nyrLast= 2018
nyrs     = nyrLast-nyrStrt+1
xseg    = new( (/nyrs,ndays/),  typeof(x), x at _FillValue)
do nyr=0,nyrs-1
itStrt  =                        ; index for June 1 for each year
itlast =  itStrt+ndays-1 ; data for current year
xseg(nyr,:) = x(itStrt:itlast))
end do

On Sun, Aug 8, 2021 at 4:02 AM Lyndz via ncl-talk <ncl-talk at mailman.ucar.edu>
wrote:

> Dear NCL experts,
>
> I would like to do Example 5 from this link:
> https://www.ncl.ucar.edu/Document/Functions/Built-in/specx_anal.shtml
>
> I would like to get the mean spectrum of a one dimensional time series.
> The above example requires that the input has the following format
>
> *x(nseg,ntim)*
>
> How do I convert my one dimensional data to this format? I would like to
> plot the JJAS mean spectrum and red noise.
>
> I am attaching my sample data here.
> This is JJAS daily rainfall anomaly from 1979-2018.
>
> I'll appreciate any help on this matter.
>
> Sincerely,
> Lyndz
> _______________________________________________
> 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/20210808/1d467c1e/attachment.html>
```