<div dir="ltr"><div><div><div><div>Hi Rick,<br><br></div>Thank you for your suggestion. Yes, you are right, labels had only two values <br><br>Variable: labels<br>Type: string<br>Total Size: 16 bytes<br> 2 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [2]<br>Coordinates:<br>(0) 12<br>(1) 01<br><br></div>I have fixed this and now the x-axis shows 1-12 for the months. Thank you so much for your help. <br>Can I change this to Jan, Feb... Dec using ncl? Any suggestion will be highly appreciated. <br><br></div>With many thanks and regards,<br></div>Ruksana <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 26, 2015 at 5:37 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">Hi,<div><br></div><div>I'm not certain, and don't have a good way to test at the moment. However, a hint might be the variable "incr = 1"</div><div><br></div>Maybe print out the variable "labels" ... I' guess that it only contains two values. Likewise for for PPT_obs&time(:,1).<div><br></div><div>Hope that helps, but please write back to the list if not.</div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span><div><span class="HOEnZb"><font color="#888888">Rick</font></span><div><div class="h5"><br><div><br>On Wednesday, November 25, 2015, Ruksana Abedin <<a href="mailto:ruksana.abedin@gmail.com" target="_blank">ruksana.abedin@gmail.com</a>> 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>Hi.<br><br></div>Can you please help me to find out why I could not plot the time axis properly?<br><br></div>Below given the script anf the ouput. The axis should show 2-10 but only showing 2-3. How can I change this to Feb-Nov?<br><br></div>Thank you for your kind support.<br><div><div><div><div><br></div><div>Best regards,<br></div><div>Ruksana<br></div><div><br><br>;*****************************************************<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>f0=addfile ("/ouce-home/students/rege1218/WAH2_SAS_Results_1985_2011/<a href="http://wah2_sas_1985_2007.part.Bdesh.ymonmean.nc" target="_blank">wah2_sas_1985_2007.part.Bdesh.ymonmean.nc</a>", "r"); <br>f = addfile("/ouce-home/students/rege1218/Observations/APHRO_Asian_Monsoon_1963-2007/APHRO_Bdesh_ppt_1985_2007_ymonmean.nc", "r")<br>;***************************************************** <br>; parameters<br>;***************************************************** <br> <br>PPT_mod = f0->field90(:,0,0,0)<br>PPT_mod = PPT_mod*86400<br><br>PPT_obs = f->precip<br>time = f->time<br>x = PPT_obs&time<br>timax = dimsizes(time)-1<br><br>fldmean = wgt_areaave_Wrap(PPT_obs,1.0,1.0,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><br>;-- set t 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_obs&time(:incr) ; axis tick position<br>res@tmXBLabels = labels <br><br><br>colors = (/"blue","violet"/)<br>labels = (/"RCM_ppt","OBS_ppt"/)<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 = "mm/day" <br>res@xyLineThicknessF = (/3,3/)<br>res@trYMinF = 0.0<br>res@trYMaxF = 20.0<br><br><br>res@xyLineColor = colors(0)<br>plot0 = gsn_csm_xy(wks,x,PPT_mod,res) <br> <br>res@xyLineColor = colors(1)<br>plot1 = gsn_csm_xy(wks,x,fldmean,res) <br> <br>overlay(plot0,plot1)<br><br><br>; Attach a legend<br><br>lgres = True<br>lgres@lgLineColors = colors<br>lgres@lgItemType = "Lines"<br>lgres@lgLabelFontHeightF = 0.2<br>lgres@lgBoxMinorExtentF = 0.2<br>lgres@vpWidthF = 0.2<br>lgres@vpHeightF = 0.2<br>lgres@pmLegendDisplayMode = "Always"<br>lgres@pmLegendWidthF = 0.05<br>lgres@pmLegendHeightF = 0.04<br>lgres@xyExplicitLabels = labels<br>lgres@lgBoxMinorExtentF = 0.3<br>legend = gsn_create_legend(wks, 2, labels, lgres)<br><br>amres = True <br>amres@amJust = "BottomRight" ; Use bottom right corner of box for determining its location.<br>amres@amOrthogonalPosF = -0.22<br>amres@amParallelPosF = 0.4<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></div></div></div></div></div>
</blockquote></div></div></div></div>
</blockquote></div><br></div>