Re: Help with addfiles and stride syntax

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 17 2009 - 13:04:07 MST

Hi Gina,
Yes:
  Var = a[:]->Var(31:58,:,:,;)

If you're running this for each year then something like this would work:
allfiles = systemfunc("ls "+inputpath+"filename*.nc")
a = addfiles(allfiles,"r")
ListSetType (a, "cat")
ndays = days_in_month(2001,ispan(1,12,1)) ; choose non-leap yr,
assuming model
 
   ; does not have leap yrs
cntr = 0
do gg = 0,11
        Var = a[:]->Var(cntr:cntr+ndays(gg)-1,:,:,;)
        ...............
        cntr = cntr+ndays(gg)
        delete(Var)
end do

Gina Henderson wrote:
> Hi there,
>
> I am trying to read in data that spans multiple files but cannot read a
> variable entirely as the array would exceed ncl's limit. I need to read
> in the data continuously as it is a multiple year model run with each
> history tape containing 30 days of data but the write date of each tape
> is not necessarily at the start of each month. Is there any way of using
> the stride function to extract a block of data per stride rather than
> just one value so I could do the analysis by month and avoid the array
> memory limit?
>
> Something like:
> allfiles = systemfunc("ls "+inputpath+"filename*.nc")
> a = addfiles(allfiles,"r")
> ListSetType (a, "cat")
> Var = a[:]->Var(:,:,:,;)
>
> where instead of getting the whole var(:,:,:,:), can I get the first 30
> of each 365 chuck of the first dimension? I am not sure if this is
> possible or what the correct syntax would be?
>
> Any suggestions would be greatly appreciated.
> Thanks, Gina.
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Nov 17 13:04:44 2009

This archive was generated by hypermail 2.1.8 : Tue Nov 17 2009 - 17:27:42 MST