#!/bin/ksh +x
#
if [ "${1}" = "-h" ]
then
  echo " "
  echo " Performs the Vertical Modal Decomposition and Generate Files with"
  echo " Modal Vertical Energy and Normalized Zonal Wind, Meridional Wind"
  echo " and Geopotential Height for the Triplet Case"
  echo " "
  echo " Usage:"
  echo " ./run_Triplet caso [Mmax]"
  echo " "
  echo " Default:"
  echo " caso = CFSR1 ; Mmax = 126"
  echo " "
  echo " caso : five letters case identifier"
  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
  Mmax=126
else
  Mmax=${2}
fi
ep=309
while [ ep -le 485 ]
do
  echo "./Run_VDecomp ${caso} ${ep} Triplet no"
  ./Run_VDecomp ${caso} ${ep} Triplet no ${Mmax}
  let ep=ep+1
done
#
