Skip to content

Commit

Permalink
Add consistency test for new functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGayno-NOAA committed Jan 9, 2023
1 parent a5a9fe6 commit 01efea0
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 5 deletions.
19 changes: 14 additions & 5 deletions reg_tests/grid_gen/driver.orion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,36 @@ TEST3=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_
-o $LOG_FILE3 -e $LOG_FILE3 ./gfdl.regional.sh)

#-----------------------------------------------------------------------------
# ESG regional grid
# ESG regional grid (output dominate soil/vegetation type).
#-----------------------------------------------------------------------------

LOG_FILE4=${LOG_FILE}04
TEST4=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J esg.regional \
-o $LOG_FILE4 -e $LOG_FILE4 ./esg.regional.sh)

#-----------------------------------------------------------------------------
# Regional grid with GSL gravity wave drag fields.
# ESG regional grid (output percent of each soil and vegetation type and
# the dominate category).
#-----------------------------------------------------------------------------

LOG_FILE5=${LOG_FILE}05
TEST5=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J reg.gsl.gwd \
-o $LOG_FILE5 -e $LOG_FILE5 ./regional.gsl.gwd.sh)
TEST5=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J esg.regional.pct.cat \
-o $LOG_FILE5 -e $LOG_FILE5 ./esg.regional.pct.cat.sh)

#-----------------------------------------------------------------------------
# Regional grid with GSL gravity wave drag fields.
#-----------------------------------------------------------------------------

LOG_FILE6=${LOG_FILE}06
TEST6=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J reg.gsl.gwd \
-o $LOG_FILE6 -e $LOG_FILE6 ./regional.gsl.gwd.sh)

#-----------------------------------------------------------------------------
# Create summary log.
#-----------------------------------------------------------------------------

sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \
-q $QUEUE -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5 << EOF
-q $QUEUE -d afterok:$TEST1:$TEST2:$TEST3:$TEST4:$TEST5:$TEST6 << EOF
#!/bin/bash
grep -a '<<<' ${LOG_FILE}* > $SUM_FILE
EOF
75 changes: 75 additions & 0 deletions reg_tests/grid_gen/esg.regional.pct.cat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

#-----------------------------------------------------------------------
# Create a regional esg grid. Output dominate soil and vegetation
# categories and well as the percentage of each category.
# Compare output to a set of baseline files using the 'nccmp'
# utility. This script is run by the machine specific driver script.
#-----------------------------------------------------------------------

set -x

TEST_NAME="esg.regional.pct.cat"
export TEMP_DIR=${WORK_DIR}/${TEST_NAME}.work
export out_dir=${WORK_DIR}/${TEST_NAME}

export gtype=regional_esg
export target_lon=-97.5 # Center longitude of the highest resolution tile
export target_lat=35.5 # Center latitude of the highest resolution tile
export idim=1301 # Dimension of grid in 'i' direction
export jdim=600 # Dimension of grid in 'j' direction
export delx=0.0145 # Grid spacing in degrees in 'i' direction
export dely=0.0145 # Grid spacing in degrees in 'j' direction
export halo=3
export vegsoilt_frac=.true. # Output dominate soil/veg categories as well
# as the percentage of each category.

NCCMP=${NCCMP:-$(which nccmp)}

#-----------------------------------------------------------------------
# Start script.
#-----------------------------------------------------------------------

echo "Starting at: " `date`

$home_dir/ush/fv3gfs_driver_grid.sh

iret=$?
if [ $iret -ne 0 ]; then
set +x
echo "<<< ESG REGIONAL PERCENT CATEGORY TEST FAILED. <<<"
exit $iret
fi

echo "Ending at: " `date`

#-----------------------------------------------------------------------------
# Compare output to baseline set of data.
#-----------------------------------------------------------------------------

cd $out_dir/C3113

test_failed=0
for files in *tile*.nc ./fix_sfc/*tile*.nc
do
if [ -f $files ]; then
echo CHECK $files
$NCCMP -dmfqS $files $HOMEreg/${TEST_NAME}/$files
iret=$?
if [ $iret -ne 0 ]; then
test_failed=1
fi
fi
done

set +x
if [ $test_failed -ne 0 ]; then
echo "<<< ESG REGIONAL PERCENT CATEGORY TEST FAILED. >>>"
if [ "$UPDATE_BASELINE" = "TRUE" ]; then
$home_dir/reg_tests/update_baseline.sh "${HOMEreg}/.." "${TEST_NAME}" $commit_num
fi
else
echo "<<< ESG REGIONAL PERCENT CATEGORY TEST PASSED. >>>"
fi

exit 0

0 comments on commit 01efea0

Please sign in to comment.