<div dir="ltr"><div><div><div><div><div>Dear NCL,<br><br></div>in connection to my earlier query, I need to add information that the first two curves have monthly mean precipitation values, which are meant to be the max and min range simulated by the model. So, filling in with color in between curve 1 and 2 will show the model range.<br><br></div>Making this filled xy curve as the plot0, I need to overlay all the other lines over it. <br><br></div>Please help me to do this. I have gone through the examples given at NCL website but can't figure out the required commands for my case. <br><br></div>Thanks a lot for your kind support,<br></div>Ruksana<br><br><div><div><div><div><div><div><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Ruksana Abedin</b> <span dir="ltr"><<a href="mailto:ruksana.abedin@gmail.com">ruksana.abedin@gmail.com</a>></span><br>Date: Thu, Feb 11, 2016 at 5:36 PM<br>Subject: how to fill in between two curves? Please help to sort this out<br>To: NCL-talk <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>><br><br><br><div dir="ltr"><div>Hi,<br><br></div>I need to fill in with color in between my first two curves (both grey lines in figure) but not sure how to do this. I have tried adding these lines but error message says one mudt be 2D other 1D. Please help me to get this done.<br><div><div><br>y = fldmeanx<br>y1 = fldmeany<br><br>;The area between b/w curves y and y1 will be filled in with grey<br><br>res@gsnXYFillColors = "grey"<br><br>plotxy = gsn_csm_y(wks,y,res)<br><br></div><div>below is the script and the figure <br><br><br><br><br></div><div>;*****************************************************<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"<br>;*****************************************************<br>begin<br>;***************************************************** <br>;read in data <br>;***************************************************** <br>fx = addfile("/...../<a href="http://wah2_sas_LRBdesh.1992.nc" target="_blank">wah2_sas_LRBdesh.1992.nc</a>","r")<br>fy= addfile("/....../<a href="http://wah2_sas_LRBdesh.2003.nc" target="_blank">wah2_sas_LRBdesh.2003.nc</a>","r")<br>f0=addfile ("/../<a href="http://wah2_sas_1985_2007.part.LRBdesh.ymonmean_1_11.nc" target="_blank">wah2_sas_1985_2007.part.LRBdesh.ymonmean_1_11.nc</a>", "r"); <br>f = addfile("/.../APHRO_Asian_Monsoon_1963-2007/APHRO_LRBdesh_ppt_1985_2007_ymonmean_1_11.nc", "r")<br>f1 = addfile(".../<a href="http://GPCC.precip.ymonmean_1_11.1985-2007.v6.360d.LRBdesh.nc" target="_blank">GPCC.precip.ymonmean_1_11.1985-2007.v6.360d.LRBdesh.nc</a>","r")<br>f2 = addfile("/.../<a href="http://UoD.precip.360d.ymonmean.1985_2007_LRBDesh.v301.nc" target="_blank">UoD.precip.360d.ymonmean.1985_2007_LRBDesh.v301.nc</a>","r")<br><br>;***************************************************** <br>; parameters<br>;***************************************************** <br>PPT_modx = fx->field90(:,0,:,:)<br>PPT_modx = PPT_modx*86400<br><br>PPT_mody = fy->field90(:,0,:,:)<br>PPT_mody = PPT_mody*86400<br><br>PPT_mod = f0->field90(:,0,:,:)<br>PPT_mod = PPT_mod*86400<br><br>PPT_obs = f->precip<br>PPT_obs1 = f1->precip/30<br>PPT_obs2 = f2->precip/3<br><br><br>fldmeanx = wgt_areaave_Wrap(PPT_modx,1.0,1.0,1)<br>fldmeany = wgt_areaave_Wrap(PPT_mody,1.0,1.0,1)<br>fldmean0 = wgt_areaave_Wrap(PPT_mod,1.0,1.0,1)<br>fldmean = wgt_areaave_Wrap(PPT_obs,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>time = f0->time0<br>x = PPT_mod&time0<br>timax = dimsizes(time)-1<br><br>;--convert the time proleptic_gregorian calendar to UTC date <br>utc_date = cd_calendar(time,0)<br><br>;-- set date variable names<br><br>year = tointeger(utc_date(:,0))<br>month = tointeger(utc_date(:,1))<br>day = tointeger(utc_date(:,2))<br>hour = tointeger(utc_date(:,3))<br>minute = tointeger(utc_date(:,4))<br>second = utc_date(:,5)<br><br>;-- write date as string (MM)<br>date_str_i = sprinti("%0.2i",month)<br><br>;-- create the time strings, plot every axis annotation<br>incr = 1<br>labels = (/date_str_i(0::incr)/)<br>labels = (/"J","F","M","A","M","J","J","A","S","O","N"/)<br><br>;-- set resources <br>res = True<br>res@trXMinF = time(0) ; time minimum on axis <br>res@trXMaxF = time(timax) ; time maximum on axis <br>res@tmXBMode = "Explicit" ; explicit time setting<br>res@tmXBValues = PPT_mod&time0(::incr) ; axis tick position<br>res@tmXBLabels = labels <br><br><br>colors = (/"grey","grey","blue","green","violet","orange"/)<br>lg_labels = (/"RCM","Range of","RCM","APHRODITE","GPCC","UoD"/)<br><br>printVarSummary(time)<br>printVarSummary(PPT_mod)<br>printVarSummary(PPT_obs)<br>printVarSummary(PPT_obs1)<br>printVarSummary(PPT_obs2)<br><br>wks = gsn_open_wks("eps","annpptcycle") <br><br>res =True<br>res@gsnDraw = False<br>res@gsnFrame = False<br>res@gsnPaperOrientation = "portrait"<br><br>res= True ; plot mods desired<br>res =True<br>res@gsnMaximize= True<br>res@gsnDraw = False<br>res@gsnFrame = False<br>res@gsnPaperOrientation = "portrait"<br><br><br>res= True ; plot mods desired<br>res@tiMainString = "Bangladesh with Larger Region"<br>res@tiYAxisString = "Precipitation (mm/day)" <br>res@tiXAxisString = "months" <br>res@xyLineThicknessF = (/6,6,8,6,6,6/)<br>res@trYMinF = 0.0<br>res@trYMaxF = 15.0<br><br>res@xyLineColor = colors(0)<br>plot0 = gsn_csm_xy(wks,x,fldmeanx,res) <br> <br>res@xyLineColor = colors(1)<br>plot1 = gsn_csm_xy(wks,x,fldmeany,res) <br><br>res@xyLineColor = colors(2)<br>plot2 = gsn_csm_xy(wks,x,fldmean0,res) <br><br>res@xyLineColor = colors(3)<br>plot3 = gsn_csm_xy(wks,x,fldmean,res) <br><br>res@xyLineColor = colors(4)<br>plot4 = gsn_csm_xy(wks,x,fldmean1,res) <br><br>res@xyLineColor = colors(5)<br>plot5 = gsn_csm_xy(wks,x,fldmean2,res) <br><br><br>overlay(plot0,plot1)<br>overlay(plot0,plot2)<br>overlay(plot0,plot3)<br>overlay(plot0,plot4)<br>overlay(plot0,plot5)<br><br><br>; Attach a legend<br><br>lgres = True<br>lgres@lgLineColors = colors<br>lgres@lgMonoItemType = True <br>lgres@lgItemType = "Lines" <br>lgres@lgMonoDashIndex = True<br>lgres@lgDashIndex = "SolidLine" <br>lgres@gsLineDashPattern = 0.<br>lgres@lgLineThicknessF = 5.<br>lgres@lgLabelFontHeightF = 0.25<br>lgres@lgBoxMinorExtentF = 0.25<br>lgres@vpWidthF = 0.25<br>lgres@vpHeightF = 0.25<br>lgres@pmLegendDisplayMode = "Always"<br>lgres@pmLegendWidthF = 0.9<br>lgres@pmLegendHeightF = 0.1<br>lgres@xyExplicitLabels = lg_labels<br>lgres@lgBoxMinorExtentF = 0.8<br>lgres@lgPerimOn = False<br>legend = gsn_create_legend(wks, 6, lg_labels, lgres)<br><br>amres = True <br>amres@amJust = "BottomRight" ; Use bottom right corner of box for determining its location.<br>amres@amOrthogonalPosF = -0.12<br>amres@amParallelPosF = -0.1<br><br>annoid = gsn_add_annotation(plot0, legend, amres) ; add legend to plot <br><br>draw(plot0)<br><br>frame(wks)<br><br>end<br><br><br><br><img style="margin-right:0px" alt="Inline image 1" src="cid:ii_152d1623a3edeb6d" height="281" width="267"><br><br><br></div></div></div>
</div><br></div></div></div></div></div></div></div>