#!/bin/ksh +x
#
if [ "${1}" = "-h" ]
then
  echo " "
  echo " Reads 5 Netcdf files: 1 - zonal wind ;  2 - meridional wind ; 3 - temperature ;"
  echo " 4 - specific humidity and 5 - geopotential height. Then generates a single"
  echo " binary file with these five variables for the RainRs case"
  echo " "
  echo " Usage:"
  echo " ./run_RainRs caso"
  echo " "
  echo " Default:"
  echo " caso = MONAN"
  echo " "
  echo " caso : five letters case identifier"
  echo " "
  exit
fi
#
caso=${1}
if [ -z "${caso}" ]
then
  caso=MONAN
fi
if [ ${caso} != "MONAN" ]
then
  if [ ${caso} != "ERA_5" ]
  then
    if [ ${caso} != "CSFV2" ]
    then
      if [ ${caso} != "NCEPF" ]
      then
        caso=MONAN
      fi
    fi
  fi
fi
#
if [ ${caso} = "MONAN" ]
then
#
  ep=1
  while [ ep -le 12 ]
  do
    echo "./Run_Netcdf ${caso} ${ep} RainRS no .TRUE."
    ./Run_Netcdf ${caso} ${ep} RainRS no .TRUE.
    let ep=ep+1
  done
  ep=16
  while [ ep -le 27 ]
  do
    echo "./Run_Netcdf ${caso} ${ep} RainRS no .TRUE."
    ./Run_Netcdf ${caso} ${ep} RainRS no .TRUE.
  let ep=ep+1
  done
#
else
#
ep=1
while [ ep -le 15 ]
do
  echo "./Run_Netcdf ${caso} ${ep} RainRS no .TRUE."
  ./Run_Netcdf ${caso} ${ep} RainRS no .TRUE.
  let ep=ep+1
done
#
fi
#
