explicit x-axis labels with gsn_csm_lat_time

From: Juliane Otto <juliane.otto_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 16 2010 - 11:43:55 MST

Hello,
*_/
/_*I'm am creating a gsn_csm_lat_time-plot. I followed the example
hov_4.ncl <http://www.ncl.ucar.edu/Applications/Scripts/hov_4.ncl> to
set explicitly the x-axis labels. My plot looks fine (as attached).
However, I want the x-axis to start with January (JAN).

The range of the time dimension is:

Variable: time (coordinate)
Type: double
Total Size: 96 bytes 12 values
Number of Dimensions: 1
Dimensions and sizes: [time | 12]
Coordinates:
Number Of Attributes: 2
  calendar : proleptic_gregorian
  units : day as %Y%m%d.%f
(0) 33290131.5
(1) 33290228.5
(2) 33290331.5
(3) 33290430.5
(4) 33290531.5
(5) 33290630.5
(6) 33290731.5
(7) 33290831.5
(8) 33290930.5
(9) 33291031.5
(10) 33291130.5
(11) 33291231.5

I have tried the following. I enlarged the range with res@tmXBValues and
set the respective labels with res@tmXBLabels. Still, the x-axis ranges
from FEB to DEC.

 res@tmXBMode = "Explicit"
 res@tmXBValues = (/ 33290000. , 33290100. , 33290200. ,
33290300., 33290400., 33290500., 33290600., 33290700., 33290800.,
33290900., 33291000., 33291100., 33291200. /)
 res@tmXBLabels =
(/"DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"/)

Does anyone know how to solve this?

Thanks!
*_/
/_*

load "/sw/sarge-ia32/ncarg-4.4.1s/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "/sw/sarge-ia32/ncarg-4.4.1s/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "/sw/sarge-ia32/ncarg-4.4.1s/lib/ncarg/nclscripts/csm/contributed.ncl"

;****plot lat versus time *********************************************

begin

;*********************************************
; read in data
;*********************************************

path1="/scratch/local2/m220065/cosmos-landveg-no-nitrogen_2009-SEP-03/DV/jot0012/echam5/snowmasking/"
pathout="/scratch/local2/m220065/cosmos-landveg-no-nitrogen_2009-SEP-03/results/"
time="annual/"
filename="strength_temperature_latime"

x1 = addfile(path1 + "jot0012_BOT_6h_monmean.nc","r")
printVarSummary(x1->tsurf)

tsurf = x1->tsurf
                                       
;*********************************************
; manipulate data for plotting
;*********************************************

 shov = tsurf({lon|100:100},lat|:,time|:) ; put time last
 dims = dimsizes(shov)

 sdemo = onedtond(ndtooned(shov), (/dims(1),dims(2)/) )
 sdemo!0 = "lat"
 sdemo!1 = "time"
 sdemo&lat = tsurf&lat
 sdemo&time = tsurf&time
 sdemo@long_name = "surface temperature"
 sdemo@units = "C"
 sdemo = sdemo-273.15

 print(sdemo&time)

;*************************
; plotting parameters
;*************************
 wks = gsn_open_wks ("ps", "lat_time" )

 gsn_merge_colormaps(wks,"BlGrYeOrReVi200","rainbow+gray")

 res = True ; plot mods desired
 res@cnFillOn = True ; color on
 res@lbLabelStride = 1 ; every other label
 res@lbOrientation = "Vertical" ; vertical label bar
 res@pmLabelBarOrthogonalPosF = -0.04 ; move label bar closer to axis
 res@cnLinesOn = False ; turn off contour lines

 res@cnLevelSelectionMode = "ManualLevels" ; manual set levels
 res@cnMinLevelValF = -30 ; min level
 res@cnMaxLevelValF = 30 ; max level
 res@cnLevelSpacingF = 5 ; contour intervall
 res@cnFillColors = (/84,95,74,64,115,128,144,160,175,180,239,233,215,212,1/)

 res@tmXBMode = "Explicit" ; Define own tick mark labels.
 res@tmXBValues = (/ 33290000. , 33290100. , 33290200. , 33290300., 33290400., 33290500., 33290600., 33290700., 33290800., 33290900., 33291000., 33291100., 33291200. /)
 res@tmXBLabels = (/"DEC","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC" /)

 res@gsnMajorLatSpacing = 10.

 res@tiMainString = "Surface temperature, AV, 100E" ; title

 res@vpXF = 0.12 ; default is 0.2 (aspect ratio)
 res@vpYF = 0.8 ; default is 0.8
 res@vpHeightF = 0.4 ; default is 0.6
 res@vpWidthF = 0.75 ; default is 0.6

 

 plot = gsn_csm_lat_time(wks,sdemo({30:90},:),res)

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Feb 16 11:44:09 2010

This archive was generated by hypermail 2.1.8 : Thu Feb 18 2010 - 10:33:29 MST