Re: Subsetting series of specific months out of YYYYMM data

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 30 2013 - 16:39:23 MST


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


From: Bronwen Konecky <<>>
Date: Thursday, 31 January 2013 10:27 AM
To: ncl-talk <<>>
Subject: Subsetting series of specific months out of YYYYMM data


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 Konecky, Ph.D. candidate
Dept. of Geological Sciences, Earth Systems History Group
Brown University
324 Brook St., Box 1846, Providence, RI 02912, USA<>
cell +1-415-420-8083<tel:%2B1-415-420-8083>

ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
Received on Wed Jan 30 16:39:35 2013

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