(FYI: Xuguang sent me his error messages:
warning:ManualComputeMajorTickMarks: Maximum tickmarks (256) has been
reached, tickmarks may appear in complete
warning:ManualComputeMajorTickMarks: Maximum tickmarks (256) has been
reached, tickmarks may appear in complete
warning:tmXBStyle is not a valid resource in KCM.nino3-spectrum-month_xy
at this time
and his plot)
Hi Xuguang,
As far as the x-axis not being set to log, take a look at this FAQ:
http://www.ncl.ucar.edu/FAQ/#vis_021
You will want to set the resource trXLog = True
You are also telling NCL to draw a tickmark and it's corresponding label
for every period (9:300), resulting in 292 labels. You are going to want
to alter res_at_tmXBValues and res_at_tmXBLabels to only draw a subset of the
292 period values.
You are probably going to want to set trXReverse to True:
http://www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trXReverse
So that the period increases from right to left.
Finally, you likely will want to set trXMinF and trXMaxF to constrain
the minimum and maximum x-axis values.
http://www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trXMaxF
http://www.ncl.ucar.edu/Document/Graphics/Resources/tr.shtml#trXMinF
Good luck,
Adam
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
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Thu Sep 03 2009 - 10:35:07 MDT
This archive was generated by hypermail 2.2.0 : Thu Sep 03 2009 - 21:03:38 MDT