[ncl-talk] wavelet period
Adam Phillips
asphilli at ucar.edu
Wed Sep 4 15:15:34 MDT 2019
Hi Shaimah,
There is a couple ways to do this. You can change the period coordinate
variable to be in units of months,
changing this:
power&period = w at period
to this:
power&period = w at period*12
(and then set tmYLValues/tmYLLabels how you'd like)
or, leave the period alone and simply alter the tmYLLabels:
res at tmYLMode = "Explicit"
res at tmYLValues = (/1,2,4,8,16,32,64,128/)
res at tmYLLabels = res at tmYLValues*12
Either should work.
Adam
On Wed, Sep 4, 2019 at 12:41 AM Shaimah ali via ncl-talk <ncl-talk at ucar.edu>
wrote:
> Hi,
> I am plotting a wavelet based on this example
> https://www.ncl.ucar.edu/Applications/Scripts/wavelet_2.ncl.
>
> I need to convert the Y-axis periods in to units of months(like
> 12,20,40..months),instead of units of years.. So what are the changes i
> have to be done in my code.
> I have monthly mean data of AOD for 19.7 years.(235 values).
> here is my code:
>
> aod = asciiread("aod.dat",-1,"float")
> aod!0 = "time"
> ntime = dimsizes(aod)
> timeo = fspan(2000.19,2019.,ntime)
> aod&time = timeo
>
> time = timeo
> N = dimsizes(time)
>
> ;WAVELET
>
> mother = 0
> param = 6.0
> dt = 0.25 ;timesteps in units of years
> s0 = dt
> dj = 0.25
> jtot = 1+floattointeger(((log10(N*dt/s0))/dj)/log10(2.))
> npad = N
> nadof = 0
> noise = 1
> siglvl = .05
> isigtest= 0
>
> w =
> wavelet(aod,mother,dt,param,s0,dj,jtot,npad,noise,isigtest,siglvl,nadof)
>
> ; create coodinate arrays for plot
>
> power = onedtond(w at power,(/jtot,N/))
> power!0 = "period" ; Y axis
> power&period = w at period ; convert period to
> units of years
>
> power!1 = "time" ; X axis
> power&time = time
>
> power at long_name = "Power Spectrum"
> power at units = "1/unit-freq"
>
>
> ; compute significance ( >= 1 is significant)
> SIG = power ; transfer meta data
> SIG = power/conform (power,w at signif,0)
> SIG at long_name = "Significance"
> SIG at units = " "
>
> ; initial resource settings
>
> wks = gsn_open_wks("png","01") ; send graphics to PNG file
>
> res = True ; plot mods desired
> res at gsnDraw = True ;False ; Do not draw plot
> res at gsnFrame = True ;False ; Do not advance
> frome
> res at gsnMaximize = True
> res at cnFillOn = True ; turn on color
> res at cnFillPalette = "BlAqGrYeOrReVi200" ; set color map
> res at cnFillMode = "RasterFill" ; turn on raster mode
> res at cnRasterSmoothingOn = True ; turn on raster
> smoothing
> res at cnLinesOn = False ;True ; turn off
> contour lines
> res at cnLineLabelsOn = False
> res at cnInfoLabelOn = False
> res at trYReverse = False ;True ; reverse
> y-axis
> res at tmLabelAutoStride = False ;True
> res at tmYROn = False
> res at tmXTOn = False
>
> res at tmYLMode = "Explicit"
>
> res at tmYLValues = (/1,2,4,8,16,32,64,128/)
> res at tmYLLabels = (/"1","2","4","8","16","32","64","128"/)
>
> res at tmXBMode = "Explicit"
> res at tmXBValues = (/20,40,60,80,100,120,140,160,180,200,220,240/)
> res at tmXBLabels =
> (/"20","40","60","80","100","120","140","160","180","200","220","240"/)
>
>
> res at cnLevelSelectionMode = "ExplicitLevels" ; set manual contour
> levels
> res at cnLevels =
> (/0.01,0.02,0.04,0.08,0.1,0.12,0.14,0.16,0.20,0.24,0.28,0.32/)
>
> res at tiMainString = ""
> res at gsnRightString = ""
> res at gsnCenterString = "AOD"
> res at gsnLeftString = ""
> res at tiYAxisString = "Periodicities (years)"
> res at tiXAxisString = "Months(2000-2019)"
>
> plot = new(2,graphic)
> plot(0) = gsn_csm_contour(wks,power,res)
>
>
> THANK YOU
> Shaima.N
> _______________________________________________
> 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
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190904/8198313c/attachment.html>
More information about the ncl-talk
mailing list