Introduction
This document describes how to create a functional or acceptance testcase for LIS 7. The testcase should contain everything needed to reproduce the testcase output. The testcase for the NAM 242 forcing reader will be used in this guide as an example. When creating your testcase, replace nam242forcingtest with the name of your case where applicable.
The rest of this document will guide the reader through the creation of the following files:
1 |
|
Provides a high-level description of the testcase itself as well as instructions for running the testcase. |
|---|---|---|
2 |
|
The configuration file used to run LDT to produce the input domain and parameter file for LIS (e.g., |
3 |
|
A GrADS descriptor file used to display the input parameter file (e.g., |
4 |
|
The configuration file used to run LIS. |
5 |
|
A configuration file used by LIS to set the output for the test-case. |
6 |
|
A GrADS descriptor file used to display the output from the LIS run. |
7 |
|
A GrADS descriptor file used to display the target output contained in the output tar file (e.g., |
8 |
|
The LDT tar file contains all the files needed to run LDT to produce the input domain and parameter file for LIS (e.g., |
9 |
|
The input tar file contains all the files needed to run LIS. |
10 |
|
The output tar file contains target output for the testcase (i.e., what LIS should produce when the testcase is run). |
Files 1 though 7 are stored with the LISF source code repository on GitHub (see lis/testcases/metforcing/nam242 for example). Files 8, 9, and 10 are stored on our data portal server.
|
Creating a Testcase
A testcase is created in four steps:
-
Create the
READMEfile -
Create the LDT tar file (e.g.,
nam242forcingtest_ldt_v72.tar.gz). -
Create the INPUT tar file (e.g.,
nam242forcingtest_input_v72.tar.gz). -
Create the OUTPUT tar file (e.g.,
nam242forcingtest_output_v72.tar.gz).
|
These testcases may be run on systems other than discover so it must be self-contained. For example, the config files should not refer to |
|
Please do NOT commit the LDT, input, and output tar.gz files into the LISF repository. These files are too large to store in a GitHub repository and will be stored on our data portal instead. |
Before continuing with Step 1, create a clean working directory in which to build the testcase. In the steps that follow, you will create new files and sub-directories within this parent directory.
Step 1: Create the README file
Create a file named README and add a high-level description of the testcase, instructions for running the testcase, and any additional notes (i.e., citations, links, data format information). This file will be saved in the LISF source code repository in the appropriate testcases sub-directory. See the NAM 242 testcase README for an example.
Step 2: Create the LDT tar file
In this step you will organize all the files needed by LDT to reproduce the lis_input.d01.nc domain and parameter file.
-
Create a clean working directory for this step and change directories into it.
-
Create the
ldt.configfile as appropriate for your testcase. If you have already created yourldt.configfile, create a copy here.A copy of this
ldt.configfile will be saved in the LISF source code repository in the appropriate testcases sub-directory. -
Create a directory named
inputand place all input files listed in theldt.configfile into it. For example:% ls input input/LS_PARAMETERS/UMD/25KM/landcover_UMD.1gd4r input/LS_PARAMETERS/UMD/25KM/landmask_UMD.1gd4r input/LS_PARAMETERS/UMD/25KM/elev_GTOPO30.1gd4r input/LS_PARAMETERS/metforcing_parms/NAM/terrain.242.grb
To reduce the filesize of the tar file created in this step, the inputdirectory should contain only the files necessary for the LDT run. Do not include files associated with options that are disabled in theldt.configfile. For large forcing datasets, only include the subset of files necessary for the temporal domain of the testcase. -
Verify that the filepaths listed in your
ldt.configfile match the file locations in the newinputdirectory. Update the filepaths if necessary. -
Run LDT to produce the input domain and parameter file for LIS (e.g.,
lis_input.d01.nc). Verify that the output is as expected. -
Create an
input.ctlGrADS descriptor file for viewing the input parameter file. A copy of this file will be saved in the LISF source code repository in the appropriate testcases sub-directory. -
Copy the input domain and parameter file to
lis_input_testcase.d01.ncand rename the log file created by the LDT run toldtlog_testcase.0000. -
Create the LDT tar file, then gzip it (replacing
nam242forcingtestwith the name of your testcase):% tar cf nam242forcingtest_ldt_v72.tar ldtlog_testcase.0000 \ lis_input_testcase.d01.nc \ input % gzip nam242forcingtest_ldt_v72.tarIt should now be safe to delete the
inputdirectory created in this step.
Your working directory for this step should now contain the following files:
-
ldt.config -
input.ctl -
nam242forcingtest_ldt_v72.tar.gz
Change into the parent directory and proceed to Step 3.
Step 3: Create the input tar file
In this step you will organize the input data used in the LIS run.
-
Create a clean working directory for this step and change directories into it.
-
Copy the input domain and parameter file (e.g.,
lis_input.d01.nc) from Step 2. -
Create an
inputdirectory and copy all required input files listed into it, including any parameter files that are not processed by LDT. Note that you must create aninput/forcing_variables.txtfile that specifies which forcing variables are needed by LIS for this testcase.% ls input input/forcing_variables.txt input/MET_FORCING/NAM242/20120901/00/fh.0000_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120901/00/fh.0003_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120901/00/fh.0006_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120901/00/fh.0009_tl.press_gr.awp242 . . . input/MET_FORCING/NAM242/20120903/18/fh.0003_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120903/18/fh.0006_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120903/18/fh.0009_tl.press_gr.awp242 input/MET_FORCING/NAM242/20120903/18/fh.0012_tl.press_gr.awp242To reduce the filesize of the tar file created in this step, the inputdirectory should contain only the files necessary for the LIS run. For large forcing datasets, only include the subset of files necessary for the temporal domain of the testcase. -
Create the input tar file, then gzip it (replacing
nam242forcingtestwith the name of your testcase):% tar cf nam242forcingtest_input_v72.tar lis_input.d01.nc \ input % gzip nam242forcingtest_input_v72.tarDon’t delete the
inputdirectory just yet, as you may have to make adjustments in the next step.
Your working directory for this step should now contain the following files:
-
input/ -
nam242forcingtest_input_v72.tar.gz
Change into the parent directory and proceed to Step 4.
Step 4: Create the output tar file
In this step you will organize the target output files that the output of test runs can be checked against.
-
Create a clean working directory for this step and change directories into it.
-
Create the
lis.configfile andMODEL_OUTPUT_LIST.TBLfile as appropriate for your testcase (or copy them here if they already exist). Copies of these two files will be saved in the LISF source code repository in the appropriate testcases sub-directory. -
Copy and unpack the
nam242forcingtest_input_v72.tar.gzfile created in Step 3.% gzip -dc nam242forcingtest_input_v72.tar.gz | tar xf -
-
Run LIS and verify that the output is as expected. If the run halts due to missing data, revisit Step 3.
-
Create an
output.ctlGrADS descriptor file for viewing the output data. A copy of this file will be saved in the LISF source code repository in the appropriate testcases sub-directory. -
Rename the
OUTPUTdirectory toTARGET_OUTPUTand move alllislog.00*files into it.TARGET_OUTPUTshould now contain all files generated by the LIS run. For example:% ls TARGET_OUTPUT lislog.0000 SURFACEMODEL SURFACEMODEL.d01.stats
-
Create a
testcase.ctlGrADS descriptor file for viewing the target output data in theTARGET_OUTPUTdirectory. A copy of this file will be saved in the LISF source code repository in the appropriate testcases sub-directory. -
Create the output tar file, then gzip it (replacing
nam242forcingtestwith the name of your testcase):% tar cf nam242forcingtest_output_v72.tar TARGET_OUTPUT % gzip nam242forcingtest_output_v72.tar
Your working directory for this step should now contain the following files:
-
TARGET_OUTPUT/ -
output.ctl -
testcase.ctl -
nam242forcingtest_output_v72.tar.gz
Change directories into the parent directory containing the README file.
Finishing Up
You can now move all the files listed in the table at the top of this document out of their respective sub-directories and into this directory. Change permissions on the files in this directory to enable read access (e.g., chmod 755 *). If the testcase files are associated with a Pull Request, include the filepath to this directory in a comment. Otherwise, contact Brendan McAndrew and Jim Geiger about adding the testcase to the internal test suite.