[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
20041027: Time interpolation?
- Subject: 20041027: Time interpolation?
- Date: 27 Oct 2004 13:13:10 -0600
On Wed, 2004-10-27 at 12:11, Christian Pagé wrote:
> Hi everyone,
>
> Is there a way to do time interpolation in gempak with a grid file?
> I have 3-hourly data model data that I would like to interpolate to
> 1-hourly data. Is it possible?
>
> Thanks
Christian,
You can use GDDIAG and interpolate a field using the formula:
Xi = X0 + ( X1 - X0)/(t1 - t0) * (ti - t0)
where ti is a time in the range t0 to t1.
As example, here is a script that would interpolate the 3 hourly 500mb
heights in the eta212 to the f+1 and f+2 times for a a starting forcast
time, and looped for each 3 hourly forecast interval. The desired
function could also be looped though the desired parameters as well.
Note that gddiag is runs twice for each 3 hour forecast interval,
the first for t+1 hour and the second for t+2 hours.
Also, you can use the ddt(s) function in place of the sub(s1,s2) and
use the GDATTIM=time1:time2 time interval.
Steve Chiswell
Unidata User Support
#!/bin/csh -f
# set starting forecast hour and forecast increment
@ START = 0
@ INC = 3
# set model run time
set MODTIME="041027/1200"
# initialize forecast time array
set FTIM=("" "" "" "")
while ( $START < 84 )
@ STOP = $START + $INC
@ TN1 = $START + 1
@ TN2 = $START + 2
# create forecast fxxx strings
set TARR=(${START} $TN1 $TN2 $STOP)
@ CNT = 1
while ( $CNT <= 4 )
if ( $TARR[$CNT] < 10 ) then
set FTIM[$CNT] = f00${TARR[$CNT]}
else
set FTIM[$CNT] = f0${TARR[$CNT]}
endif
echo look $CNT $TARR[$CNT] ftim $FTIM[$CNT]
@ CNT = $CNT + 1
end
gddiag << EOF
GDFILE = eta212|${MODTIME}
GDOUTF = eta212|${MODTIME}
GFUNC = add(hght,mul(quo(sub(hght^${FTIM[4]},hght),${INC}),1)
GDATTIM = $FTIM[1]
GLEVEL = 500
GVCORD = pres
GRDNAM = hght^${MODTIME}${FTIM[2]}
GPACK = grib
GRDHDR =
r
GFUNC = add(hght,mul(quo(sub(hght^${FTIM[4]},hght),${INC}),2)
GRDNAM = hght^${MODTIME}${FTIM[3]}
r
e
EOF
@ START = $START + $INC
end