[ncl-talk] Spectral Analysis (Period in X-axis)

S. B. Ratna sbratna2012 at gmail.com
Fri Jun 16 19:51:14 MDT 2017


Hi Adam,
Thanks for your reply. I am a new user of NCL and difficult to
understand many things now.
I am trying to modify the following code as per your instructions.
https://www.ncl.ucar.edu/Applications/Scripts/spec_4.ncl

I want to keep the Y axis as it is but want to change the X axis to
Period with scale 4 8 16 32 64 128 256 512.
Could you please suggest how to change this part of the code.

;************************************************
; plotting
;************************************************
   wks  = gsn_open_wks("ps","spec")              ; Opens a ps file

   r = True                                      ; plot mods desired
   r at tiMainString = "SOI"                        ; title
   r at tiXAxisString = "Frequency (cycles/month)"  ; xaxis
   r at tiYAxisString = "Variance"                  ; yaxis
;***********************************************
; Generate log plot showing "red noise" confidence bounds
; (a) log scaling and (b) the Band Width
;***********************************************
   r at trYLog              = True                 ; log scaling
   r at trYMinF             = 0.10                 ; manually set lower limit
   r at trYMaxF             = 30.0                 ;   "          upper
   r at gsnFrame            = False                ; do not advance frame
   plot  = gsn_csm_xy(wks,sdof at frq, splt,r)

   xf   = (/0.40, 0.40+sdof at bw/)                ; Create band width line
   ys   = 0.75*max(sdof at spcx)                   ; 75% up Y axis
   yv   = (/ys,ys/)
   rpl  = True                                  ; resources for polyline
   rpl at gsLineThicknessF  = 2                    ; Define line thickness
   gsn_polyline(wks,plot,xf,yv,rpl)             ; Draw BandWidth

   txres= True                                  ; label BW line
   txres at txFontHeightF = 0.015                  ; font height
   txres at txJust        = "CenterLeft"           ; Set lable location
   gsn_text(wks,plot,"BW",0.41+sdof at bw,ys,txres); Label
   frame (wks)
end

Thanks.
SBR

On Fri, Jun 16, 2017 at 10:57 PM, Adam Phillips <asphilli at ucar.edu> wrote:
> Hi SBR,
> To switch to period being on the bottom y-axis you can do something like
> this:
> pres at tmXBMode   = "Explicit"
> pres at tmXBValues = (/".02",".10",".20",".3333",".50"/)
> pres at tmXBLabels = (/"50","10","5","3","2"/)
> pres at tiXAxisString = "Period (years)"
>
> To alter the Y-axis type, you can set trYAxisType and trYCoordPoints as is
> done in XY example #30 here:
> http://www.ncl.ucar.edu/Applications/xy.shtml#ex30
>
> Hope that helps. If you have any further questions please respond to the
> ncl-talk email list.
> Adam
>
>
>
>
>
> On Fri, Jun 16, 2017 at 12:52 PM, S. B. Ratna <sbratna2012 at gmail.com> wrote:
>>
>> Hi All,
>> I would like to plot the spectral analysis for my annual mean data for
>> about 800 years. I would like to use 'spec_4.ncl' but I need "period
>> (year)" in the X-axis instead of "Frequency".
>> Also, the X-axis scale should be 4 8 16 32 64 128 256 512.
>> Could you please suggest how to draw such figure.
>> https://www.ncl.ucar.edu/Applications/Scripts/spec_4.ncl
>>
>> Thanks.
>> SBR
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> --
> Adam Phillips
> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>


More information about the ncl-talk mailing list