METplus Practical Session Guide (July 2019) | Session 1: METplus Setup/Grid-to-Grid > End of Practical Session 1: Additional Exercises

Congratulations! You have completed Session 1!

If you have extra time, you may want to try these additional MET exercises:

  • Run Gen-Vx-Mask to create a mask for Eastern or Western United States using the polyline files in the data/poly directory. Re-run Grid-Stat using the output of Gen-Vx-Mask.
  • Run Gen-Vx-Mask to exercise all the other masking types available.
  • Reconfigure and re-run Grid-Stat with the fourier dictionary defined and the grad output line type enabled.

If you have extra time, you may want to try these additional METplus exercises. The answers are found on the next page.

EXERCISE 1.1: add_rh - Add another field to grid_stat

Instructions: Modify the METplus configuration files to add relative humidity (RH) at pressure levels 500 and 250 (P500 and P250) to the output.

  1. Copy your custom configuration file and rename it to mycustom.add_rh.conf for this exercise.
cd ${METPLUS_PARM_BASE}/user_config
cp g2g.output.conf g2g.add_rh.conf

 

  1. Open anom.conf to remind yourself how fields are defined in METplus
less ${METPLUS_PARM_BASE}/use_cases/grid_to_grid/examples/anom.conf

 

  1. Open g2g.add_rh.conf with an editor and add the extra information.
vi ${METPLUS_PARM_BASE}/user_config/g2g.add_rh.conf

Hint: The variables that you need to add must go under the [config] section.

You should also change OUTPUT_BASE to a new location so you can keep it separate from the other runs.

[dir]
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/exercises/add_rh

 

  1. Rerun master_metplus passing in your new custom config file for this exercise
master_metplus.py -c use_cases/grid_to_grid/examples/anom.conf -c user_config/g2g.add_rh.conf
You should see the relative humidity field appear in the log output from grid_stat.
less ${METPLUS_TUTORIAL_DIR}/output/exercises/add_rh/logs/master_metplus.log.`date +%Y%m%d`

Look for:

DEBUG 2: Processing RH/P500 versus RH/P500, for smoothing method NEAREST(1), over region FULL, using 10512 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P500 versus RH/P500, for smoothing method NEAREST(1), over region NHX, using 3600 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P500 versus RH/P500, for smoothing method NEAREST(1), over region SHX, using 3600 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P500 versus RH/P500, for smoothing method NEAREST(1), over region TRO, using 2448 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P500 versus RH/P500, for smoothing method NEAREST(1), over region PNA, using 1311 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 1: Regridding field RH/P250 to the verification grid.
DEBUG 1: Regridding field RH/P250 to the verification grid.
DEBUG 2:
DEBUG 2: --------------------------------------------------------------------------------
DEBUG 2:
DEBUG 2: Processing RH/P250 versus RH/P250, for smoothing method NEAREST(1), over region FULL, using 10512 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P250 versus RH/P250, for smoothing method NEAREST(1), over region NHX, using 3600 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P250 versus RH/P250, for smoothing method NEAREST(1), over region SHX, using 3600 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P250 versus RH/P250, for smoothing method NEAREST(1), over region TRO, using 2448 pairs.
DEBUG 2: Computing Scalar Partial Sums.
DEBUG 2: Processing RH/P250 versus RH/P250, for smoothing method NEAREST(1), over region PNA, using 1311 pairs.
DEBUG 2: Computing Scalar Partial Sums.
Go to the next page for the solution to see if you were right!

EXERCISE 1.2: log_boost - Change the Logging Settings

Instructions: Modify the METplus configuration files to change the logging settings to see what is available.

  1. Create a new custom configuration file and name log_boost.conf for this exercise.
cd ${METPLUS_PARM_BASE}/user_config
touch log_boost.conf

 

  1. Open log_boost.conf with an editor and add extra information as desired.
vi log_boost.conf

Change OUTPUT_BASE to a new location so you can keep it separate from the other runs.

[dir]
OUTPUT_BASE = {ENV[METPLUS_TUTORIAL_DIR]}/output/exercises/log_boost

The sections at the bottom of this page describe different logging configurations you can change. Play around with changing these settings and see how it affects the log output.

 

  1. Rerun master_metplus passing in your new custom config file for this exercise
master_metplus.py -c use_cases/grid_to_grid/examples/anom.conf -c user_config/log_boost.conf

 

  1. Review the log output to see how things have changed from these settings
ls ${METPLUS_TUTORIAL_DIR}/output/exercises/log_boost/logs

 

  1. Review metplus_config/metplus_logging.conf to see other logging configurations you can change and test them out!
less ${METPLUS_PARM_BASE}/metplus_config/metplus_logging.conf
For example, override LOG_METPLUS and add more text to the filename (or even use another METplus config variable).

Log Configurations

Separate METplus Logs from MET Logs

Setting [config] LOG_MET_OUTPUT_TO_METPLUS to no will create a separate log file for each MET application.

[config]
LOG_MET_OUTPUT_TO_METPLUS = no

For this use case, two log files will be created: master_metplus.log.YYYYMMDD and grid_stat.log_YYYYMMDD

Increase Log Output Level for MET Applications

Setting [config] LOG_MET_VERBOSITY to a number between 1 and 5 will change the logging level for the MET applications logs. Increasing the number results in more log output. The default value is 2.

[config]
LOG_MET_VERBOSITY = 5

Increase Log Output Level for METplus Wrappers

Setting [config] LOG_LEVEL will change the logging level for the METplus Wrapper logs. Valid values are NOTSET, DEBUG, INFO, WARNING, ERROR, CRITICAL. Logs will contain all information of the desired logging level and higher. The default value is DEBUG.

[config]
LOG_LEVEL = DEBUG

One approach to logging configuration would be to set the LOG_LEVEL to INFO in the base configuration file (metplus_config/metplus_logging.conf) and pass in  user_config/log_boost.conf when rerunning after an error occurs.

Use Time of Data Instead of Current Time

Setting LOG_TIMESTAMP_USE_DATATIME to yes will use the first time of your data instead of the current time.

[config]
LOG_TIMESTAMP_USE_DATATIME = yes

For this use case, VALID_BEG = 2017061300, so the log files will have the format: master_metplus.log.20170613 instead of using today's date

Change Format of Time in Logfile Names

Setting LOG_TIMESTAMP_TEMPLATE to %Y%m%d%H%M will add hour and minute to the log file time. The default value is %Y%m%d which results in the format YYYYMMDD.

[config]
LOG_TIMESTAMP = %Y%m%d%H%M;

For this use case, the log files will have the format: master_metplus.log.YYYYMMDDHH