#!/bin/tcsh -f

set OUTDIR = '../DATA'
 set st = '200712311500'
# set en = '200712312330'
set en = '201212312330'

set wgrib2 = ' ~/util/WGRIB2_from_NOAA/grib2/wgrib2/wgrib2'
set OUT2DIR = '../DATA_DEC'

mkdir $OUTDIR
mkdir $OUT2DIR

echo "HOURSHIFT start"
gfortran -o generator generator.f90
gfortran -o  z2jst2 z2jst2.f90

#echo  `./generator $1 $2 30`
 echo ./generator $st $en 30


foreach t ( `./generator $st $en 30` )
echo  $t `./z2jst2 $t`

set tmp = `./z2jst2 $t`

# ln -s ../DATA2011/**/**/**/*$t*0*int*bin ../DATA2011/$tmp
# ../prec_anal_data/Z__C_RJTD_20090309110000_SRF_GPV_Ggis1km_Prr60lv_ANAL_grib2.bin

ln -s ../prec_anal_data/Z__C_RJTD_${t}*bin $OUTDIR/$tmp

end

# HDD will overflow
#
# foreach t ( $OUTDIR/2* )
#
# echo $t
# $wgrib2 $t -no_header -bin $t.bin
#
# end
