#! /bin/bash
#
# Bill Barrett
#
# January 2021
#
# Notes: 

# make sure that user is aimsds
userName=`whoami`
if [ ${userName}  != "aimpro" ]
    then
    echo
    echo "Must be logged in as aimpro"
    echo
    exit 1
fi

source /aim/sds/common/scripts/setup_science_data_system.sh

# Set up the AIM CIPS oracle test environment
#oracle_test=/aim3/user_data/aimpro/aim_cips_oracle
#export aimsds=$oracle_test/sds
export IDL_PATH=\<IDL_DEFAULT\>:+/aim/sds/cips:\
+/aim/sds/common:\
+/aim/sds/test:\
+/data_systems/tools/idl_libraries/datetime:+/data_systems/tools/idl_libraries/misc:\
+/data_systems/tools/IdlDbInterface/idl:+/data_systems/tools/idl_libraries/math

file_date=`date +%Y_%j`
logFile="/aim/sds/test/cips_day_${file_date}_level_1a_offline.txt"
#scp -p /aim/sds/common/input_data/tle/* $aimsds/common/input_data/tle  | tee -a ${logFile}
#scp -p /aim/sds/common/input_data/sc_offset.dat $aimsds/common/input_data/ | tee -a ${logFile}

echo "aimds = $aimsds"
echo "logfile = $logFile"
echo $IDL_PATH
#exit 0

# Try to update the orbit list,
# writing the relevant information to the logfile
idl -e 'level_1a_test_driver' 2>&1 | \
  grep -v "Compiled module" | \
  grep -v "Installation number" | \
  grep -v "Licensed for use" | tee -a ${logFile}

exit 0
# Done
