From 6a17d56f56c481b8619752ac199b1e8b66485f83 Mon Sep 17 00:00:00 2001 From: Lars Hoffmann Date: Thu, 6 Feb 2025 20:04:39 +0100 Subject: [PATCH] Update interoper_test. --- tests/interoper_test/run.sh | 103 ++++++++---------------------------- 1 file changed, 21 insertions(+), 82 deletions(-) diff --git a/tests/interoper_test/run.sh b/tests/interoper_test/run.sh index 79decdf582..81c750cb49 100755 --- a/tests/interoper_test/run.sh +++ b/tests/interoper_test/run.sh @@ -1,8 +1,13 @@ #! /bin/bash -# Testing components for better interoperable use between CLaMS and MPTRAC... +# Testing components for interoperable use between CLaMS and MPTRAC... +# ------------------------------------------------------------ # (1) Test reading and writing CLaMS position files... +# ------------------------------------------------------------ + +# Setup... +trac=../../src # Create directories... rm -rf data && mkdir -p data @@ -10,70 +15,20 @@ rm -rf data && mkdir -p data # Set environment... export LD_LIBRARY_PATH=../../libs/build/lib:$LD_LIBRARY_PATH -# Path to log files... -log=./data - -# Pathway to the application... -atm_conv=../../src/atm_conv - -# Path to the atmosphere data that containts air parcel positions... -atm_in=./data.ref/atm_input.tab - -# Path to the output atmosphere data... -atm_out_nc=./data/atm_output.nc - # Run the application... -echo "Test reading atm_type 0 data and write it to atm_type 4 data." -echo ${atm_conv} - ${atm_in} 0 ${atm_out_nc} 4 -${atm_conv} - ${atm_in} 0 ${atm_out_nc} 4 >> ${log}/log_0to4.txt - -# Path to the atmosphere data that containts air parcel positions... -atm_in=${atm_out_nc} - -# Path to the output atmosphere data... -atm_out_tab=./data/atm_output.tab - -# Path to the reference... -atm_ref_tab=./data.ref/atm_output.tab - -# Run the application... -echo "Reading atmospheric data of atm_type 4 and write it as atm_type 0." -echo ${atm_conv} - ${atm_in} 4 ${atm_out_tab} 0 -${atm_conv} - ${atm_in} 4 ${atm_out_tab} 0 > ${log}/log_4to0.txt - -# Compare files... -error=0 -diff -q -s ${atm_out_tab} ${atm_ref_tab} +$trac/atm_conv - ./data.ref/atm_input.tab 0 ./data/atm_output.nc 4 +$trac/atm_conv - ./data/atm_output.nc 4 ./data/atm_output.tab 0 -if [ $? -ne 0 ]; then - error=1 - cat ${log}/log_0to4.txt - cat ${log}/log_4to0.txt - exit $error -fi - -rm ${atm_out_tab} ${atm_out_nc} ${log}/*.txt - -# (2) Test if the diabatic transport calculations have been changed... - -# directory of the trajectory code... -trac=../../src - -# directory of the reanalysis data... -metbase=../data/clams/erai_vlr - -# directory for the output... -output=./data - -# directory of the reference and init... -input=./data.ref/ +# ------------------------------------------------------------ +# (2) Test diabatic transport calculations... +# ------------------------------------------------------------ # start and end date t0=$(${trac}/time2jsec 2016 7 1 0 0 0 0) t1=$(${trac}/time2jsec 2016 7 1 6 0 0 0) # Create control parameter file... -cat > ${output}/trac.ctl < ./data/trac.ctl < ${output}/dirlist -$trac/trac ${output}/dirlist trac.ctl pos_glo_16070100.nc\ +# Calculate trajectories... +echo "./data" > ./data/dirlist +$trac/trac ./data/dirlist trac.ctl ../data.ref/init/pos_glo_16070100.nc \ ATM_BASENAME atm GRID_BASENAME grid \ TURB_MESOX 0 TURB_MESOZ 0 \ - TURB_DX_TROP 0 TURB_DZ_STRAT 0 \ - | tee ${output}/log_trac_diff.txt - -error=0 - -diff -q -s ${input}/diabatic/atm_2016_07_01_00_00.tab ${output}/atm_2016_07_01_00_00.tab -diff -q -s ${input}/diabatic/atm_2016_07_01_06_00.tab ${output}/atm_2016_07_01_06_00.tab - -if [ $? -ne 0 ]; then - error=1 - cat ${output}/log_trac_diff.txt - exit ${error} -fi - -rm ${output}/pos_glo_16070100.nc -rm ${output}/trac.ctl -rm ${output}/log_trac_diff.txt -rm ${output}/dirlist -rm ${output}/*.tab + TURB_DX_TROP 0 TURB_DZ_STRAT 0 +# Compare files... +diff -q -s ./data.ref/atm_output.tab ./data/atm_output.tab || error=1 +diff -q -s ./data.ref/diabatic/atm_2016_07_01_00_00.tab ./data/atm_2016_07_01_00_00.tab || error=1 +diff -q -s ./data.ref/diabatic/atm_2016_07_01_06_00.tab ./data/atm_2016_07_01_06_00.tab || error=1 exit ${error}