<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Dear John,<br>
<br>
Here's some code for calculating a 7-day running mean from a post to
the GrADS Listserv...<br>
<br>
-----------<br>
Question posted by Alvaro Luis <a class="moz-txt-link-rfc2396E" href="mailto:luis@OCEAN.CAOS.TOHOKU.AC.JP"><luis@OCEAN.CAOS.TOHOKU.AC.JP></a>
(7/4/1999):<br>
<br>
><br>
> Has anyone tried computing a centered running mean in GrADS<br>
> environment? The one which I know positions the running mean
starting on the<br>
> first point:<br>
><br>
> set t 1 365<br>
> define a=ave(var,t+0,t+6) ! for a 7-day running mean<br>
><br>
><br>
> I wish to position this one on day=3 and not on day=1. How to
achieve this?<br>
><br>
<br>
Try:<br>
<br>
set t 4 365<br>
define a=ave(var,t-3,t+3) ! for a 7-day running mean<br>
<br>
<br>
You can still use<br>
<br>
set t 1 365<br>
define a=ave(var,t-3,t+3) ! for a 7-day running mean<br>
<br>
but in this case you willl get an uncentered mean for the first<br>
3 days.<br>
<br>
--<br>
Arlindo da Silva<br>
<a class="moz-txt-link-abbreviated" href="mailto:arlindo@niteroi.gsfc.nasa.gov">arlindo@niteroi.gsfc.nasa.gov</a><br>
<br>
-----------<br>
<br>
I hope this helps,<br>
Chuck<br>
<br>
<br>
John Guhin wrote:
<blockquote
cite="mid37b4e6a50602221508u297c05d8r15761524c57ac056@mail.gmail.com"
type="cite">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. <br>
--------------------------------------------<br>
'reinit'<br>
'c'<br>
'set gxout fwrite'<br>
'set fwrite u_daily_3D.dat'<br>
'open u.ctl'<br>
'set lon 40 180'<br>
'set lat -10 10'<br>
t1=1<br>
z1=1<br>
while(z1<5)<br>
'set z 'z1<br>
while(t1<977)<br>
'set t 't1<br>
'd ave(u,t='t1',t='t1+7')'<br>
t1=t1+8<br>
endwhile<br>
z1=z1+1<br>
endwhile<br>
------------------------------------------------------------------------<br>
<br>
<br>
<div><span class="gmail_quote">On 2/22/06, <b
class="gmail_sendername">Arindam Chakraborty</b> <<a
href="mailto:arch@io.met.fsu.edu">arch@io.met.fsu.edu</a>> wrote:</span>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
Please change 'd ave(u,t=t1,t=t1+7)' to<br>
'd ave(u,t='t1',t='t1+7')'<br>
<br>
because t1 is a script variable and should be outside the single<br>
quotes.<br>
<br>
--<br>
<br>
On Wed, 22 Feb 2006, John Guhin wrote:<br>
<br>
> Hi,<br>
> I was wondering if someone can find the mistake. I am
trying to<br>
> convert a 3 hourly data to daily data.<br>
> The original data is 3D. any help will be appreciated.<br>
>
----------------------------------------------------------------------
<br>
> * Program to write 3 hourly data to daily data<br>
> 'reinit'<br>
> 'c'<br>
> 'set gxout fwrite'<br>
> 'set fwrite u_daily.dat'<br>
> 'open u.ctl'<br>
> 'set lon 40 180'<br>
> 'set lat -10 10'<br>
> 'set lev 850'
<br>
> t1=1<br>
> while(t1<977)<br>
> 'set t 't1<br>
> 'd ave(u,t=t1,t=t1+7)'<br>
> t1=t1+8<br>
> endwhile<br>
> --------------------------------------------------------------------------------------------------
<br>
><br>
</blockquote>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
********************************************************************
Charles Seman <a class="moz-txt-link-abbreviated" href="mailto:charles.seman@noaa.gov">charles.seman@noaa.gov</a>
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 <a class="moz-txt-link-freetext" href="http://www.gfdl.noaa.gov/~cjs/">http://www.gfdl.noaa.gov/~cjs/</a>
********************************************************************
"The contents of this message are mine personally and do not reflect
any position of the Government or NOAA."
</pre>
</body>
</html>