[ncl-talk] can not properly have time as x axis

Ruksana Abedin ruksana.abedin at gmail.com
Thu Sep 11 09:52:00 MDT 2014


Hi,

I am trying to plot annual cycle of precipitation using Aphrodite
observation data but facing problem in having time as the x axis. Please
find the script used, summary of the variable and the plot produced below.
How can all months of the years can be shown properly in x axis?

Any advice will be highly appreciated.

With many thanks and regards,
Ruksana

---------------------------------------------------------------------------------------------------------------------------------------------


;*****************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
;*****************************************************

begin

f = addfile("Observations/APHRO_Asian_Monsoon_1963-2007/
APHRO_MA_050deg_V1003R1.1967.nc", "r")


ppt = f->precip
time = f->time
x = ppt&time

fldmean = wgt_areaave_Wrap(ppt,1.0,1.0,1)

wks = gsn_open_wks("eps","time_series")

printVarSummary(ppt)

; create plot

resplot = True   ; plot mods desired
resplot at tiMainString = "APHRO PPT ANNUAL CYCLE 1967"
resplot at tiYAxisString =  ""
resplot at xyLineColor  = "Blue"
resplot at xyLineThicknessF = 2
restime            = True                  ; set time tickmark resources
restime at ttmFormat  = "%c %y"                ; time tickmark format
time_axis_labels(time,resplot,restime)     ; sets the correct time labels
plot = gsn_csm_xy(wks,x,fldmean,resplot)

end

--------------------------------------------------------------------------------------------------------------
Variable: ppt
Type: float
Total Size: 36792000 bytes
            9198000 values
Number of Dimensions: 3
Dimensions and sizes:   [time | 365] x [latitude | 140] x [longitude | 180]
Coordinates:
            time: [   0.. 364]
            latitude: [-14.75..54.75]
            longitude: [60.25..149.75]
Number Of Attributes: 5
  long_name :   daily precipitation analysis interpolated onto 0.5deg grids
[mm/day]
  units :       mm/day
  level_description :   Earth surface
  missing_value :       -99.9
  _FillValue :  -99.9

*warning:Attempt to reference attribute (nTicks) which is undefined*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140911/69189fa4/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: APHRO_PPT_1967_Annual_cycle.jpg
Type: image/jpeg
Size: 263959 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140911/69189fa4/attachment-0001.jpg 


More information about the ncl-talk mailing list