Note
Go to the end to download the full example code.
UserScript: Physics Tendency Vertical Profile plot
model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile.conf
Scientific Objective
To plot tendencies of temperature, moisture, and wind components averaged over a time window and spatial domain. Tendencies are partitioned into physics parameterizations and dynamics. Physics parameterizations include schemes like deep convection, convective gravity wave drag, short wave radiation, plantetary boundary layer, microphysics, and others. Non-physics tendencies (or dynamics) are due to horizontal and vertical motion. The residual (which should be zero) is the difference between the actual change in the state variable over the requested time window and the expected change due to physics parameterizations and dynamics tendencies. One can plot a single tendency component at multiple pressure levels or plot all tendency components at a single pressure level. This use case illustrates how to generate the vertical profile plot. The METplotpy source code is needed to generate the plot. Clone the METplotpy repository (https://github.com/dtcenter/METplotpy) under the same base directory as the METPLUS_BASE directory so that the METplus and METplotpy directories are under the same base directory (i.e. if the METPLUS_BASE directory is /home/username/working/METplus, then clone the METplotpy source code into the /home/username/working directory).
Version Added
METplus version 5.0
Datasets
Forecast: FV3 3-D history file with physics and dynamics tendencies
Grid specification: FV3 2-D grid specification file with latitude and longitude of each grid point
Mid-CONUS Shapefiles:
MID_CONUS.cpg
MID_CONUS.dbf
MID_CONUS.poly
MID_CONUS.prj
MID_CONUS.shp
MID_CONUS.shx
Observation: None
Climatology: None
Location: All of the input data required for this use case can be found in a sample data tarball. Each use case category will have one or more sample data tarballs. It is only necessary to download the tarball with the use case’s dataset and not the entire collection of sample data. Click here to access the METplus releases page and download sample data for the appropriate release: https://github.com/dtcenter/METplus/releases This tarball should be unpacked into the directory that you will set the value of INPUT_BASE. See Running METplus section for more information.
External Dependencies
You will need to use a version of Python 3.8.6 that has the following packages installed:
cartopy (0.20.3 only)
matplotlib
metpy
numpy
pandas
shapely
xarray
METplus Components
This use case runs the METplotpy vert_profile_fv3.py script to generate the vertical profile plot.
METplus Workflow
Beginning time (VALID_BEG): 2019
End time (VALID_END): None
Increment between beginning and end times (VALID_INCREMENT): None
Sequence of forecast leads to process (LEAD_SEQ): None
This use case does not loop but plots physics tendency data that has been subsetted to one date: 2019-06-15.
METplus Configuration
METplus first loads all of the configuration files found in parm/metplus_config, then it loads any configuration files passed to METplus via the command line, i.e. parm/use_cases/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile.conf
[config]
# Documentation for this use case can be found at
# https://metplus.readthedocs.io/en/latest/generated/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile.html
# For additional information, please see the METplus Users Guide.
# https://metplus.readthedocs.io/en/latest/Users_Guide
###
# Processes to run
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#process-list
###
PROCESS_LIST = UserScript
###
# Time Info
# LOOP_BY options are INIT, VALID, RETRO, and REALTIME
# If set to INIT or RETRO:
# INIT_TIME_FMT, INIT_BEG, INIT_END, and INIT_INCREMENT must also be set
# If set to VALID or REALTIME:
# VALID_TIME_FMT, VALID_BEG, VALID_END, and VALID_INCREMENT must also be set
# LEAD_SEQ is the list of forecast leads to process
# https://metplus.readthedocs.io/en/latest/Users_Guide/systemconfiguration.html#timing-control
###
LOOP_BY = REALTIME
VALID_TIME_FMT = %Y
VALID_BEG = 2019
USER_SCRIPT_RUNTIME_FREQ = RUN_ONCE
###
# UserScript Settings
# https://metplus.readthedocs.io/en/latest/Users_Guide/wrappers.html#userscript
###
FV3_HISTORY_FILE = {INPUT_BASE}/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency/fv3_history.nc
GRID_SPEC_FILE = {INPUT_BASE}/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency/grid_spec.nc
USER_SCRIPT_COMMAND = {PARM_BASE}/use_cases/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile/vertical_profile_plot.py {PARM_BASE}/use_cases/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile/physics_tendency_vertical_profile.yaml {FV3_HISTORY_FILE} {GRID_SPEC_FILE} --out_dir {OUTPUT_BASE}/plots
[user_env_vars]
# VerticalProfile plot specific variables
LOG_FILE = "VerticalProfile.log"
LOG_LEVEL = "DEBUG"
YAML_CONFIG_NAME = {PARM_BASE}/use_cases/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile/physics_tendency_vertical_profile.yaml
MET Configuration
No MET tools are used in this use case.
Python Embedding
This use case does not use Python embedding.
User Scripting
User Scripting is not used in this use case.
Running METplus
Pass the use case configuration file to the run_metplus.py script along with any user-specific system configuration files if desired:
run_metplus.py /path/to/METplus/parm/use_cases/model_applications/short_range/UserScript_fcstFV3_fcstOnly_PhysicsTendency_VerticalProfile.conf /path/to/user_system.conf
See Running METplus for more information.
Expected Output
A successful run will output the following both to the screen and to the logfile:
INFO: METplus has successfully finished running.
Note
By default, the vert_profile_fv3.py script (that generates the plot) creates a file based on the variable name and plot type. The resulting .png file is written to the directory where the vert_profile_fv3.py script was invoked.
The following file will be created in the directory from where the use case command was issued:
ugrd.vert_profile.png
Keywords
Note
MediumRangeAppUseCase
PhysicsTendency
ValidationUseCase
ShortRangeAppUseCase
S2SAppUseCase
METplotpyUseCase
Navigate to the METplus Quick Search for Use Cases page to discover other similar use cases.
#