#/usr/bin/ksh
#
# Script to examine effect of changing ropp_pp output from
#
# output_tdry
#
# to
#
# output_lev1a
# output_lev1b
# output_lev2a
#

TOOL=ropp_pp_invert_tool

#IFILE0=IT-PP-02.nc
IFILE0=IT-PP-02_prof1.nc


#0. Cntl: ROPP8.1 ropp_pp_invert
#-------------------------------

EXEC=/net/data/nwp1/idculv/ROPP/ropp_src/branches/dev/Share/ROPP81_prototype/ropp_pp/tools/$TOOL

IFILE=$IFILE0

MFILE=MSIS_coeff.nc

CFILE=grassaf_invert_cntl.cf

OFILE=`echo $IFILE0 |sed -es/'.nc'/'_cntl.nc'/`

TFILE=`echo $IFILE0 |sed -es/'.nc'/'_cntl.out'/`

echo "$EXEC  $IFILE  -o $OFILE  -mfile $MFILE  -c $CFILE  -m GMSIS  -d  > $TFILE 2>&1"
#      $EXEC  $IFILE  -o $OFILE  -mfile $MFILE  -c $CFILE  -m GMSIS  -d  > $TFILE 2>&1

echo "ncdump -h $OFILE > $(echo $OFILE |sed -es/'.nc'/'.nd'/) "
#      ncdump -h $OFILE > $(echo $OFILE |sed -es/'.nc'/'.nd'/)


#1. Test1: ROPP9.0 ropp_pp_invert
#--------------------------------

EXEC=/net/data/nwp1/idculv/ROPP/ropp_src/branches/dev/Share/ROPP90_prototype/ropp_pp/tools/$TOOL

IFILE=$IFILE0

MFILE=MSIS_coeff.nc

for i in 0 1 ; do
#i=0
for j in 0 1 ; do
#j=0
for k in 0 1 ; do
#k=0
for l in 0 1 ; do

CFILE=grassaf_invert_test1_${i}${j}${k}${l}.cf

OFILE=`echo $IFILE0 |sed -es/'.nc'/"_test1_${i}${j}${k}${l}.nc"/`

TFILE=`echo $IFILE0 |sed -es/'.nc'/"_test1_${i}${j}${k}${l}.out"/`

echo "$EXEC  $IFILE  -o $OFILE  -mfile $MFILE  -c $CFILE  -m GMSIS  -d  > $TFILE  2>&1"
      $EXEC  $IFILE  -o $OFILE  -mfile $MFILE  -c $CFILE  -m GMSIS  -d  > $TFILE  2>&1


echo "ncdump -h $OFILE > $(echo $OFILE |sed -es/'.nc'/'.nd'/) "
      ncdump -h $OFILE > $(echo $OFILE |sed -es/'.nc'/'.nd'/)

done
done
done
done
