Re: Subsetting series of specific months out of YYYYMM data

From: Bronwen Konecky <bronwen_konecky_at_nyahnyahspammersnyahnyah>
Date: Thu Jan 31 2013 - 12:18:32 MST

Thanks for the help! I added one line to the following and it worked:

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

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

-Bronwen

On Wed, Jan 30, 2013 at 6:45 PM, Dennis Shea <shea@ucar.edu> wrote:

> 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 <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<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<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>
>>
>

-- 
--------------------------------------------------
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
cell +1-415-420-8083
--------------------------------------------------

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jan 31 12:19:04 2013

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