Time Units

From: Ahmed Lasheen <ahmed4kernel_at_nyahnyahspammersnyahnyah>
Date: Mon Feb 11 2013 - 01:47:03 MST

Dear All,

         I am trying to plot station data consists of two column, the fist
column is the data which is written in the following format (YYYYMMDD) and
the other column is the variable. When I use the time_axis_label , I got
the following error.

function (0) time_axis_labels: The variable containing time values must
have a 'units' attribute.

 I wrote the following command for defining the time units , but is also
not true time@units="months", I know that time units is something like
that "hours since 1-1-1 00:00:00", but I actually have the time itself not
a number of hours or months. I don't know what to wrote for units.

The following is the script

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/cd_string.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
;************************************************
begin
;************************************************
; plotting parameters
;************************************************
new_rows=systemfunc("wc -l a.txt| cut -d' ' -f1")
days=systemfunc("cut -c1-2 a.txt")
months=systemfunc("cut -c3-4 a.txt")
years=systemfunc("cut -c5-8 a.txt")
var=systemfunc("cut -f2 -d' ' a.txt")
print(var)
time=years+months+days
print(time)
  wks = gsn_open_wks ("x11","xy") ; open
workstation
  res = True ; plot mods desired
  res@tiMainString = "Multiple XY plot" ; add title
  res@tiMainString = "Mulitple XY plot with markers" ; add title
  resplot = True
  restick = True
  restick@ttmFormat = "%Y%N%D"

  time@units="months"
  time_axis_labels(tointeger(time),resplot,restick) ; call the formatting
procedure

  plot = gsn_csm_xy (wks,time,tointger(var),res) ; create plot
end

I have attached the script and the data file.
Thanks in advance

-- 
===============
Ahmed Lasheen
Junior researcher at Cairo Numerical Weather Prediction Center (CNWPC)
Egyptian Meteorological Authority(EMA)
Cairo,Egypt
===============



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

Received on Mon Feb 11 01:48:27 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 13 2013 - 09:25:58 MST