Sub-setting a 1D array

From: Bart Brashers <bbrashers_at_nyahnyahspammersnyahnyah>
Date: Thu Oct 11 2012 - 17:59:44 MDT

If I have an array containing 1 month of hourly data (0:743) and another array of corresponding time-stamps, and try to plot the time series with the time-stamps as labels on the X-axis, they are too close together and I just get a big bunch of black.

How can I select a sub-set of the timestamps to print? Something like this:

  rain = wrf_user_getvar(a,"RAINNC",-1) / 25.4 ; 25.4 mm/inch
  Times = a->Times
  times = wrf_times_c(Times,3)

  n = dimsizes(rain)
  taus = ispan(0,n(0)-1,24) ; One label per day

  ts_res = True
  ts_res@tmXBMode = "Explicit" ; Define own tick mark labels.
  ts_res@tmXBValues = taus ; location of explicit labels
  ts_res@tmXBLabels = times(taus) ; labels are the locations

  ts_plot = gsn_csm_xy(wks,taus,rain,ts_res)

It boils down to "how do I select every Nth element of an array"? I can't find a discussion of such a basic concept in the examples...

Thanks,

Bart

Ignore Mordac:

________________________________
This message contains information that may be confidential, privileged or otherwise protected by law from disclosure. It is intended for the exclusive use of the Addressee(s). Unless you are the addressee or authorized agent of the addressee, you may not review, copy, distribute or disclose to anyone the message or any information contained within. If you have received this message in error, please contact the sender by electronic reply to email@environcorp.com and immediately delete all copies of the message.
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Oct 11 17:59:54 2012

This archive was generated by hypermail 2.1.8 : Fri Oct 12 2012 - 15:38:19 MDT