Re: Subsetting

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sun Sep 23 2012 - 17:31:03 MDT

Please become familiar with the 'date' functions.
  http://www.ncl.ucar.edu/Document/Functions/date.shtml

Specifically, cd_calendar and the options

   f = addfile("...", "r)
                                      ; ALL times on file
    TIME = f->time
    YYYYMM = cd_calendar(TIME, -1) ; convert

    ymStrt = 190801 ; year-month start
    ymLast = 200712 ; year-month last

    iStrt = ind(ymStrt.eq.YYYYMM) ; index of start time
    iLast = ind(ymStrt.eq.YYYYMM) ; last time
    x = f->X(iStrt:iLast,...) ; read only specified time period

On 9/23/12 5:08 PM, Almami Johnson wrote:
> Dear all,
>
> I need to take a common time range (say 1985-2000) while manipulating
> many netcdf files with different time range. I'm just wondering if it is
> possible to take a subset of the data along the time dimension by
> providing the actual dates rather than the timesteps. For example
> rather than doing:
>
> in = addfile("UDEL_1900_2010_v301.nc","r")
> pre = in->precip({1020:1331},:,:)
>
> which requires you know the exact time step representing 198501 and
> 200012, I would like to input directly the actual date when doing
> pre = in->precip(date_start:date_end},:,:).
>
> Is there a way to do it such that NCL will undertand it?
>
> Thanks.
> Almami
>
>
> _______________________________________________
> 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 Sun Sep 23 17:31:14 2012

This archive was generated by hypermail 2.1.8 : Wed Sep 26 2012 - 13:56:04 MDT