METplus: User Configuration Settings

METplus: User Configuration Settings

Modify your Tutorial/User conf files

In this section you will modify the configuration files that will be read for each call to METplus.

The paths in this practical session guide assume:

  • You have created a user_config directory in your ${METPLUS_TUTORIAL_DIR} directory
  • You have added the shared METplus ush directory to your PATH (done in the Tutorial Setup script)
  • You are using the shared installation of MET.

If not, then you need to adjust accordingly.

  1. Change to the ${METPLUS_TUTORIAL_DIR} directory.  Try running run_metplus.py. You should see the usage statement output to the screen.
cd ${METPLUS_TUTORIAL_DIR};
run_metplus.py
The METplus python script run_metplus.py can be run from anywhere, but for consistency, we will change to ${METPLUS_TUTORIAL_DIR} so that all the directories including user_config and output are below the working directory.
  1. Now try to pass in the example.conf configuration file found in your parm directory under use_cases/met_tool_wrapper/Examples tutorial.conf
run_metplus.py \
${METPLUS_BUILD_BASE}/parm/use_cases/met_tool_wrapper/Example/Example.conf

You should see output like this:

Running METplus 5.0.1

Starting METplus v5.0.1

12/15 19:53:06.223 metplus (config_metplus.py:102) INFO: Starting METplus configuration setup.
12/15 19:53:06.225 metplus (config_metplus.py:230) INFO: Parsing config file: /var/autofs/mnt/linux-amd64/debian/buster/local/METplus-5.0.1/parm/metplus_config/defaults.conf
12/15 19:53:06.226 metplus (config_metplus.py:230) INFO: Parsing config file: /var/autofs/mnt/linux-amd64/debian/buster/local/METplus-5.0.1/parm/use_cases/met_tool_wrapper/Example/Example.conf
Traceback (most recent call last):
  File "/usr/local/METplus-5.0.1/ush/run_metplus.py", line 128, in <module>
    main()
  File "/usr/local/METplus-5.0.1/ush/run_metplus.py", line 44, in main
    config = pre_run_setup(config_inputs)
  File "/usr/local/METplus-5.0.1/metplus/util/run_util.py", line 23, in pre_run_setup
    config = setup(config_inputs)
  File "/usr/local/METplus-5.0.1/metplus/util/config_metplus.py", line 108, in setup
    config = launch(override_list)
  File "/usr/local/METplus-5.0.1/metplus/util/config_metplus.py", line 256, in launch
    mkdir_p(config.getdir('OUTPUT_BASE'))
  File "/usr/local/METplus-5.0.1/metplus/util/config_metplus.py", line 693, in getdir
    raise ValueError(f"{dir_name} cannot be set to "
ValueError: OUTPUT_BASE cannot be set to or contain '/path/to'

ERROR: run_metplus  failed: OUTPUT_BASE cannot be set to or contain '/path/to'

 

Note it ends with an error message stating that OUTPUT_BASE was not set correctly. You will need to configure the METplus wrappers to be able to run a use case.

The values in defaults.conf are read in first when you run run_metplus.py. The settings in these files can be overridden in the use case conf files and/or a user's custom configuration file.

Some variables in the system conf are set to '/path/to' and must be overridden to run METplus, such as OUTPUT_BASE in defaults.conf.

  1. View the defaults.conf file and notice how OUTPUT_BASE = /path/to . This implies it is REQUIRED to be overridden to a valid path.
less ${METPLUS_BUILD_BASE}/parm/metplus_config/defaults.conf
Note: The default installation of METplus has /path/to values for MET_INSTALL_DIR and INPUT_BASE. The value for MET_INSTALL_DIR is set in the shared METplus configuration when it was installed. This was done because these settings will likely be set to the same values for all users. If METplus was installed on a machine that has sample input data available, the value for INPUT_BASE is often set to that directory as well.
  1. View the tutorial configuration files in your ${METPLUS_TUTORIAL_DIR} directory.
less ${METPLUS_TUTORIAL_DIR}/tutorial.conf

The INPUT_BASE, OUTPUT_BASE, and MET_INSTALL_DIR variables must all be set to run METplus. Since MET_INSTALL_DIR (and possibly INPUT_BASE) should already be set in the default METplus configuration file (completed on install of METplus), only OUTPUT_BASE is required to run. If INPUT_BASE is not set in the tutorial configuration file, it should be set correctly in the defaults configuration file.

Note: A METplus conf file is not a shell script. You CANNOT refer to environment variables as you would in a shell script or command prompt, i.e. ${HOME}. Instead, you must reference the environment variable $HOME as {ENV[HOME]}
You can create additional configuration files to be read by the METplus wrappers to override variables. If a variable is found in multiple configuration files that were passed to METplus, the value used will be the last one read in the sequence of configuration files. See the metplus_final.conf file in the output directory to see what values were actually used for a given METplus run.

We will test out using these configurations on the next page.

admin Mon, 06/24/2019 - 16:00