#!/bin/ksh +x
#
if [ "${1}" = "-h" ]
then
  echo " "
  echo " Reads zonal wind, meridional wind, temperature, specific humidity and"
  echo " geopotential height of the CasoInp with KmaxInp pressure levels and"
  echo " interpolate/extrapolate Vertically to KmaxOut pressure levels of CasoOut"
  echo " into a file with zonal wind, meridional wind and geopotential height"
  echo " for the Triplet case"
  echo " "
  echo " Usage:"
  echo " ./run_Triplet caso [Kmax] [Mmax]"
  echo " "
  echo " Default:"
  echo " caso = CFSR1 ; Mmax = 126"
  echo " "
  echo " caso : five letters case identifier"
  echo " Kmax : number of pressure levels of caso"
  echo " Mmax : Rhomb+1 (even), Rhomb is the zonal wave truncation (Rhomb odd number)"
  echo "        is the total number of zonal waves plus the zonal mean (+1)"
  echo " "
  exit
fi
#
caso=${1}
if [ -z "${caso}" ]
then
  caso=CFSR1
fi
if [ ${caso} != "CFSR1" ]
then
  if [ ${caso} != "NCEPF" ]
  then
    caso=CFSR1
  fi
fi
if [ -z "${2}" ]
then
  Kmax=26
else
  Kmax=${2}
fi
if [ -z "${3}" ]
then
  Mmax=126
else
  Mmax=${3}
fi
ep=309
while [ ep -le 485 ]
do
  echo "./Run_GEUVZ ${caso} ${Kmax} ${ep} Triplet no .TRUE. ${Mmax}"
  ./Run_GEUVZ ${caso} ${Kmax} ${ep} Triplet no .TRUE. ${Mmax}
  let ep=ep+1
done
#
