<html><body><div>Hi there,<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>I ran into some problems lately when using wavelet analysis in NCL. Here they are. <br></div><div><br data-mce-bogus="1"></div><div>I was using wavelet to analyze an EOF PC1, which is in monthly resolution. Two problems stuck out.<br data-mce-bogus="1"></div><div>One is when I dtrend it, the result time series became constant, -8.520693e+34. The following wavelet gave me a time series with power being all "inf". I couldn't plot the power spectrum. This was obvious the input problem, so I changed the input into the PC1 without detrending, which gave me the same problem, the power of the wavelet time series still showed "inf".<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>I suspect there is something wrong with this input time series, but I don't know enough to identify what the problem is, and how to deal with it.<br data-mce-bogus="1"></div><div>PC1 data is attached. Can somebody point me to the right direction on this?<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Also, the following is the code I used, which is basically using NCL example code. Since data is monthly, I tried 1. and 1./12 for dt, both gave me the same "inf" power.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>wts = eof_ts(0,:) <br> ; wts = dtrend(wts,False)<br> mother = 0<br> param = 6.0<br> dt = 1. <br> s0 = dt <br> dj = 0.25<br> jtot = 1 + floattointeger(((log10(N*dt/s0))/dj)/log10(2.))<br> npad = N<br> nadof = new(2,float)<br> noise = 1<br> siglvl = .05<br> isigtest= 1<br> </div><div><br data-mce-bogus="1"></div><div> w = wavelet(wts,mother,dt,param,s0,dj,jtot,npad,noise,isigtest,siglvl,nadof)<br> ;************************************<br> ; create coodinate arrays for plot<br> ;************************************<br> power = onedtond(w@power,(/jtot,N/))<br> power!0 = "period" ; Y axis<br> power&period = w@period<br> <br> power!1 = "time" ; X axis<br> power&time = time<br> <br> power@long_name = "Power Spectrum"<br> power@units = "unit^2"<br> <br> ; compute significance ( >= 1 is significant)<br> SIG = power ; transfer meta data<br> SIG = power/conform (power,w@signif,0)<br> SIG@long_name = "Significance"<br> SIG@units = " "<br> <br> ;************************************<br> ; initial resource settings<br> ;************************************<br> wks = gsn_open_wks("x11","wavelet") ; send graphics to PNG file<br> plot = new(2,graphic) ; create graphical array<br> <br> res = True ; plot mods desired <br> res@gsnFrame = False ; don't advance frame yet<br> res@gsnDraw = False ; don't draw yet<br> <br> res@cnFillOn = True ; turn on color<br> res@cnFillPalette = "BlAqGrYeOrReVi200" ; set color map<br> res@cnFillMode = "RasterFill" ; turn on raster mode<br> res@cnRasterSmoothingOn = True ; turn on raster smoothing<br> res@cnLinesOn = False ; turn off contour lines<br> res@lbOrientation = "Vertical" ; vertical label bar<br> <br> res@trYReverse = True ; reverse y-axis<br> res@tmLabelAutoStride = True<br> <br> res@vpHeightF = .4 ; height and width of plot<br> res@vpWidthF = .85<br> <br> <br> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels<br> res@cnMinLevelValF = 0.0 ; set min contour level<br> res@cnMaxLevelValF = 20.0 ; set max contour level<br> res@cnLevelSpacingF = 2.0 ; set contour spacing<br> <br> ; power<br> res@gsnLeftString = "Wavelet Power"<br> plot(0) = gsn_csm_contour(wks,power({0:35},0:N-1),res) <br> <br> ; significance<br> res@cnMinLevelValF = 1.0 ; set min contour level<br> res@cnMaxLevelValF = 4.0 ; set max contour level<br> res@cnLevelSpacingF = 3.0 ; set contour spacing<br> res@gsnLeftString = "Wavelet Significance"<br> plot(1) = gsn_csm_contour(wks,SIG({0:35},0:N-1),res) </div><div><br data-mce-bogus="1"></div><div>Any help is very much appreciated!<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>Best,<br data-mce-bogus="1"></div><div>Yan<br data-mce-bogus="1"></div></body></html>