<div dir="ltr">Hi ncl-users,<div><br></div><div> I am very new to the NCL software and I would like to do spectrum analysis with confidence levels. I have tried with the existing code and plotted, but, I just need some help like how to plot x-axis in the form of <b>Days </b>(i.e. 1/frequency) instead of the <b>frequency (days/cycle) </b>otherwise top axis should be in Days and bottom axis should be in frequency (if it is possible). </div><div> I have, just need one more help like how to draw a vertical line in the plot (x=0.05,y=1000) from the below attached figure.<br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><br></div><div><br></div><div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" </div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div><div><br></div><div>begin<br></div><div>buoy = asciiread("ad08_sw_mons_2014_wspd_davg.txt",(/122,1/),"float")<br></div><div><br></div><div>d = 0 ; detrending opt: 0=>remove mean 1=>remove mean + detrend</div><div>sm = 0 ; smooth: should be at least 3 and odd</div><div>pct = 0.1 ; percent taper: (0.0 <= pct <= 1.0) 0.10 common.</div><div><br></div><div>;************************************************</div><div>; calculate spectrum</div><div>;************************************************</div><div>sdof = specx_anal(buoy(:,0),d,sm,pct)</div><div>;print (sdof)</div><div>;exit</div><div>;************************************************<br></div><div>; calculate confidence interval [here 5 and 95%]</div><div>; return 4 curves to be plotted</div><div>;************************************************</div><div>splt = specx_ci (sdof, 0.05, 0.99)</div><div><br></div><div>;************************************************</div><div>; plotting</div><div>;************************************************</div><div>wks = gsn_open_wks("x11","spec") ; Opens a ps file</div><div><br></div><div>r = True ; plot mods desired</div><div>r@tiMainString = "AD08 wind speed" ; title</div><div>r@tiXAxisString = "Frequency (cycles/Days)" ; xaxis</div><div>r@tiYAxisString = "Variance" ; yaxis</div><div>r@trYLog = True ; log scaling</div><div>;r@trXMinF = 0</div><div>;r@trXMaxF = 0.2</div><div>;r@trYMinF = 1 ; manually set lower limit</div><div>;r@trYMaxF = 1000.0 ; " upper</div><div>r@gsnFrame = False ; do not advance frame</div><div>r@xyLineThicknesses = (/2.,1.,1.,1./)</div><div>r@xyDashPatterns = (/0,0,1,1/)</div><div>r@xyLineColors = (/"foreground","green","blue","red"/)</div><div>plot = gsn_csm_xy(wks,sdof@frq, splt,r)</div><div>lnid = gsn_add_polyline(wks,plot,(/0.05,0.1,0.1,0.1/),(/0.0001,0,0,1000/),r)</div><div><br></div><div>xf = (/0.40, 0.40+sdof@bw/) ; Create band width line</div><div>ys = 0.60*max(sdof@spcx) ; 75% up Y axis</div><div>yv = (/ys,ys/) </div><div>rpl = True ; resources for polyline</div><div>rpl@gsLineThicknessF = 2 ; Define line thickness </div><div>;gsn_polyline(wks,plot,xf,yv,rpl) ; Draw BandWidth</div><div><br></div><div>txres= True ; label BW line</div><div>txres@txFontHeightF = 0.015 ; font height</div><div>txres@txJust = "CenterLeft" ; Set lable location</div><div>;gsn_text(wks,plot,"BW",0.41+sdof@bw,ys,txres) ; Label </div><div>frame (wks)</div><div>end</div></div><div><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div>With Kind Regards<div>Nanda Kishore reddy. B<br></div><div>Senior Research Fellow<br></div><div>Ocean Observation Systems</div><div>NIOT, INDIA</div></div></div></div>
</div></div>