 #!/bin/bash

# -----------------------------------------------------------
# RPC Project :
# Run RPC_curl_div_4sat : visualization of compute_curl_div_4sat.resu
# P. Robert, LPP, 2012-06-22
# -----------------------------------------------------------

appli=`basename $0`
appli36=`echo "$appli                                 " | cut -c1-36`
Narg=2
version=`RPC_version`

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
  then
  echo "$appli : visualization of compute_curl_div_4sat.resu"
  echo "$appli   require $Narg argument(s)"
  echo "    datiso1 datiso2 : iso date/time first and end"
  echo ""
   if test $hh = 1 ; then exit 0 ; fi
  echo " $appli36 : *** ERROR ! Command aborted." >&2
  exit 1
fi

datim1=`date +%F'  '%H':'%M':'%S `
julsec1=`date +%s`

echo " -------------------------------------------------------------------"
echo " Run of $appli :"

# remove RPC_ from RPC command

appli=`echo $appli | cut -c5-`

# --------------------------------------------------------------

# run IDL visu_vectime ; see IDL Command_line options for details

PS1=visu_mag_pos_4sat.ps
PS2=visu_curl_div_4sat.ps

if test -f $PS1 ; then rm $PS1 ; fi
if test -f $PS2 ; then rm $PS2 ; fi

echo $1 >  $appli.in
echo $2 >> $appli.in

# run appli.exe 

. run_appli.bash 
err=$?
if test $err != 0
   then exit $err
fi

# creation eventuelle du pdf,png, visu a l'ecran

run_options_visu.bash $PS1
run_options_visu.bash $PS2

datim2=`date +%F'  '%H':'%M':'%S `
julsec2=`date +%s`
diff=`expr $julsec2 - $julsec1`

diffm=`echo "scale=2; $diff/60." | bc `

echo ""
echo " Starting time $appli : $datim1"
echo " Ending   time $appli : $datim2"
echo " Duration      $appli : $diff sec.  ($diffm mn.)"

echo " -------------------------------------------------------------------"


