Skip to content

Commit

Permalink
Feature 1318 usecase aviso (#1440)
Browse files Browse the repository at this point in the history
* Correct small typo.

* Update pull_request_template.md

* Added files for ReadTheDocs (#864)

* Updated documentation links for ReadtheDocs

* Update pull_request_template.md

Added entry for completion date for pull request review.

* Adding python embedding script to read AVISO, RTOFS, HYCOM and OSTIA data

* Updated the script - working but only RMSE values match

* Adding documentation for the AVISO case

* Adding a conf file for the AVISO case

* Updates to the codel to include model3, obs, climo3 but also has many extra print statements, netcdf output files which needs to be cleaned

* Cleaning up the conf file and adding SAL1L2 to get the model_climo sdev and obs_climo sdev

* Updating the file to fix the standard names and add the model3, climo3 and obs3

* Updating the file to fix the standard names and add the model3, climo3 and obs3

* Adding an image to the use case. Image Courtesy: EMC/NOAA website

* added to use case list

* updated case description

* removed merge issues

* caught second docs issue

* removed other doc merge issues, turned off auto test

* more merge comments sneaking in

Co-authored-by: johnhg <johnhg@ucar.edu>
Co-authored-by: jprestop <jpresto@ucar.edu>
Co-authored-by: Mrinal Biswas <biswas@ucar.edu>
  • Loading branch information
4 people authored Feb 24, 2022
1 parent 798f017 commit d3021de
Show file tree
Hide file tree
Showing 6 changed files with 748 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/parm/use_case_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
"index_list": "3-4",
"run": false
},
{
"category": "marine_and_cryosphere",
"index_list": "5",
"run": false
},
{
"category": "medium_range",
"index_list": "0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
"""
GridStat: Python Embedding to read and process sea surface heights
==================================================================
model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf
"""
##############################################################################
# Scientific Objective
# --------------------
#
# This use case utilizes Python embedding to extract several statistics from the sea surface height data over the globe,
# which was already being done in a closed system. By producing the same output via METplus, this use case
# provides standardization and reproducible results.

##############################################################################
# Datasets
# --------
#
# | **Forecast:** RTOFS ssh file via Python Embedding script/file
#
# | **Observations:** AVISO ssh file via Python Embedding script/file
#
# | **Sea Ice Masking:** RTOFS ice cover file via Python Embedding script/file
#
# | **Climatology:** HYCOM ssh file via Python Embedding script/file
#
# | **Location:** All of the input data required for this use case can be found in the met_test sample data tarball. Click here to 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.
#
# | **Data Source:** COPERNICUS GLOBAL OCEAN SSH NRT (LEVEL 4), HYCOM + NCODA Global 1/12 deg Reanalysis
# |

##############################################################################
# External Dependencies
# ---------------------
#
# You will need to use a version of Python 3.6+ that has the following packages installed:
#
# * scikit-learn
# * pyresample
#
# If the version of Python used to compile MET did not have these libraries at the time of compilation, you will need to add these packages or create a new Python environment with these packages.
#
# If this is the case, you will need to set the MET_PYTHON_EXE environment variable to the path of the version of Python you want to use. If you want this version of Python to only apply to this use case, set it in the [user_env_vars] section of a METplus configuration file.:
#
# [user_env_vars]
# MET_PYTHON_EXE = /path/to/python/with/required/packages/bin/python

##############################################################################
# METplus Components
# ------------------
#
# This use case utilizes the METplus GridStat wrapper to generate a
# command to run the MET tool GridStat with Python Embedding for the specified user hemispheres

##############################################################################
# METplus Workflow
# ----------------
#
# GridStat is the only tool called in this example. This use case will pass in both the observation, forecast,
# and climatology gridded data being pulled from the files via Python Embedding. All of the desired statistics
# reside in the CNT line type, so that is the only output requested.
# It processes the following run time:
#
# | **Valid:** 2021-05-11 0Z
# |

##############################################################################
# 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
# with the -c option, i.e. -c parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf
#
# .. highlight:: bash
# .. literalinclude:: ../../../../parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf

##############################################################################
# MET Configuration
# ---------------------
#
# METplus sets environment variables based on user settings in the METplus configuration file.
# See :ref:`How METplus controls MET config file settings<metplus-control-met>` for more details.
#
# **YOU SHOULD NOT SET ANY OF THESE ENVIRONMENT VARIABLES YOURSELF! THEY WILL BE OVERWRITTEN BY METPLUS WHEN IT CALLS THE MET TOOLS!**
#
# If there is a setting in the MET configuration file that is currently not supported by METplus you'd like to control, please refer to:
# :ref:`Overriding Unsupported MET config file settings<met-config-overrides>`
#
# .. note:: See the :ref:`GridStat MET Configuration<grid-stat-met-conf>` section of the User's Guide for more information on the environment variables used in the file below:
#
# .. highlight:: bash
# .. literalinclude:: ../../../../parm/met_config/GridStatConfig_wrapped

##############################################################################
# Python Embedding
# ----------------
#
# This use case uses one Python script to read forecast and observation data
#
# parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/read_rtofs_aviso_hycom.py
#
# .. highlight:: python
# .. literalinclude:: ../../../../parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/read_rtofs_aviso_hycom.py
#

##############################################################################
# Running METplus
# ---------------
#
# This use case can be run two ways:
#
# 1) Passing in GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf then a user-specific system configuration file::
#
# run_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf -c /path/to/user_system.conf
#
# 2) Modifying the configurations in parm/metplus_config, then passing in GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf::
#
# run_metplus.py -c /path/to/METplus/parm/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf
#
# The former method is recommended. Whether you add them to a user-specific configuration file or modify the metplus_config files, the following variables must be set correctly:
#
# * **INPUT_BASE** - Path to directory where sample data tarballs are unpacked (See Datasets section to obtain tarballs). This is not required to run METplus, but it is required to run the examples in parm/use_cases
# * **OUTPUT_BASE** - Path where METplus output will be written. This must be in a location where you have write permissions
# * **MET_INSTALL_DIR** - Path to location where MET is installed locally
#
# Example User Configuration File::
#
# [dir]
# INPUT_BASE = /path/to/sample/input/data
# OUTPUT_BASE = /path/to/output/dir
# MET_INSTALL_DIR = /path/to/met-X.Y
#
# **NOTE:** All of these items must be found under the [dir] section.
#

##############################################################################
# Expected Output
# ---------------
#
# A successful run will output the following both to the screen and to the logfile::
#
# INFO: METplus has successfully finished running.
#
# Refer to the value set for **OUTPUT_BASE** to find where the output data was generated.
# Output for thisIce use case will be found in 20210503 (relative to **OUTPUT_BASE**)
# and will contain the following files:
#
# * grid_stat_SSH_000000L_20210811_000000V.stat
# * grid_stat_SSH_000000L_20210811_000000V_sal1l2.txt
# * grid_stat_SSH_000000L_20210811_000000V_cnt.txt
# * grid_stat_SSH_000000L_20210811_000000V_pairs.nc

##############################################################################
# Keywords
# --------
#
# .. note::
#
# * GridStatToolUseCase
# * PythonEmbeddingFileUseCase
# * MarineAndCryosphereAppUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
#
#
# sphinx_gallery_thumbnail_path = '_static/marine_and_cryosphere-GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.png'

1 change: 1 addition & 0 deletions internal_tests/use_cases/all_use_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ Category: marine_and_cryosphere
2::GridStat_fcstRTOFS_obsOSTIA_iceCover::model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsOSTIA_iceCover.conf:: icecover_env, py_embed
3::GridStat_fcstRTOFS_obsSMOS_climWOA_sss::model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsSMOS_climWOA_sss.conf:: icecover_env, py_embed
4::GridStat_fcstRTOFS_obsSMAP_climWOA_sss::model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsSMAP_climWOA_sss.conf:: icecover_env, py_embed
5::GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh::model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh.conf:: icecover_env, py_embed
#X::GridStat_fcstRTOFS_obsGHRSST_climWOA_sst::model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsGHRSST_climWOA_sst.conf, model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsGHRSST_climWOA_sst/ci_overrides.conf:: icecover_env, py_embed


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
# GridStat METplus Configuration

# section heading for [config] variables - all items below this line and
# before the next section heading correspond to the [config] section
[config]

# List of applications to run - only GridStat for this case
PROCESS_LIST = GridStat

# time looping - 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
LOOP_BY = VALID

# Format of INIT_BEG and INT_END using % items
# %Y = 4 digit year, %m = 2 digit month, %d = 2 digit day, etc.
# see www.strftime.org for more information
# %Y%m%d%H expands to YYYYMMDDHH
VALID_TIME_FMT = %Y%m%d

# Start time for METplus run - must match INIT_TIME_FMT
VALID_BEG=20210811

# End time for METplus run - must match INIT_TIME_FMT
VALID_END=20210811

# Increment between METplus runs (in seconds if no units are specified)
# Must be >= 60 seconds
VALID_INCREMENT = 1M

# List of forecast leads to process for each run time (init or valid)
# In hours if units are not specified
# If unset, defaults to 0 (don't loop through forecast leads)
LEAD_SEQ = 24


# Order of loops to process data - Options are times, processes
# Not relevant if only one item is in the PROCESS_LIST
# times = run all wrappers in the PROCESS_LIST for a single run time, then
# increment the run time and run all wrappers again until all times have
# been evaluated.
# processes = run the first wrapper in the PROCESS_LIST for all times
# specified, then repeat for the next item in the PROCESS_LIST until all
# wrappers have been run
LOOP_ORDER = times

# Verbosity of MET output - overrides LOG_VERBOSITY for GridStat only
LOG_GRID_STAT_VERBOSITY = 2

# Location of MET config file to pass to GridStat
GRID_STAT_CONFIG_FILE = {PARM_BASE}/met_config/GridStatConfig_wrapped

# grid to remap data. Value is set as the 'to_grid' variable in the 'regrid' dictionary
# See MET User's Guide for more information
GRID_STAT_REGRID_TO_GRID = NONE

# Name to identify model (forecast) data in output
MODEL = RTOFS

# Name to identify observation data in output
OBTYPE = AVISO

# set the desc value in the GridStat MET config file
GRID_STAT_DESC = NA

# List of variables to compare in GridStat - FCST_VAR1 variables correspond
# to OBS_VAR1 variables
# Note [FCST/OBS/BOTH]_GRID_STAT_VAR<n>_NAME can be used instead if different evaluations
# are needed for different tools

# Name of forecast variable 1
FCST_VAR1_NAME = {CONFIG_DIR}/read_rtofs_aviso_hycom.py {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/{init?fmt=%Y%m%d}_rtofs_glo_2ds_f024_diag.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/nrt_global_allsat_phy_l4_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/OSTIA-UKMO-L4-GLOB-v2.0_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh {valid?fmt=%Y%m%d} fcst

# List of levels to evaluate for forecast variable 1
# A03 = 3 hour accumulation in GRIB file
FCST_VAR1_LEVELS =

# List of thresholds to evaluate for each name/level combination for
# forecast variable 1
FCST_VAR1_THRESH =

#FCST_GRID_STAT_FILE_TYPE =

# Name of observation variable 1
OBS_VAR1_NAME = {CONFIG_DIR}/read_rtofs_aviso_hycom.py {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/{init?fmt=%Y%m%d}_rtofs_glo_2ds_f024_diag.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/nrt_global_allsat_phy_l4_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/OSTIA-UKMO-L4-GLOB-v2.0_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh {valid?fmt=%Y%m%d} obs


# List of levels to evaluate for observation variable 1
# (*,*) is NetCDF notation - must include quotes around these values!
# must be the same length as FCST_VAR1_LEVELS
OBS_VAR1_LEVELS =

# List of thresholds to evaluate for each name/level combination for
# observation variable 1
OBS_VAR1_THRESH =

#GRID_STAT_MET_CONFIG_OVERRIDES = cat_thresh = [>=0.15];
#BOTH_VAR1_THRESH = >=0.15

#OBS_GRID_STAT_FILE_TYPE =


# Name of climatology variable 1
GRID_STAT_CLIMO_MEAN_FIELD = {name="{CONFIG_DIR}/read_rtofs_aviso_hycom.py {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/{init?fmt=%Y%m%d}_rtofs_glo_2ds_f024_diag.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/nrt_global_allsat_phy_l4_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh/OSTIA-UKMO-L4-GLOB-v2.0_{valid?fmt=%Y%m%d}.nc {INPUT_BASE}/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh {valid?fmt=%Y%m%d} climo"; level="(*,*)";}


# Time relative to valid time (in seconds) to allow files to be considered
# valid. Set both BEGIN and END to 0 to require the exact time in the filename
# Not used in this example.
FCST_GRID_STAT_FILE_WINDOW_BEGIN = 0
FCST_GRID_STAT_FILE_WINDOW_END = 0
OBS_GRID_STAT_FILE_WINDOW_BEGIN = 0
OBS_GRID_STAT_FILE_WINDOW_END = 0

# MET GridStat neighborhood values
# See the MET User's Guide GridStat section for more information

# width value passed to nbrhd dictionary in the MET config file
GRID_STAT_NEIGHBORHOOD_WIDTH = 1

# shape value passed to nbrhd dictionary in the MET config file
GRID_STAT_NEIGHBORHOOD_SHAPE = SQUARE

# cov thresh list passed to nbrhd dictionary in the MET config file
GRID_STAT_NEIGHBORHOOD_COV_THRESH = >=0.5

# Set to true to run GridStat separately for each field specified
# Set to false to create one run of GridStat per run time that
# includes all fields specified.
GRID_STAT_ONCE_PER_FIELD = False

# Set to true if forecast data is probabilistic
FCST_IS_PROB = false

# Only used if FCST_IS_PROB is true - sets probabilistic threshold
FCST_GRID_STAT_PROB_THRESH = ==0.1

# Set to true if observation data is probabilistic
# Only used if configuring forecast data as the 'OBS' input
OBS_IS_PROB = false

# Only used if OBS_IS_PROB is true - sets probabilistic threshold
OBS_GRID_STAT_PROB_THRESH = ==0.1

GRID_STAT_OUTPUT_PREFIX = SSH

GRID_STAT_OUTPUT_FLAG_CNT = BOTH
GRID_STAT_OUTPUT_FLAG_SAL1L2 = BOTH


# End of [config] section and start of [dir] section
[dir]
#use case configuration file directory
CONFIG_DIR = {PARM_BASE}/use_cases/model_applications/marine_and_cryosphere/GridStat_fcstRTOFS_obsAVISO_climHYCOM_ssh
# directory containing forecast input to GridStat
FCST_GRID_STAT_INPUT_DIR =

# directory containing observation input to GridStat
OBS_GRID_STAT_INPUT_DIR =

# directory containing climatology mean input to GridStat
# Not used in this example
GRID_STAT_CLIMO_MEAN_INPUT_DIR =

# directory containing climatology mean input to GridStat
# Not used in this example
GRID_STAT_CLIMO_STDEV_INPUT_DIR =

# directory to write output from GridStat
GRID_STAT_OUTPUT_DIR = {OUTPUT_BASE}

# End of [dir] section and start of [filename_templates] section
[filename_templates]

# Template to look for forecast input to GridStat relative to FCST_GRID_STAT_INPUT_DIR
FCST_GRID_STAT_INPUT_TEMPLATE = PYTHON_NUMPY

# Template to look for observation input to GridStat relative to OBS_GRID_STAT_INPUT_DIR
OBS_GRID_STAT_INPUT_TEMPLATE = PYTHON_NUMPY

# Optional subdirectories relative to GRID_STAT_OUTPUT_DIR to write output from GridStat
GRID_STAT_OUTPUT_TEMPLATE = {valid?fmt=%Y%m%d}

# Template to look for climatology input to GridStat relative to GRID_STAT_CLIMO_MEAN_INPUT_DIR
# Not used in this example
GRID_STAT_CLIMO_MEAN_INPUT_TEMPLATE = PYTHON_NUMPY

# Template to look for climatology input to GridStat relative to GRID_STAT_CLIMO_STDEV_INPUT_DIR
# Not used in this exampls
GRID_STAT_CLIMO_STDEV_INPUT_TEMPLATE =

# Used to specify one or more verification mask files for GridStat
# Not used for this example
GRID_STAT_VERIFICATION_MASK_TEMPLATE =
Loading

0 comments on commit d3021de

Please sign in to comment.