3hourly data to daily data

Charles Seman Charles.Seman at NOAA.GOV
Wed Feb 22 18:54:37 EST 2006


Dear John,

Here's some code for calculating a 7-day running mean from a post to the
GrADS Listserv...

-----------
Question posted by Alvaro Luis <luis at OCEAN.CAOS.TOHOKU.AC.JP> (7/4/1999):

 >
 >       Has anyone tried computing a centered running mean in GrADS
 > environment? The one which I know positions the running mean starting
on the
 >  first point:
 >
 > set t 1 365
 > define a=ave(var,t+0,t+6)   ! for a 7-day running mean
 >
 >
 > I wish to position this one on day=3 and not on day=1. How to achieve
this?
 >

Try:

set t 4 365
define a=ave(var,t-3,t+3)   ! for a 7-day running mean


You can still use

set t 1 365
define a=ave(var,t-3,t+3)   ! for a 7-day running mean

but in this case you willl get an uncentered mean for the first
3 days.

--
Arlindo da Silva
arlindo at niteroi.gsfc.nasa.gov

-----------

I hope this helps,
Chuck


John Guhin wrote:

> Thanks Arindam. It worked.  Is it possible to do such time mean for a
> 3D data.  I wrote this script, but wrote only at one time.   Am I
> doing something wrong?  Thanks in advance.
> --------------------------------------------
> 'reinit'
> 'c'
> 'set gxout fwrite'
> 'set fwrite u_daily_3D.dat'
> 'open u.ctl'
> 'set lon 40 180'
> 'set lat -10 10'
> t1=1
> z1=1
> while(z1<5)
> 'set z 'z1
> while(t1<977)
> 'set t 't1
> 'd ave(u,t='t1',t='t1+7')'
> t1=t1+8
> endwhile
> z1=z1+1
> endwhile
> ------------------------------------------------------------------------
>
>
> On 2/22/06, Arindam Chakraborty <arch at io.met.fsu.edu
> <mailto:arch at io.met.fsu.edu>> wrote:
>
>     Hi,
>     Please change 'd ave(u,t=t1,t=t1+7)' to
>     'd ave(u,t='t1',t='t1+7')'
>
>     because t1 is a script variable and should be outside the single
>     quotes.
>
>     --
>
>     On Wed, 22 Feb 2006, John Guhin wrote:
>
>     > Hi,
>     >        I was wondering if someone can find the mistake. I am
>     trying to
>     > convert a 3 hourly data to daily data.
>     > The original data is 3D.  any help will be appreciated.
>     >
>     ----------------------------------------------------------------------
>
>     > * Program to write 3 hourly data to daily data
>     > 'reinit'
>     > 'c'
>     > 'set gxout fwrite'
>     > 'set fwrite u_daily.dat'
>     > 'open u.ctl'
>     > 'set lon 40 180'
>     > 'set lat -10 10'
>     > 'set lev 850'
>     > t1=1
>     > while(t1<977)
>     > 'set t 't1
>     > 'd ave(u,t=t1,t=t1+7)'
>     > t1=t1+8
>     > endwhile
>     >  --------------------------------------------------------------------------------------------------
>
>     >
>
>

--

********************************************************************
 Charles Seman                                charles.seman at noaa.gov
 U.S. Department of Commerce / NOAA / OAR
 Geophysical Fluid Dynamics Laboratory         voice: (609) 452-6547
 201 Forrestal Road                              fax: (609) 987-5063
 Princeton, NJ  08540-6649            http://www.gfdl.noaa.gov/~cjs/
********************************************************************

"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20060222/8992db54/attachment.html 


More information about the gradsusr mailing list