Skip to content

Commit

Permalink
Feature 1546 unit_tests (#2021)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway authored Jan 24, 2022
1 parent 7c18231 commit 333419c
Show file tree
Hide file tree
Showing 54 changed files with 234 additions and 252 deletions.
7 changes: 6 additions & 1 deletion test/bin/unit_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ else
echo "export MET_TEST_OUTPUT=${MET_TEST_OUTPUT}"
fi

# if MET_TEST_MET_PYTHON_EXE is not set, use default value
if [[ -z "${MET_TEST_MET_PYTHON_EXE}" ]] ; then
export MET_TEST_MET_PYTHON_EXE=/usr/local/python3/bin/python3
fi

PERL_UNIT_OPTS=""
for arg in $@; do
[ $arg == "-memchk" -o $arg == "memchk" ] && PERL_UNIT_OPTS="$PERL_UNIT_OPTS -memchk"
Expand Down Expand Up @@ -67,7 +72,7 @@ UNIT_XML="unit_ascii2nc.xml \
unit_shift_data_plane.xml \
unit_mtd.xml \
unit_climatology.xml \
unit_test_grib_tables.xml \
unit_grib_tables.xml \
unit_grid_weight.xml \
unit_netcdf.xml \
unit_hira.xml \
Expand Down
2 changes: 1 addition & 1 deletion test/config/PlotModeFieldConfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

plot_info = {

output_directory = "${MET_TEST_OUTPUT}/plot_mode_field";
output_directory = "${MET_TEST_OUTPUT}/mode_graphics";

size = 4;

Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_aeronet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_airnow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down
10 changes: 6 additions & 4 deletions test/xml/unit_ascii2nc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down Expand Up @@ -68,23 +70,23 @@
<exec>&MET_BIN;/ascii2nc</exec>
<param> \
&DATA_DIR_OBS;/ascii/qc_out_2012-09-07_00:00:00.GRM_P+FCST \
&OUTPUT_DIR;/ascii2nc/qc_out_2012-09-07_00:00:00.GRM_P+FCST.nc \
&OUTPUT_DIR;/ascii2nc/qc_out_2012-09-07_00:00:00.GRM_P_FCST.nc \
-v 1
</param>
<output>
<point_nc>&OUTPUT_DIR;/ascii2nc/qc_out_2012-09-07_00:00:00.GRM_P+FCST.nc</point_nc>
<point_nc>&OUTPUT_DIR;/ascii2nc/qc_out_2012-09-07_00:00:00.GRM_P_FCST.nc</point_nc>
</output>
</test>

<test name="ascii2nc_LITTLE_R_BAD_RECORD">
<exec>&MET_BIN;/ascii2nc</exec>
<param> \
&DATA_DIR_OBS;/ascii/OBS:2015080700_bad_record \
&OUTPUT_DIR;/ascii2nc/OBS:2015080700_bad_record.nc \
&OUTPUT_DIR;/ascii2nc/OBS_2015080700_bad_record.nc \
-v 1
</param>
<output>
<point_nc>&OUTPUT_DIR;/ascii2nc/OBS:2015080700_bad_record.nc</point_nc>
<point_nc>&OUTPUT_DIR;/ascii2nc/OBS_2015080700_bad_record.nc</point_nc>
</output>
</test>

Expand Down
3 changes: 2 additions & 1 deletion test/xml/unit_climatology.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
<!ENTITY DATA_DIR_CLIMO "&INPUT_DIR;/climatology_data">
]>

<!-- Requires: unit_pb2nc.xml -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
<exit_on_fail>true</exit_on_fail>

<!-- Depends on unit_pb2nc.xml -->
<test name="climatology_POINT_STAT_GFS_2.5DEG">
<exec>&MET_BIN;/point_stat</exec>
<env>
Expand Down
16 changes: 8 additions & 8 deletions test/xml/unit_duplicate_flag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<met_test>
<!-- Requires: unit_ascii2nc.xml -->

<!-- Depends on unit_ascii2nc to generate dup_test.nc obs file -->
<met_test>

<test_dir>&TEST_DIR;</test_dir>
<exit_on_fail>false</exit_on_fail>
Expand All @@ -27,11 +27,11 @@
&DATA_DIR_MODEL;/grib2/nam/nam_2012040900_F012.grib2 \
&OUTPUT_DIR;/ascii2nc/dup_test.nc \
&CONFIG_DIR;/PointStatConfig_dup \
-outdir &OUTPUT_DIR;/point_stat -v 3
-outdir &OUTPUT_DIR;/duplicate_flag -v 3
</param>
<output>
<stat>&OUTPUT_DIR;/point_stat/point_stat_DUP_NONE_120000L_20120409_120000V.stat</stat>
<stat>&OUTPUT_DIR;/point_stat/point_stat_DUP_NONE_120000L_20120409_120000V_mpr.txt</stat>
<stat>&OUTPUT_DIR;/duplicate_flag/point_stat_DUP_NONE_120000L_20120409_120000V.stat</stat>
<stat>&OUTPUT_DIR;/duplicate_flag/point_stat_DUP_NONE_120000L_20120409_120000V_mpr.txt</stat>
</output>
</test>

Expand All @@ -45,11 +45,11 @@
&DATA_DIR_MODEL;/grib2/nam/nam_2012040900_F012.grib2 \
&OUTPUT_DIR;/ascii2nc/dup_test.nc \
&CONFIG_DIR;/PointStatConfig_dup \
-outdir &OUTPUT_DIR;/point_stat -v 3
-outdir &OUTPUT_DIR;/duplicate_flag -v 3
</param>
<output>
<stat>&OUTPUT_DIR;/point_stat/point_stat_DUP_UNIQUE_120000L_20120409_120000V.stat</stat>
<stat>&OUTPUT_DIR;/point_stat/point_stat_DUP_UNIQUE_120000L_20120409_120000V_mpr.txt</stat>
<stat>&OUTPUT_DIR;/duplicate_flag/point_stat_DUP_UNIQUE_120000L_20120409_120000V.stat</stat>
<stat>&OUTPUT_DIR;/duplicate_flag/point_stat_DUP_UNIQUE_120000L_20120409_120000V_mpr.txt</stat>
</output>
</test>

Expand Down
25 changes: 13 additions & 12 deletions test/xml/unit_ensemble_stat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: unit_ascii2nc.xml -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand All @@ -18,7 +20,6 @@

<!-- -->
<!-- ensemble_stat -->
<!-- depends on unit_ascii2nc.xml -->
<!-- -->

<!-- Pass input ensemble files on the command line - one missing. -->
Expand Down Expand Up @@ -216,7 +217,7 @@

<!-- Add observation error perturbations. -->

<test name="ensemble_stat_OBS_ERROR">
<test name="ensemble_stat_OBSERR">
<exec>echo "&DATA_DIR_MODEL;/grib1/arw-fer-gep1/arw-fer-gep1_2012040912_F024.grib \
&DATA_DIR_MODEL;/grib1/arw-fer-gep5/arw-fer-gep5_2012040912_F024.grib \
&DATA_DIR_MODEL;/grib1/arw-sch-gep2/arw-sch-gep2_2012040912_F024.grib \
Expand All @@ -226,10 +227,10 @@
> &OUTPUT_DIR;/ensemble_stat/input_file_list; \
&MET_BIN;/ensemble_stat</exec>
<env>
<pair><name>DESC</name> <value>OBS_ERROR</value></pair>
<pair><name>DESC</name> <value>OBSERR</value></pair>
<pair><name>OBS_ERROR_FLAG</name> <value>TRUE</value></pair>
<pair><name>SKIP_CONST</name> <value>TRUE</value></pair>
<pair><name>OUTPUT_PREFIX</name> <value>OBS_ERROR</value></pair>
<pair><name>OUTPUT_PREFIX</name> <value>OBSERR</value></pair>
</env>
<param> \
&OUTPUT_DIR;/ensemble_stat/input_file_list \
Expand All @@ -239,14 +240,14 @@
-outdir &OUTPUT_DIR;/ensemble_stat -v 1
</param>
<output>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V.stat</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_ecnt.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_rhist.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_phist.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_orank.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_ssvar.txt</stat>
<grid_nc>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_ens.nc</grid_nc>
<grid_nc>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBS_ERROR_20120410_120000V_orank.nc</grid_nc>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V.stat</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_ecnt.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_rhist.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_phist.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_orank.txt</stat>
<stat>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_ssvar.txt</stat>
<grid_nc>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_ens.nc</grid_nc>
<grid_nc>&OUTPUT_DIR;/ensemble_stat/ensemble_stat_OBSERR_20120410_120000V_orank.nc</grid_nc>
</output>
</test>

Expand Down
3 changes: 2 additions & 1 deletion test/xml/unit_gaussian.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<!ENTITY DATA_DIR_GAUSS "&INPUT_DIR;/gaussian">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand All @@ -25,5 +27,4 @@
</output>
</test>


</met_test>
5 changes: 3 additions & 2 deletions test/xml/unit_gen_ens_prod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
<!ENTITY DATA_DIR_CLIMO "&INPUT_DIR;/climatology_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
<exit_on_fail>true</exit_on_fail>

<!-- -->
<!-- gen_ens_prod -->
<!-- no dependencies -->
<!-- -->

<!-- Use -ens twice to include the control as a member. -->
Expand Down Expand Up @@ -120,7 +121,7 @@
<param> \
-ens &DATA_DIR_MODEL;/grib2/gefs/enspost_grb2.t00z.prmsl \
-config &CONFIG_DIR;/GenEnsProdConfig_single_file_grib \
-ctrl &DATA_DIR_MODEL;/grib2/gefs/enspost_grb2.t00z.prmsl \
-ctrl &DATA_DIR_MODEL;/grib2/gefs/enspost_grb2.t00z.prmsl \
-out &OUTPUT_DIR;/gen_ens_prod/gen_ens_prod_SINGLE_FILE_GRIB_WITH_CTRL.nc \
-v 2
</param>
Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_gen_vx_mask.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

<!-- -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0"?>
<!DOCTYPE met_test [
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">
<!ENTITY MET_BIN "${MET_BASE}/../../bin">
<!ENTITY TEST_DIR "${MET_TEST_BASE}">
<!ENTITY INPUT_DIR "${MET_TEST_INPUT}">
<!ENTITY OUTPUT_DIR "${MET_TEST_OUTPUT}">

<!ENTITY CONFIG_DIR "&TEST_DIR;/config">
<!ENTITY DATA_DIR_MODEL "&INPUT_DIR;/model_data">
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>
<!ENTITY CONFIG_DIR "&TEST_DIR;/config">
<!ENTITY DATA_DIR_MODEL "&INPUT_DIR;/model_data">
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_grid_diag.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!ENTITY DATA_DIR_OBS "&INPUT_DIR;/obs_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_grid_stat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!ENTITY DATA_DIR_CLIMO "&INPUT_DIR;/climatology_data">
]>

<!-- Requires: unit_pcp_combine.xml -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down
2 changes: 2 additions & 0 deletions test/xml/unit_grid_weight.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<!ENTITY DATA_DIR_CLIMO "&INPUT_DIR;/climatology_data">
]>

<!-- Requires: None -->

<met_test>

<test_dir>&TEST_DIR;</test_dir>
Expand Down
Loading

0 comments on commit 333419c

Please sign in to comment.