[ncl-talk] Is there any way to fix this x-axis time plotting problem?

Ruksana Abedin ruksana.abedin at gmail.com
Thu Dec 3 04:35:37 MST 2015


Hi,

I have used *Jan-Nov* to define the annual cycle excluding the month of Dec
(figure a, blue line). Reason behind this is - each model year starts from
Dec of the previous year following to Jan to Nov of the actual year (e.g.,
dec85, jan86, feb86, ….. nov86. Etc.). If I plot Jan-Dec (figure b, blue
line), the annual cycle of model shifts eastwards along the x-axis and
exhibits a delay in the onset of monsoon season. This is actually not
correct, as it is plotting Dec, Jan, Feb.....data in place of Jan, Feb,
Mar,.... . Is there any way which can help me plot Jan-Dec where NCL can
put the month of Dec at its right tick point along the x-axis? Any
suggestion will be very much appreciated.


[image: Inline image 2]


        a) Annual ppt cycle over months Jan-Nov (correct)       b) Annual
ppt cycle over months Jan-Dec (wrong)


Script used for the time plotting:

f0=addfile ("/......../wah2_sas_1985_2007.part.LRBdesh.ymonmean_1_11.nc",
"r");

time = f0->time0
x = PPT_mod&time0
timax = dimsizes(time)-1

;--convert the time proleptic_gregorian calendar to UTC date
utc_date   = cd_calendar(time,0)

;-- set date variable names

year     = tointeger(utc_date(:,0))
month     = tointeger(utc_date(:,1))
day     = tointeger(utc_date(:,2))
hour      = tointeger(utc_date(:,3))
minute      = tointeger(utc_date(:,4))
second      = utc_date(:,5)

;-- write date as string (MM)
date_str_i = sprinti("%0.2i",month)

;-- create the time strings, plot every axis annotation
incr     = 1
labels      = (/date_str_i(0::incr)/)
labels   = (/"J","F","M","A","M","J","J","A","S","O","N"/)

;-- set resources
res = True
res at trXMinF           = time(0)             ; time minimum on axis
res at trXMaxF           = time(timax)         ; time maximum on axis
res at tmXBMode         = "Explicit"           ; explicit time setting
res at tmXBValues         = PPT_mod&time0(::incr)  ; axis tick position
res at tmXBLabels         = labels
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151203/acba0f0a/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 67722 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151203/acba0f0a/attachment.png 


More information about the ncl-talk mailing list