problem with explicit x-axis time labeling

From: Kerrie Geil <kgeil_at_nyahnyahspammersnyahnyah>
Date: Sun Apr 06 2014 - 00:17:34 MDT

Can anyone help me figure out why my x-axis time labels won't appear? I am
reading in 5 months of hourly model output and the plots I want to make
will display 1 month of hourly output for each loop pass with tickmark
labels on the "00" hour of each day. I've tried gsn_csm_y and gsn_csm_xy2,
but I get no tick marks on the XB axis and no labels either. Also, there
is no error message produced. I've included a portion of my code below.
 I'm using NCL v 6.1.2. Any suggestions?

Thanks for the help.

...

;##### READ TIME AND CONVERT TO INTEGER YYYYMMDDHH FORMAT #####
time=timefile->XTIME
time@units="minutes since "+date
time:=cd_calendar(time,-3)
ntimes=dimsizes(time)
nmonths=5

wks = gsn_open_wks(type ,"plots/test")

do iyear=0,0
do ivar=0,nvars-1
;##### GET TIMESERIES FOR VARIABLES AT 1 LOCATION #####
infileN:=addfile(path+"Noah/"+variables(ivar)+"_Noah_"+years(iyear)+".nc","r")
infileUA:=addfile(path+"NoahUA/"+variables(ivar)+"_NoahUA_"+years(iyear)+".nc","r")

varN=infileN->$variables(ivar)$(:,Y,X)
varUA=infileUA->$variables(ivar)$(:,Y,X)

;##### PLOT EACH MONTH SEPARATELY #####
do imonth=0,nmonths-1
;##### IDENTIFY INDICES FOR 1 MONTH AT A TIME ####
monthind:=ind( str_get_cols(tostring(time),4,5) .eq.
("0"+tostring(imonth+1)) ) ;### indices of all times in 1 month
dimtimes=dimsizes(monthind)

;##### TO BE USED FOR tmXBLabels AND tmXBValues #####
labels:=tostring(time(monthind))
subsettime:=time(monthind)
 ;##### DEFINE PLOT RESOURCES #####
res=True
res@gsnMaximize=True
res@vpHeightF=0.6
res@vpWidthF=1.5
res@xyLineColors=(/"blue","red"/)
res@gsnLeftString=variables(ivar)
res@gsnCenterString=varN@description
res@gsnRightString=varN@units
res@tiYAxisString=variables(ivar)
res@tiXAxisString="Time"

res@tmXBMode="Explicit"
res@tmXBLabelAngleF=270.
res@tmXBLabelJust="centerLeft"
res@tmXBValues:=subsettime(0::24)
res@tmXBLabels:= labels(0::24)

;##### PLOT USING TWO DIFFERENT PLOTTING FUNCTIONS #####
plot=gsn_csm_y(wks,(/varN(monthind),varUA(monthind)/),res)

xvals:=ispan(0,dimtimes-1,1)
plot=gsn_csm_xy2(wks,xvals,varN(monthind),varUA(monthind),res,False)

end do ;### MONTH LOOP ###
end do ;### VAR LOOP ###
end do ;### YEAR LOOP ###

...

-- 
Kerrie Geil
Department of Atmospheric Sciences
University of Arizona
PAS Building Rm 576
1118 E 4th Street
Tucson, AZ 85721

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Apr 06 00:17:47 2014

This archive was generated by hypermail 2.1.8 : Tue Apr 15 2014 - 10:45:19 MDT