Re: Subsetting series of specific months out of YYYYMM data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 30 2013 - 16:45:19 MST

Another approach

   yyyymm = f->time
   yyyy = yyyymm/100
   mm = yyyymm - (yyyy*100)
   imm = ind(mm.ge.9 .and. mm.le.11)

   x = f->X(imm,:,:)
   printVarSummary(x)
   print(x&time)

On 01/30/2013 04:39 PM, Will Hobbs wrote:
> Bronwen
>
> Assuming you have an array x, dimensioned (time,lat,lon), where the time
> coord is an integer array of YYYYMM dates:
>
> >yr = ispan(yrst, yren, 1) ; an integer array of all years in the
> series
>
> > nyr = yren-yrst+1
> >yrmon = new(nyr*3,"integer") ;an array which will hold the date of
> every month of interest
>
> >yr = yr*100
> >yrmon(::3) = yr +9 ; take any year (e.g. 1850), multiply by 100
> (=185000) then add the month of interest (in this case September) =
> 185009 i.e. the YYYYMM date for all the septembers
> >yrmon(1::3) = yr+10 ;October
> >yrmon(2::3) = yr+11 ;November
>
> >print(yrmon) ; yrmon should look something like
> (/185009,185010,185011, 185109 ../)
>
>
> >xSeas = x({yrmon},:,:) ; select all months of interest from x
>
>
> Will
>
> From: Bronwen Konecky <bronwen_konecky@brown.edu
> <mailto:bronwen_konecky@brown.edu>>
> Date: Thursday, 31 January 2013 10:27 AM
> To: ncl-talk <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>
> Subject: Subsetting series of specific months out of YYYYMM data
>
> Hello,
>
> Apologies for a fairly novice question: I am trying to pull out months
> from a specific season from a file(time,lat,lon) that contains 130 years
> of monthly data (all months) in YYYYMM format (1560 time points). So I
> want a new file that contains e.g. months 9-11 from all years in the
> file (e.g. 187009, 187010, 187011, 187109, 187110, 187111, etc), for all
> lats and lons. I have tried various combinations of do loops and array
> selections using 'ind' but I think I must be missing something basic.
> Any advice?
>
> Thank you!
>
> -Bronwen
>
>
>
> --
> --------------------------------------------------
> Bronwen Konecky, Ph.D. candidate
> Dept. of Geological Sciences, Earth Systems History Group
> Brown University
> 324 Brook St., Box 1846, Providence, RI 02912, USA
> bronwen_konecky@brown.edu <mailto:bronwen_konecky@brown.edu>
> cell +1-415-420-8083 <tel:%2B1-415-420-8083>
> --------------------------------------------------
>
>
> _______________________________________________
> 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 Wed Jan 30 16:45:30 2013

This archive was generated by hypermail 2.1.8 : Fri Feb 01 2013 - 15:31:04 MST