# Re: how to draw the spectrum result?

Date: Thu, 03 Sep 2009 09:52:08 -0600

Hi Xuguang,
Can you elaborate for us what doesn't work, as well as send us a copy of

Xuguang Sun wrote:
> Dear everyone,
>
> I finished calculating the spectrum of a time series, and wanted to draw the spectrum by NCL. Because the size of sample is very large, for example, 1000-yr nino3 index from a coupled model, and at the same time, the spectra usually concentrated to a narrow area, like 2yr to 50yr, therefore, it's better to use a log coordinate in the x-axis, and in order to illustrate the result well, I want the unit of x-Axis changing from frequency to period. The following code is part of the whole script to do the above mentioned work, however, it doesn't work, I'd like your suggestions. Thanks in advance.
>
> ts = nino3
> iopt = 0 ; remove series mean
> jave = 9 ; Average 3 periodogram estimates using modified Daniel
> pct = 0.1 ; taper 10% of the data
>
> sdof = specx_anal(ts,iopt,jave,pct)
> splt = specx_ci(sdof,0.05,0.95)
>
> print(sdof)
> ; print(sdof_at_frq)
>
> wks = gsn_open_wks("ps","nino3-spectrum-month")
> res = True
>
> res_at_vpXF = 0.2
> res_at_vpYF = 0.8
> res_at_vpWidthF = 0.6
> res_at_vpHeightF = 0.4
>
> res_at_tiYAxisString = "Power" ; yaxis
> ; res_at_tiXAxisString = "Frequency(cycles/month)" ; xaxis
> ; res_at_tiXAxisString = "Frequency(cycles/year)" ; xaxis
> res_at_tiXAxisString = "Period(year)" ; xaxis
> res_at_tiMainString = "Spectrum of monthly nino3 index"
> res_at_xyLineThicknesses = (/2.,1.5,1.,1./) ; Define line thicknesses
> res_at_xyDashPatterns = (/0,0,1,1/)
> res_at_xyLineColors = (/"foreground","red","blue","green"/)
>
> res_at_tmXBMode = "Explicit"
> res_at_tmXBStyle = "Log"
> res_at_tmXBValues = sdof_at_frq(9:300)
> xvalue = 1./(sdof_at_frq(9:300)*12)
> res_at_tmXBLabels = flt2string(xvalue)
> res_at_tmXBLabelStride = 50
>
> print(res_at_tmXBLabels)
>
> res_at_tmXBTickSpacingF = 1
> plot = gsn_csm_xy(wks,sdof_at_frq(9:300),splt(:,9:300),res)
>
>
> Xuguang
>
>
>
> ___________________________________________________________
> 好玩贺卡等你发，邮箱贺卡全新上线！
> http://card.mail.cn.yahoo.com/
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

```--
--------------------------------------------------------------