<div dir="ltr"><div><div><div><span>Dear Adam and Rick,<br><br></span></div>
<p class="MsoNormal">I tried to plot the spectrums one at a time and then all
three together with the following script, and this time I could have my
combined plot. Thank you very much for your kind support and encouragement.<span> <br></span></p><p class="MsoNormal"><span><br></span></p>
</div><span>Best regards,<br></span></div><span>Ruksana <br><br>;*********************************<br>;<br>;**********************************<br>load "/usr/share/ncarg/nclscripts/csm/gsn_code.ncl" <br>load "/usr/share/ncarg/nclscripts/csm/gsn_csm.ncl" <br>load "/usr/share/ncarg/nclscripts/csm/contributed.ncl" <br>load "/usr/share/ncarg/nclscripts/csm/shea_util.ncl" <br>load "/usr/share/ncarg/nclscripts/csm/popRemap.ncl" <br>load "/usr/share/ncarg/nclscripts/contrib/calendar_decode2.ncl"<br>;************************************************<br>begin<br>;***************************************************** <br>;read in data <br>;***************************************************** <br>f0 = addfile ("/.../1WAH_daily_precip_b387clim_Bangladesh_100_1988_2007_land_only.nc", "r");<br>f1 = addfile(".../APHRO_1988_2007_correct_daily_precip.nc", "r")<br>f2 = addfile("/.../GPCC_1988_2007_correct_daily_precip.nc","r")<br>;***************************************************** <br>; parameters<br>;***************************************************** <br><br>PPT_mod = f0->precip(:,0,:,:)<br>PPT_mod = PPT_mod*60*60*24<br>PPT_obs1 = f1->precip<br>PPT_obs2 = f2->precip<br><br>fldmean0 = wgt_areaave_Wrap(PPT_mod,1.0,1.0,1)<br>fldmean1 = wgt_areaave_Wrap(PPT_obs1,1.0,1.0,1)<br>fldmean2= wgt_areaave_Wrap(PPT_obs2,1.0,1.0,1)<br><br>printVarSummary(PPT_mod)<br>printVarSummary(PPT_obs1)<br>printVarSummary(PPT_obs2)<br> <br>;************************************************<br>; set function arguments<br>;************************************************<br> d = 0 ; detrending opt: 0=>remove mean 1=>remove mean + detrend<br> sm = 21 ; smooth: should be at least 3 and odd<br> pct = 0.10 ; percent taper: (0.0 <= pct <= 1.0) 0.10 common. <br>;************************************************<br>; calculate spectrum<br>;************************************************<br> sdof0 = specx_anal(fldmean0,d,sm,pct)<br> sdof1 = specx_anal(fldmean1,d,sm,pct)<br> sdof2 = specx_anal(fldmean2,d,sm,pct)<br>;************************************************<br>; calculate confidence interval [here 5 and 95%]<br>; return 4 curves to be plotted<br>;************************************************<br> splt0 = specx_ci (sdof0, 0.05, 0.95)<br> splt1 = specx_ci (sdof1, 0.05, 0.95)<br> splt2 = specx_ci (sdof2, 0.05, 0.95)<br>;************************************************<br>; plotting<br>;************************************************<br> wks = gsn_open_wks("eps","spec") ; Opens a eps file<br><br> r = True ; plot mods desired<br> r@tiMainString = "Daily Precipitation 1988-2007" ; title<br> r@tiXAxisString = "Frequency (cycles/day)" ; xaxis<br> r@tiYAxisString = "Variance" ; yaxis<br>;***********************************************<br>; Generate log plot showing "red noise" confidence bounds<br>; (a) log scaling and (b) the Band Width<br>;***********************************************<br> r@trYLog = True ; log scaling<br> r@trYMinF = 0.0010 ; manually set lower limit<br> r@trYMaxF = 360.0 ; " upper<br> r@gsnFrame = False ; do not advance frame<br> r@gsnDraw = False<br> r@gsnFrame = False<br> <br> r@xyLineColor = "black"<br> plot0 = gsn_csm_xy(wks,sdof0@frq, splt0,r)<br> r@xyLineColor = "blue"<br> plot1 = gsn_csm_xy(wks,sdof1@frq, splt1,r)<br> r@xyLineColor = "red"<br> plot2 = gsn_csm_xy(wks,sdof2@frq, splt2,r)<br> <br> xf0 = (/0.50, 0.50+sdof0@bw/) ; Create band width line<br> ys0 = 0.75*max(sdof0@spcx) ; 75% up Y axis<br> yv0 = (/ys0,ys0/) <br> rpl0 = True ; resources for polyline<br> rpl0@gsLineThicknessF = 2 ; Define line thickness <br> gsn_polyline(wks,plot0,xf0,yv0,rpl0) ; Draw BandWidth<br> <br> xf1 = (/0.50, 0.50+sdof1@bw/) ; Create band width line<br> ys1 = 0.75*max(sdof1@spcx) ; 75% up Y axis<br> yv1 = (/ys1,ys1/) <br> rpl1 = True ; resources for polyline<br> rpl1@gsLineThicknessF = 2 ; Define line thickness <br> gsn_polyline(wks,plot1,xf1,yv1,rpl1) ; Draw BandWidth<br> <br> xf2 = (/0.50, 0.50+sdof2@bw/) ; Create band width line<br> ys2 = 0.75*max(sdof2@spcx) ; 75% up Y axis<br> yv2 = (/ys2,ys2/) <br> rpl2 = True ; resources for polyline<br> rpl2@gsLineThicknessF = 2 ; Define line thickness <br> gsn_polyline(wks,plot2,xf2,yv2,rpl2) ; Draw BandWidth<br> <br> overlay(plot0,plot1)<br> overlay(plot0,plot2)<br> <br> draw(plot0)<br> <br> frame (wks)<br>end<br><br><br><br></span></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 8, 2016 at 12:44 PM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p class="MsoNormal"><span>Dear Adam and Rick,</span></p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span>Sorry for being late to respond. </span></p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span>Rick, </span>in the addfiles commands, I have only removed the actual path details and put ... the 3 "."s. </p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span>Here I am giving the variable summary:</span></p><div><div class="h5"><p class="MsoNormal"><br></p><p class="MsoNormal"><b>Variable: PPT_mod</b><span><br>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [52950.5..60149.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 10<br> z1 : 0<br> standard_name : precipitation_flux<br> long_name : TOTAL PRECIPITATION RATE KG/M2/S<br> units : kg m-2 s-1<br> _FillValue : 1e+20<br> missing_value : 1e+20<br> stash_item : 216<br> stash_section : 5<br> field_code : 90<br> cell_method : time: mean<br><br><b>Variable: PPT_obs1</b><br>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [19880101.5..20071230.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 5<br> long_name : daily precipitation analysis interpolated onto 0.5deg grids [mm/day]<br> units : mm/day<br> _FillValue : -99.9<br> missing_value : -99.9<br> level_description : Earth surface<br><br></span></p><p class="MsoNormal"><b>Variable: PPT_obs2<br></b><span>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [19880101.5..20071230.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 5<br> long_name : full data daily product version 1 precipitation per grid<br> units : mm/day<br> code : 20<br> _FillValue : -99999.99<br> missing_value : -99999.99</span></p><p class="MsoNormal"><span><br></span></p><span><p class="MsoNormal"><br></p></span></div></div><p class="MsoNormal"><span>The separate spectrums that I could get earlier and the script are attached. </span></p><p class="MsoNormal"><span>Thank you very much for your kind efforts in helping me.</span></p><p class="MsoNormal"><span></span>Best regards,</p><p class="MsoNormal">Ruksana</p><div><div class="h5"><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><p class="MsoNormal"><br></p><div class="gmail_extra"><div class="gmail_quote">On Thu, Dec 8, 2016 at 3:58 AM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Ruksana,<div>I strongly recommend that you use print and printVarSummary calls to help you debug what is going on with your script. (You should always attempt to debug your own script before emailing/replying to ncl-talk.) Fatal errors can sometimes result from a reference to a variable that is not present.<br></div><div><br></div><div>Please add the following line to your script right before the gsn_csm_xy call:</div><div>printVarSummary(spec0)</div><div>plot0 = gsn_csm_xy(wks,spec0@frq,spec0<wbr>@spcx,res)<br></div><div><br></div><div>and send ncl-talk the output of the printVarSummary statement along with any other error messages you are receiving. Also, please attach your current script to your reply. As always, please respond to ncl-talk and not to me personally.</div><span class="m_6295166773825274168m_8204233913987082245HOEnZb"><font color="#888888"><div>Adam</div><div><br></div><div><br></div></font></span></div><div class="m_6295166773825274168m_8204233913987082245HOEnZb"><div class="m_6295166773825274168m_8204233913987082245h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 9:08 AM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear Rick,<br><br></div>Added the 'end' at the end of the script
(sorry for this silly mistake) but nothing changes. Still getting just
the same error message. No other error message. Feeling confused now.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 3:49 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hmmm....line 121 is not the line cited...in fact its the last line of the script. There's an opening "begin" at the top of the script -- perhaps match it with a closing "end" at the end of the script?<br><br><br></div><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448HOEnZb"><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 8:29 AM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear Rick,</div><div><br></div><div>Thank you for your response. I have changed accordingly but getting the same error message: </div><div><br></div><div><b>f</b><b>atal:syntax error: line 121 in file spectrum.ncl before or near <br>plot0 = gsn_csm_xy(wks,spec0@frq,spec0<wbr>@spcx,res)</b></div><div><b><br></b></div><div>Any other ideas?</div><div><br></div><div>Best regards, </div><span class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565HOEnZb"><font color="#888888"><div>Ruksana</div></font></span></div><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565HOEnZb"><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 2:44 PM, Rick Brownrigg <span dir="ltr"><<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Ruksana,<br><br></div>I'm not entirely sure what the issue is, but by my reading of the docs on the function specx_anal(), it returns a variable with certain attributes attached, one of which is an array named "spcx". Thus, I think all your references such as:<br><br>spec0@spcx0<br>spec1@spcx1<br>spec2@spcx2<br> <br></div>should be:<br><br>spec0@spcx<br>spec1@spcx<br>spec2@spcx<br><br></div>There are a number of such references -- I would think there would have been other warnings/errors elsewhere in your script (?)<br><br></div>Hope that helps...<span class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204HOEnZb"><font color="#888888"><br></font></span></div><span class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204HOEnZb"><font color="#888888">Rick<br><br></font></span></div><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204HOEnZb"><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 5:36 AM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Dear Adam,</div><div><br></div><div>Thank you very much for suggesting about the way to have three spectrums in one plot. I have tried the following script but getting error. </div><div><br></div><div>;*****************************<wbr>****<br>;<br>;*****************************<wbr>*****<br>load "/usr/share/ncarg/nclscripts/c<wbr>sm/gsn_code.ncl" <br>load "/usr/share/ncarg/nclscripts/c<wbr>sm/gsn_csm.ncl" <br>load "/usr/share/ncarg/nclscripts/c<wbr>sm/contributed.ncl" <br>load "/usr/share/ncarg/nclscripts/c<wbr>sm/shea_util.ncl" <br>load "/usr/share/ncarg/nclscripts/c<wbr>sm/popRemap.ncl" <br>load "/usr/share/ncarg/nclscripts/c<wbr>ontrib/calendar_decode2.ncl"<br>;*****************************<wbr>*******************</div><div>begin<br>;*****************************<wbr>************************ <br>;read in data <br>;*****************************<wbr>************************ <br>f0 = addfile ("/../1WAH_daily_precip_b387cl<wbr>im_Bangladesh_100_1988_<a href="http://2007_land_only.nc" target="_blank">2007_la<wbr>nd_only.nc</a>", "r");<br>f1 = addfile("/.../APHRO_1988_2007_<a href="http://correct_daily_precip.nc" target="_blank"><wbr>correct_daily_precip.nc</a>", "r")<br>f2 = addfile("/.../GPCC_1988_2007_<a href="http://correct_daily_precip.nc" target="_blank">c<wbr>orrect_daily_precip.nc</a>","r")</div><div>;*****************************<wbr>************************ <br>; parameters<br>;*****************************<wbr>************************ </div><div>PPT_mod = f0->precip(:,0,:,:)<br>PPT_mod = PPT_mod*60*60*24<br>PPT_obs1 = f1->precip<br>PPT_obs2 = f2->precip</div><div>fldmean0 = wgt_areaave_Wrap(PPT_mod,1.0,1<wbr>.0,1)<br>fldmean1 = wgt_areaave_Wrap(PPT_obs1,1.0,<wbr>1.0,1)<br>fldmean2= wgt_areaave_Wrap(PPT_obs2,1.0,<wbr>1.0,1)</div><div>;printVarSummary(time)</div><div>printVarSummary(PPT_mod)<br>printVarSummary(PPT_obs1)<br>printVarSummary(PPT_obs2)</div><div>;*****************************<wbr>*******************<br>; set function arguments<br>;*****************************<wbr>*******************<br>; detrending opt: 0=>remove mean 1=>remove mean and detrend<br> d = 0<br>; smoothing periodogram: (0 <= sm <= ??.) should be at least 3 and odd<br> sm = 7<br>; percent tapered: (0.0 <= pct <= 1.0) 0.10 common. <br> pct = 0.10<br>;*****************************<wbr>*******************<br>; calculate spectrum<br>;*****************************<wbr>*******************<br> spec0 = specx_anal(fldmean0,d,sm,pct)<br> spec1 = specx_anal(fldmean1,d,sm,pct)<br> spec2 = specx_anal(fldmean2,d,sm,pct)<br>;*****************************<wbr>*******************<br>; calculate confidence interval [here 5 and 95%]<br>; return 4 curves to be plotted<br>;*****************************<wbr>*******************<br> splt0 = specx_ci (spec0, 0.05, 0.95)<br> splt1 = specx_ci (spec1, 0.05, 0.95)<br> splt2 = specx_ci (spec2, 0.05, 0.95)<br>;*****************************<wbr>*******************<br>;*****************************<wbr>*******************<br>; plotting<br>;*****************************<wbr>*******************<br> wks = gsn_open_wks("eps","spec_combi<wbr>ned") ; Opens a eps file </div><div> res = True ; no plot mods desired<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@tiMainString = "Precipitation" ; title<br> res@tiXAxisString = "Frequency (cycles/day)" ; xaxis<br> res@tiYAxisString = "Variance" ; yaxis<br> <br>;*****************************<wbr>******************<br>; Generate log plot showing "red noise" confidence bounds<br>; (a) log scaling and (b) the Band Width<br>;*****************************<wbr>******************<br> res@trYLog = True ; log scaling<br> res@trYMinF = 0.00010 ; manually set lower limit<br> res@trYMaxF = 350.0 ; " upper<br> res@gsnFrame = False ; do not advance frame<br> <br> xf0 = (/0.75, 0.75+spec0@bw/) ; Create band width line<br> ys0 = 0.75*max(spec0@spcx0) <wbr> ; 75% up Y axis<br> yv0 = (/ys0,ys0/) <br> respl = True <wbr> ; resources for polyline<br> respl@gsLineThicknessF = 2 ; Define line thickness <br> <br> txres= True <wbr> ; label BW line<br> txres@txFontHeightF = 0.015 ; font height<br> txres@txJust = "CenterLeft" ; Set lable location<br> gsn_text(wks,plot,"BW",0.41+sp<wbr>ec0@bw,ys0,txres); Label <br> <br> xf1 = (/0.75, 0.75+spec1@bw/) ; Create band width line<br> ys1 = 0.75*max(spec1@spcx1) <wbr> ; 75% up Y axis<br> yv1 = (/ys1,ys1/) <br> respl = True <wbr> ; resources for polyline<br> respl@gsLineThicknessF = 2 ; Define line thickness <br> <br> txres= True <wbr> ; label BW line<br> txres@txFontHeightF = 0.015 ; font height<br> txres@txJust = "CenterLeft" ; Set lable location<br> gsn_text(wks,plot,"BW",0.41+sp<wbr>ec1@bw,ys1,txres); Label<br> <br> xf2 = (/0.75, 0.75+spec2@bw/) ; Create band width line<br> ys2 = 0.75*max(spec2@spcx2) <wbr> ; 75% up Y axis<br> yv2 = (/ys2,ys2/) <br> respl = True <wbr> ; resources for polyline<br> respl@gsLineThicknessF = 2 ; Define line thickness <br> <br> txres= True <wbr> ; label BW line<br> txres@txFontHeightF = 0.015 ; font height<br> txres@txJust = "CenterLeft" ; Set lable location<br> gsn_text(wks,plot,"BW",0.41+sp<wbr>ec2@bw,ys2,txres); Label <br> <br>res@gsnDraw = False<br>res@gsnFrame = False</div><div>res@xyLineColor = "black"<br>plot0 = gsn_csm_xy(wks,spec0@frq,spec0<wbr>@spcx0,res) ; create plot <br>gsn_polyline(wks,plot,xf0,yv0,<wbr>respl) ; Draw BandWidth</div><div>res@xyLineColor = "blue"<br>plot1 = gsn_csm_xy(wks,spec1@frq,spe<wbr>c1@spcx1,res) ; create plot <br>gsn_polyline(wks,plot,xf1,yv1,<wbr>respl) ; Draw BandWidth</div><div>res@xyLineColor = "red"<br>plot2 = gsn_csm_xy(wks,spec2@frq,spe<wbr>c2@spcx2,res) ; create plot<br>gsn_polyline(wks,plot,xf2,yv2,<wbr>respl) ; Draw BandWidth</div><div>overlay(plot0,plot1)<br>overlay(plot0,plot2)</div><div>draw(plot)<br>frame(wks)</div><div><br></div><div><b>fatal:syntax error: line 121 in file spectrum.ncl before or near <br>plot0 = gsn_csm_xy(wks,spec0@frq,spec0<wbr>@spcx0,res)</b></div><div><b><br></b></div><div><b>Can you please help me to identify where my mistake is?</b></div><div><b><br></b></div><div><b>Best regards,</b></div><div><b>Ruksana</b></div><div><b><br></b></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 5, 2016 at 7:16 PM, Adam Phillips <span dir="ltr"><<a href="mailto:asphilli@ucar.edu" target="_blank">asphilli@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Ruksana,<div>If all you want is 3 different spectra overlaid on the same plot you could use the overlay procedure. You will need to tell NCL to not draw the plot nor advance the frame before creating the 3 spectra. You may also need to set trYMaxF if portions of one spectra go off the plot.</div><div><br></div><div>Here's an example:</div><div>res@gsnDraw = False</div><div>res@gsnFrame = False</div><div><span style="font-size:12.8px">res@xyLineColor = "green"</span></div><div><span style="font-size:12.8px">plot=gsn_csm_xy(wks,spec@frq,s</span><span style="font-size:12.8px"><wbr>pec@spcx,res) ; create plot </span><br></div><div>res@xyLineColor = "black"</div><div>plot2 = <span style="font-size:12.8px">gsn_csm_xy(wks,spec2@frq,s</span><span style="font-size:12.8px">pe<wbr>c2@spcx,res) ; create plot </span> </div><div><div>res@xyLineColor = "blue"</div><div>plot3 = <span style="font-size:12.8px">gsn_csm_xy(wks,spec3@frq,s</span><span style="font-size:12.8px">pe<wbr>c3@spcx,res) ; create plot</span></div><div><span style="font-size:12.8px">overlay(plot,plot2)</span></div><div><span style="font-size:12.8px">overlay(plot,plot3)</span></div><div><span style="font-size:12.8px">draw(plot)</span></div><div><span style="font-size:12.8px">frame(wks)</span></div><div><span style="font-size:12.8px"> </span></div></div><div><span style="font-size:12.8px">Hope that helps. If not, please respond to the ncl-talk email list.</span></div><div><span style="font-size:12.8px">Adam</span></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204m_-7731332973843453690m_7353303126125297360h5">On Mon, Dec 5, 2016 at 12:09 PM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204m_-7731332973843453690m_7353303126125297360h5"><div dir="ltr"><div><div><div><div>Hi,<br><br></div>I could figure the required process out. This time followed the example 4 at <a href="http://www.ncl.ucar.edu/Applications/Scripts/spec_4.ncl" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/Scripts/spec_4.ncl</a>. However, I would still like to know how can I plot three spectrums of three colours in one single plot. Your help is always useful.<br><br></div>Thank you for putting up wonderful resources.<br><br></div>Best regards,<br></div>Ruksana <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 5, 2016 at 5:30 PM, Ruksana Abedin <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I have followed the
<a href="http://www.ncl.ucar.edu/Applications/Scripts/spec_1.ncl" target="_blank">http://www.ncl.ucar.edu/Applic<wbr>ations/Scripts/spec_1.ncl</a> script to plot a
spectrum for my data but the specs are very difficult to visualize clearly in
the plot. Data is daily precipitation from model and two observations for 1988-2007. <br></p><p class="MsoNormal"><br></p><p class="MsoNormal">1. How to change the x and y axis scales to make it
more visible. <br></p><p class="MsoNormal">2. Can I have the cycles per day instead of months? How to
change this aspect? <br></p><p class="MsoNormal">3. Can I plot three spectrums for three different files in a panel together?<br></p>
<p class="MsoNormal"><br></p><p class="MsoNormal">The variable summary, script and the resultant plot are attached.
Your time and efforts to help me out is highly appreciated.<span> <br></span></p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span>Variable: PPT_mod<br>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [52950.5..60149.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 10<br> z1 : 0<br> standard_name : precipitation_flux<br> long_name : TOTAL PRECIPITATION RATE KG/M2/S<br> units : kg m-2 s-1<br> _FillValue : 1e+20<br> missing_value : 1e+20<br> stash_item : 216<br> stash_section : 5<br> field_code : 90<br> cell_method : time: mean<br><br>Variable: PPT_obs1<br>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [19880101.5..20071230.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 5<br> long_name : daily precipitation analysis interpolated onto 0.5deg grids [mm/day]<br> units : mm/day<br> _FillValue : -99.9<br> missing_value : -99.9<br> level_description : Earth surface<br><br></span></p><p class="MsoNormal"><span>Variable: PPT_obs2<br>Type: float<br>Total Size: 25056000 bytes<br> 6264000 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 7200] x [lat | 30] x [lon | 29]<br>Coordinates:<br> time: [19880101.5..20071230.5]<br> lat: [15.25..29.75]<br> lon: [ 83.. 97]<br>Number Of Attributes: 5<br> long_name : full data daily product version 1 precipitation per grid<br> units : mm/day<br> code : 20<br> _FillValue : -99999.99<br> missing_value : -99999.99</span></p><p class="MsoNormal"><span><br></span></p><p class="MsoNormal"><span><br>;*****************************<wbr>*******************<br>begin<br>;*****************************<wbr>************************ <br>;read in data <br>;*****************************<wbr>************************ <br>f0 = addfile ("/../1WAH_daily_precip_b387cl<wbr>im_Bangladesh_100_1988_<a href="http://2007_land_only.nc" target="_blank">2007_la<wbr>nd_only.nc</a>", "r");<br>f1 = addfile("/../APHRO_1988_2007_<a href="http://correct_daily_precip.nc" target="_blank">c<wbr>orrect_daily_precip.nc</a>", "r")<br>f2 = addfile("/../GPCC_1988_2007_<a href="http://correct_daily_precip.nc" target="_blank">co<wbr>rrect_daily_precip.nc</a>","r")<br><br>;*****************************<wbr>************************ <br>; parameters<br>;*****************************<wbr>************************ <br><br>PPT_mod = f0->precip(:,0,:,:)<br>PPT_mod = PPT_mod*60*60*24<br>PPT_obs1 = f1->precip<br>PPT_obs2 = f2->precip<br><br>fldmean0 = wgt_areaave_Wrap(PPT_mod,1.0,1<wbr>.0,1)<br>fldmean1 = wgt_areaave_Wrap(PPT_obs1,1.0,<wbr>1.0,1)<br>fldmean2= wgt_areaave_Wrap(PPT_obs2,1.0,<wbr>1.0,1)<br><br>;printVarSummary(time)<br><br>printVarSummary(PPT_mod)<br>printVarSummary(PPT_obs1)<br>printVarSummary(PPT_obs2)<br><br>;*****************************<wbr>*******************<br>; set function arguments<br>;*****************************<wbr>*******************<br>; detrending opt: 0=>remove mean 1=>remove mean and detrend<br> d = 0<br>; smoothing periodogram: (0 <= sm <= ??.) should be at least 3 and odd<br> sm = 7<br>; percent tapered: (0.0 <= pct <= 1.0) 0.10 common. <br> pct = 0.10<br>;*****************************<wbr>*******************<br>; calculate spectrum<br>;*****************************<wbr>*******************<br> spec = specx_anal(fldmean2,d,sm,pct)<br>;*****************************<wbr>*******************<br>; plotting<br>;*****************************<wbr>*******************<br> wks = gsn_open_wks("eps","spec") <wbr> ; Opens a eps file <br><br> res = True ; no plot mods desired<br> res@tiMainString = "Precipitation" ; title<br> res@tiXAxisString = "Frequency (cycles/month)" ; xaxis<br> res@tiYAxisString = "Variance" ; yaxis<br><br> plot=gsn_csm_xy(wks,spec@frq,s<wbr>pec@spcx,res) ; create plot <br>;*****************************<wbr>******************<br>end<br></span></p><p class="MsoNormal"><span><br></span></p>
</div>
</blockquote></div><br></div>
<br></div></div>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><span class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204m_-7731332973843453690m_7353303126125297360HOEnZb"><font color="#888888"><br><br clear="all"><span class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204m_-7731332973843453690HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132m_-3123324776945258448m_-578097300369294565m_6723162700418950204m_-7731332973843453690m_7353303126125297360m_-5807178837076104621gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a> </font></span><span><font color="#888888"><a href="tel:303-497-1726" value="+13034971726" target="_blank">303-497-1726</a> </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</font></span></font></span></div>
</blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="m_6295166773825274168m_8204233913987082245m_1949138517483674132gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphill<wbr>i/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>