#!/bin/sh -f

### readrsig automation script 
### 2008/01/04
### kei yoshimura

# this script read r_sigit.ftXX files and
# save as r_sig.ftXX.dat readable by GrADS.

set -ax
## need to edit by yourself ##
STTIME=240
ENDTIME=240
STEP=24
DIR=/home/kei/work5/RSM_inc2/rruns/R_ctl_newnudge_LBA/1985
PROG=/home/kei/work5/RSM_inc2/data/readrsig
###

FT=${STTIME}

while [ ${FT} -le ${ENDTIME} ] ; do
if [ ${FT} -lt 10 ] ; then
 FT=0${FT}
fi

FILE=${DIR}/r_sigit.ft${FT}
OFILE=${DIR}/r_sig.ft${FT}.dat
if [ -r ${FILE} ] ; then
${PROG} ${FILE} ${OFILE} || exit 8
else
echo ${FILE} does not exist.
fi

FT=`expr ${FT} + ${STEP}`

done

exit 8

