Re: Minor Tickmark

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 08 2012 - 11:29:57 MST

Guo,

If you are trying to deal with date values, it might be better to put them in a format like YYYYMMDD.

What does your date array look like? Does it have a "units" of something like "days since…"?

If so, then you could use cd_calendar to convert your values to year, month, day, hour, etc (option 0),
and then wherever you have a day of 1, you can put a tickmark value.

;---Dummy array containing of number of days
  d = ispan(1,9000,1)
  d@units = "days since 2000-01-01"

;---Convert to n x 6 array (year,month,day,hour,min,sec)
  utc = cd_calendar(d,-5) ; utc(:,2) will be the day values

;---Get the indices where the days = 1. We know this is the 1st of the month.
  iday = ind(utc(:,2).eq.1)
  ndays = dimsizes(iday)
  smon = new(ndays,string) ; Array to hold month strings

  smonths = (/"", "Jan","Feb","Mar","Apr","May","Jun",\
                  "Jul","Aug","Sep","Oct","Nov","Dec"/)

  do i=0,ndays-1
    im = utc(iday(i),1) ; Get the month value (1-12)
    smon(i) = smonths(im)
  end do

  print(smon)
  res = True
  res@tmXBMode = "Explicit"
  res@tmXBValues = d(iday)
  res@tmXBLabels = smon

You didn't indicate where you want the minor tick mark values, but you can use similar code.

--Mary

On Mar 7, 2012, at 11:46 AM, Guo Zhang wrote:

> Hi,
> I'm trying to setup the minor tick marks. I have 1-hourly data. Each month has different number of days, so I can't figure out how to handle them. Can anyone tell me how to specify them? Thanks.
>
> My relative script is as below:
> res@tmXBMode = "Explicit"
> res@tmXBValues =(/1,745,1417,2161,2881,3625,4345,5089,5833,6553,7297,8017,8761/)
> res@tmXBLabels =(/"Jan","Feb","Mar","Apr","May","Jun", \
> "Jul","Aug","Sep","Oct","Nov","Dec","Jan"/)
> ; res@tmXBMinorValues = ispan(1,8760,24)
>
> Best,
> -Guo
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 8 08:30:07 2012

This archive was generated by hypermail 2.1.8 : Tue Mar 13 2012 - 14:00:14 MDT