Re: 5_month_season

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 13 2010 - 13:09:16 MST

Another approach that could avoid the loop, although the trade off is
that it requires more memory for temporary variables:

On Jan 13, 2010, at 10:40 AM, Dennis Shea wrote:

> If you have x(time,lat,lon)
>
> dimx = dimsizes( x )
> ntim = dimx(0)
> nlat = dimx(1)
> mlon = dimx(2)
>
> nmon = 5
>
> nyear = ntim/12
> n5 = nyear*nmon
> xNew = new ( (/n5,nlat,mlon/), typeof(x), getFillValue(x) )

; redimension to 4d
x1d = ndtooned(x)
xnd = onedtond(x1d,(/nyear,12,nlat,mlon/))
xs = xnd(:,4:8,:,:)

; redimension back to 3d

delete(x1d)
delete(xnd)

x1d = ndtooned(xs)
xNew = onedtond(xs,(/n5,nlat,mlon/))
delete(x1d)
delete(xs)

>
> nStrt = 4 ; May
> nLast = nStrt+navg-1 ; Sept
> na = 0
> nb = nmon-1
> do nyr=0,nyear-1
> xNew(na:nb,:,:)= x(nStrt:nLast,:,:)
> nStrt = nStrt + 12
> nLast = nLast+12
> na = na+nmon
> nb = nb+nmon
> end do
>
> =========
> If you have x(time,lat,lon) and want the seasonal average at each
> grid point
>
> x5 = runave_Wrap (x(lat|:,lon|:,time|:), 5, 0)
>
> xmjjas = x5(:,:,6:ntim-1:12) ; (lat,lon,one_MJJAS_per_year)
>
> ==========
>
> Good luck
>
> On 01/13/2010 09:26 AM, Aaron Goldner wrote:
>>
>> Sorry, I was not clear in my original message. I am not looking to
>> take a 5 month seasonal average. I want to take those five months
>> out of each year of my entire dataset. So my original dataset of
>> 468 months will have 195 months with all the May through June
>> months included in the new variable. I am going to have to use a
>> loop which I can do, I was just checking to see if there was a
>> function available. Thanks for the help.
>>
>> Aaron
>>
>>
>>
>> > Date: Wed, 13 Jan 2010 07:19:39 -0900
>> > From: debasish@gi.alaska.edu
>> > To: golgicomplex3@hotmail.com
>> > CC: ncl-talk@ucar.edu
>> > Subject: Re: 5_month_season
>> >
>> > Dear Aaron,
>> >
>> > Please check the web page:
>> > http://www.ncl.ucar.edu/Support/talk_archives/2009/2262.html
>> >
>> > Where Adam Phillips showed the way to calculate 4 month seasonal
>> > average. You can follow the same way for your five month case.
>> >
>> > Good Luck
>> >
>> > Debasish
>> >
>> > Quoting Aaron Goldner <golgicomplex3@hotmail.com>:
>> >
>> > >
>> > > Hi,
>> > >
>> > > If I have 468 monthly timesteps, starting with January at
>> timestep
>> > > 0. Is there a function in NCL that will subsect months may-sept
>> for
>> > > each year? Or will I have to create a do loop and pull out the
>> > > subsequent months manually?
>> > >
>> > > Thanks,
>> > > Aaron
>> > >
>> > > _________________________________________________________________
>> > > Hotmail: Powerful Free email with security by Microsoft.
>> > > http://clk.atdmt.com/GBL/go/196390710/direct/01/
>> >
>> >
>> >
>> > ----------------------------------------------------------------
>> > This message was sent using IMP, the Internet Messaging Program.
>> >
>>
>> Hotmail: Free, trusted and rich email service. Get it now.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
> --
> ======================================================
> Dennis J. Shea tel: 303-497-1361 |
> P.O. Box 3000 fax: 303-497-1333 |
> Climate Analysis Section |
> Climate & Global Dynamics Div. |
> National Center for Atmospheric Research |
> Boulder, CO 80307 |
> USA email: shea 'at' ucar.edu |
> ======================================================
> _______________________________________________
> 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 13 13:09:23 2010

This archive was generated by hypermail 2.1.8 : Fri Jan 15 2010 - 13:51:45 MST