# Re: selecting specific month

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 04 2013 - 22:46:11 MDT

There's not enough information to go on here. There could be several ways to do this, depending on your data.

For example, if your data is called "t2d" and is dimensioned 240 x npts, where the "240" represents 12 months * 20 years, then you could select the months of Jan-Mar with something like the following:

;---Create a dummy 2D array
ntim = 240
npts = 100
t2d = new((/ntim,npts/),float)

;---Set all Jan vals=0, Feb=1, Mar=2, etc.
do i=0,ntim-1
t2d(i,:) = i%12
end do

;---Reshape to 20 x 12 x npts arrays
nyear = 20
nmon = 12
t3d = reshape(t2d,(/nyear,nmon,npts/))

;---Get Jan:Mar subset
t3d_sub = t3d(:,0:2,:) ; 20 x 3 x npts
printVarSummary(t3d_sub)
printMinMax(t3d_sub,0) ; should be min=0 max=2

;---Reshape to 60 x npts array
t2d_sub = reshape(t3d_sub,(/60,npts/))
printMinMax(t2d_sub,0)

On Jul 3, 2013, at 2:00 PM, Ahmad Farsyud <a.farsyud@gmail.com> wrote:

> Anybody can suggest me a trick, how could I possibly select specific month from the monthly datasets (20 years),
> I am intending to make xy-plot with axis January, February, March repeating for each year.
>
> Thank you
> AF
> _______________________________________________
> 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 Thu Jul 4 22:46:20 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 05 2013 - 13:06:49 MDT