Modifying Filename Template in Example.conf
Modifying Filename Template in Example.confFilename Template Settings in METplus
METplus configuration variables that control filename templates are described in the Directory and Filename Template Info section of the System Configuration chapter in the METplus User's Guide. The Example wrapper is a good tool to help understand how these settings control what is run by the METplus wrappers.
- List the sample available in the ${METPLUS_DATA} directory
ls ${METPLUS_DATA}/met_test/data/sample_fcst/2007033000/
The output should list:
nam.t00z.awip1236.tm00.20070330.grb
Think about what is constant and what may change routinely:
nam.t00z.awip1236.tm00.20070330.grb
This translates into nam.t{init?fmt=%2H}z.awip1236.tm00.{init?fmt=%Y%m%d}.grib, We will use this in this next exercise.
- Copy the Example_timing.conf configuration file in your user_config directory, renaming it Example_filename.conf
cp ${METPLUS_TUTORIAL_DIR}/user_config/Example_timing.conf \
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf
- Open the new Example_filename.conf file with an editor.
vi ${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf
- Make the following changes:
4a. Change EXAMPLE_INPUT_DIR:
EXAMPLE_INPUT_DIR = /dir/containing/example/data
to:
EXAMPLE_INPUT_DIR = {INPUT_BASE}/met_test/data/sample_fcst
4b. Change EXAMPLE_INPUT_TEMPLATE:
EXAMPLE_INPUT_TEMPLATE = {init?fmt=%Y%m%d}/file_{init?fmt=%Y%m%d}_{init?fmt=%2H}_F{lead?fmt=%3H}.{custom?fmt=%s}
to:
EXAMPLE_INPUT_TEMPLATE = nam.t{init?fmt=%2H}z.awip1236.tm00.{init?fmt=%Y%m%d}.grib
- Call the run_metplus.py script again, this time passing in the Example_timing.conf configuration file and the tutorial.conf configuration file. You should see logs output to the screen.
run_metplus.py \
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf
- Review the screen output and/or log file output.
INFO: Looking in input directory for file: nam.t09z.awip1236.tm00.20220118.grib
...
INFO: Looking in input directory for file: nam.t15z.awip1236.tm00.20220118.grib
...
INFO: Looking in input directory for file: nam.t15z.awip1236.tm00.20220118.grib
Note that none of the files listed are the one listed in Step 1 (nam.t00z.awip1236.tm00.20070330.grb). You will need to make additional modifications to Example.conf to direct METplus to look for the correct file.
- Open the new Example_filename.conf file with an editor.
vi ${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf
- Make the following changes:
8a. Change INIT_BEG and INIT_END:
INIT_BEG = 2022011809
INIT_END = 2022011815
INIT_END = 2022011815
to:
INIT_BEG = 2007033000
INIT_END = 2007033000
INIT_END = 2007033000
- Call the run_metplus.py script again, passing in the modified Example_timing.conf configuration file and the tutorial.conf configuration file. You should see logs output to the screen.
run_metplus.py \
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf
${METPLUS_TUTORIAL_DIR}/user_config/Example_filename.conf \
${METPLUS_TUTORIAL_DIR}/tutorial.conf
- Review the screen output and/or log file output. It appears it is now looking for the right file.
INFO: Looking in input directory for file: nam.t00z.awip1236.tm00.20070330.grib