Re: format "time" on x axis of xy plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 05 2013 - 10:09:45 MST

Hi Vanessa

You may want to check out the "wrf_times_c" function:"

This doesn't give you just day and hour, but you can use opt=3 to get yyyymmddhh,
and then just extract out the "ddhh" part.

For example:

load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"

f = addfile ("","r")
Times = f->Times

yyyymmddhh = wrf_times_c( Times, 3 ) ; integers
ddhh = str_get_cols(tostring(yyyymmddhh),6,9) ; strings

print(yyyymmddhh + "/" + ddhh)

You can use the yyyymmddhh values as the values of your X axis and
the values of your X axis tickmark locations, but use the ddhh values as the labels.

For example:

res = True
res@tmXBMode = "Explict"
res@tmXBValues = yyyymmddhh(::5) ; Label every 5th one
res@tmXBLabels = ddhh(::5)
. . .
plot = gsn_xy(wks,yyyymmddhh,y,res)

You'll have to decide how many values you want labeled on the X axis,
and change the tmXBValues and tmXBLabels settings accordingly.


On Feb 4, 2013, at 11:26 PM, Vanessa Vincente wrote:

> Hello,
> I am running an NCL script to plot accumulated precipitation ("rainnc")
> with time (total of 48 hourly values). I would like to plot the time
> stamps from the wrf output file on the x-axis, but in a more concise way.
> For example, instead of using "2012-06-07_21:00:00",
> is there a way I can just extract the day and hour from it,
> put it into an array (similar action for all the other times in my file),
> and plot this array with my data using "gsn_xy"?
> Thanks in advance!
> Vanessa
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Tue Feb 5 10:09:55 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 06 2013 - 16:37:00 MST