Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
executable file 73 lines (58 sloc) 2.18 KB
#!/usr/bin/env bash
### Run simple tests to verify viirs2awips will run properly ###
# Should be renamed in the corresponding test tarball
oops() {
echo "OOPS: $*"
echo "FAILURE"
exit 1
run_test() {
echo "Running test for data in $2..." -g $1 $2
if [ $? -ne 0 ]; then
echo "ERROR: did not complete test $2 successfully"
echo "ERROR: Won't remove test directory, check it for more information"
echo "FAILURE"
exit 2
# Setup viirs2awips environment
if [ -z "$POLAR2GRID_HOME" ]; then
oops "POLAR2GRID_HOME needs to be defined"
source $POLAR2GRID_HOME/bin/
# Find out where the tests are relative to this script
TEST_BASE="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Base directory for all test cases is $TEST_BASE"
# Make sure we can call before making any test directories
which || oops " is not in PATH"
# Check if they specified a different working directory
if [ $# -ne 1 ]; then
echo "Will use $1 directory, but won't delete it"
echo "Making temporary test directory $WORK_DIR"
mkdir -p $WORK_DIR || oops "Could not create test directory '$WORK_DIR'"
# Run tests for each test data directory in the base directory
for DDIR in $TEST_BASE/*; do
if [ -d $DDIR ] && [ `basename $DDIR` != "verify" ]; then
# Make a unique working test directory
TDIR=`basename $DDIR`-$$
echo "Making temporary working directory $TDIR"
mkdir -p $TDIR || oops "Couldn't make $TDIR test directory"
pushd $TDIR
run_test 203 $DDIR
# Move all NetCDF files here
mv SSEC_AWIPS_VIIRS-* ../ || oops "No NC files created for $DDIR in $TDIR"
echo "Removing test dir $TDIR"
rm -r $TDIR || oops "Couldn't remove $TDIR test directory"
# Generate NC product images
$POLAR2GRID_HOME/ShellB3/bin/python -m polar2grid.plot_ncdata --vmin=0 --vmax=255 || oops "Could not generate png images from NC files.\n\tNC files were still created however."
# End of all tests
echo "SUCCESS"
Something went wrong with that request. Please try again.