Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #1626 TCDiag updates to wrapper and basic use case #2248

Merged
merged 61 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
2c0332a
update diff util and test that changes properly diff failling diffs, …
georgemccabe Jun 14, 2023
905b409
turn off use case
georgemccabe Jun 14, 2023
c2b6e3a
catch any exception that occurs in NetCDF file diff, ci-skip-unit-tests
georgemccabe Jun 14, 2023
5fdee80
catch any exception from file diff instead of just in NetCDF diff, ci…
georgemccabe Jun 14, 2023
21af4b2
forgot to trigger diff, ci-run-diff, ci-skip-unit-tests
georgemccabe Jun 14, 2023
2172134
use pandas.isnull instead of numpy.isnan to prevent exceptions from o…
georgemccabe Jun 14, 2023
eefaa0c
capture failure in diff script, ci-run-diff, ci-skip-unit-tests
georgemccabe Jun 14, 2023
0201daa
ignore .idea directory that was auto-generated
georgemccabe Jun 14, 2023
194088d
fix incorrect syntax, ci-run-diff, ci-skip-unit-tests
georgemccabe Jun 14, 2023
8017d99
handle failing comparison when NetCDF values are stored as a string, …
georgemccabe Jun 14, 2023
d7981f2
Preserve backwards compatibility by forcing TC_PAIRS_RUN_ONCE=False i…
georgemccabe Jun 14, 2023
edbbe39
Merge branch 'bugfix_gha_diff' of github.com:dtcenter/METplus into bu…
georgemccabe Jun 14, 2023
c8a80b2
add pandas to diff conda environment used for diff tests in GHA to pr…
georgemccabe Jun 14, 2023
353fd15
turn off use cases after tests succeeded
georgemccabe Jun 14, 2023
52f5ceb
update apt-get to fix poppler-utils install error, add specific versi…
georgemccabe Jun 15, 2023
1421c18
run use case to test that diff.v5.1 conda env was created properly, c…
georgemccabe Jun 15, 2023
b29a7ac
check if values are completely equal inside _is_equal_rounded functio…
georgemccabe Jun 15, 2023
2b9bea5
turn off all use case groups before re-opening PR
georgemccabe Jun 15, 2023
0cbcff2
if both netcdf values are masked, consider them equal
georgemccabe Jun 15, 2023
70e5b5e
updates to the wrapper to properly set the -data arguments
georgemccabe Jun 16, 2023
d8c4298
Merge branch 'develop' into feature_1626_tc_diag_v2
georgemccabe Jun 28, 2023
7dee5a9
Added some additional description to the 'Description' section for TC…
jvigh Jul 5, 2023
2e39caa
As per #2201 (for #1626), reviewed and enhanced the TC-Diag basic use…
jvigh Jul 6, 2023
a839509
Corrected link to MET config file.
jvigh Jul 6, 2023
e2756b7
add TropicalCycloneUseCase quick search keyword and add it the keywor…
georgemccabe Jul 6, 2023
30927a9
As per #1626, modified the use case to use data form a more recent st…
jvigh Jul 7, 2023
30f84a5
As per #1626, found one more fv3 ref to remove.
jvigh Jul 7, 2023
1a18c36
As per #1626, changing GFSO to AVNO.
jvigh Jul 7, 2023
991d6ad
As per #1626, hmmm, the use case didn't work with AVNO. So now trying…
jvigh Jul 7, 2023
fc5e1f3
As per #2616, changed GFSO to AVNO.
jvigh Jul 10, 2023
e3436b6
As per #1626, running with LOG_LEVEL=DEBUG as per @georgemccabe's sug…
jvigh Jul 10, 2023
829b965
As per #1626, changing input file template.
jvigh Jul 10, 2023
0179b00
As per @georgemccabe's suggestion, upping the logging verbosity for #…
jvigh Jul 10, 2023
a0c16fb
As per @georgemccabe's suggestion, also setting SCRUB_STAGING_DIR = F…
jvigh Jul 10, 2023
e50088b
As per @georgemccabe's request for #1626, changing MODEL to GFSO.
jvigh Jul 10, 2023
37c86e6
As per #1626, setting
jvigh Jul 10, 2023
48e8955
#1626:
jvigh Jul 10, 2023
64fc15c
@georgemccabe It seems that the "old" FV3-GFS data used "L0", but now…
jvigh Jul 11, 2023
e3b05f7
#1626 @georgemccabe. Using MSLET/Z0 didn't work. Now trying PRMSL/Z0.
jvigh Jul 11, 2023
1895c3e
#1626 and @georgemccabe: Trying specificying no level.
jvigh Jul 11, 2023
2079e5b
use Z0 for PRMSL level and use current init time for init_inc value
georgemccabe Jul 11, 2023
6f54c37
#1626: Using time templates instead of hard-coding the times.
jvigh Jul 11, 2023
7d678a4
Merge branch 'feature_1626_tc_diag_v2' of github.com:dtcenter/METplus…
jvigh Jul 11, 2023
d3f9ca1
#1626: Trying LEAD_SEQ to limit the extent of the run.
jvigh Jul 11, 2023
6493671
fixed typo in variable name
georgemccabe Jul 11, 2023
19d6bd2
#1626: Now checking to see if it can run using MSLET instead of PRMSL.
jvigh Jul 11, 2023
cc58315
#1626: Cleaning up for finalization.
jvigh Jul 11, 2023
225a83e
#1626: Removed data staging.
jvigh Jul 11, 2023
4de1c62
add example of complex subset of grib2 data
georgemccabe Jul 11, 2023
a1c6d82
Merge branch 'feature_1626_tc_diag_v2' of github.com:dtcenter/METplus…
georgemccabe Jul 11, 2023
99cbe4d
#1626 @georgemccabe:
jvigh Jul 11, 2023
3d207c7
add TCDiag basic use case to automated tests and set it to run to test
georgemccabe Jul 12, 2023
781c085
turn off use case group after confirming it works in automated tests
georgemccabe Jul 12, 2023
ff909ed
updated use case to include pressure levels that are found in the new…
georgemccabe Jul 13, 2023
54f0aee
turn on new use case to test, ci-skip-unit-tests
georgemccabe Jul 13, 2023
cb7678b
turn off use case for PR
georgemccabe Jul 13, 2023
c843beb
As per #1616, updated the documentation for the basic TCDiag use case…
jvigh Jul 14, 2023
c21d6af
As per #1626, fixing formatting of the introductory doc block which g…
jvigh Jul 14, 2023
408bf1e
As per #1626, another formatting fix.
jvigh Jul 14, 2023
08aefa8
@georgemccabe, as per #1626, changing the version of MET in the TCDia…
jvigh Jul 14, 2023
31043a1
#1626. I think my previous attempt at a bulleted list for the novel f…
jvigh Jul 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/parm/use_case_groups.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"index_list": "30-58",
"run": false
},
{
"category": "met_tool_wrapper",
"index_list": "62",
"run": false
},
{
"category": "air_quality_and_comp",
"index_list": "0",
Expand Down
6 changes: 6 additions & 0 deletions docs/Contributors_Guide/add_use_case.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@ file.grib2, run the following command::

wgrib2 file.grib2 | grep TMP | wgrib2 -i file.grib2 -grib_out subset.grib2

The egrep command can be used for more complex subsetting of grib2 data.
Example: To create a file called subset.grib2 from file.grib2 that contains
PRMSL data and TMP data on 1000, 900, 800, 700, 500, and 100 mb levels::

wgrib2 file.grib2 -s | egrep '(:TMP:1000 mb:|:TMP:900 mb:|:TMP:800 mb:|:TMP:700 mb:|:TMP:500 mb:|:TMP:100 mb:|:PRMSL)' | wgrib2 -i file.grib2 -grib subset.grib2

If the input data is in NetCDF format, the
`ncks <http://nco.sourceforge.net/nco.html>`_ tool can be used to subset
the file(s).
Expand Down
3 changes: 3 additions & 0 deletions docs/Users_Guide/quicksearch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ METplus Quick Search for Use Cases


Use Cases by MET Tool:
======================

.. only:: html

Expand Down Expand Up @@ -159,6 +160,7 @@ Use Cases by METplus Feature:
| `Runtime Frequency <../search.html?q=RuntimeFreqUseCase&check_keywords=yes&area=default>`_
| `Series by Initialization <../search.html?q=SeriesByInitUseCase&check_keywords=yes&area=default>`_
| `Series by Forecast Lead <../search.html?q=SeriesByLeadUseCase&check_keywords=yes&area=default>`_
| `Tropical Cyclone <../search.html?q=TropicalCycloneUseCase&check_keywords=yes&area=default>`_
| `Validation of Models or Analyses <../search.html?q=ValidationUseCase&check_keywords=yes&area=default>`_
| `User Defined Script <../search.html?q=UserScriptUseCase&check_keywords=yes&area=default>`_

Expand Down Expand Up @@ -187,6 +189,7 @@ Use Cases by METplus Feature:
| **Runtime Frequency**: *RuntimeFreqUseCase*
| **Series by Initialization**: *SeriesByInitUseCase*
| **Series by Forecast Lead**: *SeriesByLeadUseCase*
| **Tropical Cyclone**: *TropicalCycloneUseCase*
| **Validation of Models or Analyses**: *ValidationUseCase*
| **User Defined Script**: *UserScriptUseCase*

Expand Down
2 changes: 1 addition & 1 deletion docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7692,7 +7692,7 @@ TCDiag
Description
-----------

Used to configure the MET tool TC-Diag.
The TC-Diag wrapper encapsulates the behavior of the MET `tc_diag <https://met.readthedocs.io/en/develop/Users_Guide/tc-diag.html>`_ tool. It provides the infrastructure to compute diagnostics from model fields and tracks. It can be configured to run over a single intialization time, all of the initialization times for a given storm, or over many storms. Configuration also allows a user to select which domain(s) of the input model data to use in the diagnostics calculations, set which levels and variables will be used as well as details about the azimuth-range grid used for the calculations, and to control which output files are generated. Future functionality of the tc_diag tool, such as vortex removal, will also be configurable from this wrapper.

METplus Configuration
---------------------
Expand Down
52 changes: 45 additions & 7 deletions docs/use_cases/met_tool_wrapper/TCDiag/TCDiag.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,48 @@
met_tool_wrapper/TCDiag/TCDiag.conf

"""
##############################################################################
# Overview
# --------------------
#
# This use case illustrates the use of tc_diag tool, which is currently
# considered a beta-level release that lacks full functionality.
# The use case illustrates running the
# tc_diag tool for a tropical cyclone forecast case and generating
# intermediate NetCDF output files of the input model's data transformed
# onto an azimuth-range grid. When the full functionality of the
# tc_diag tool is released in MET v12.0.0, this use case will be also
# output environmental diagnostics computed from callable Python scripts.
#
# The diagnostics are computed on a range-azimuth grid that follows the
# projected storm track. For inputs, it uses 0.25 deg gridded GRIB files from the
# a retrospective reforecast of the Global Forecast System (GFS). For the track, it uses the
# GFS's predicted track to ensure that the model's simulated storm doesn't
# contaminate the diagnostics result as a result of the model's simulated
# storm being mistaken for environmental factors. (Note:
# a future version of the tc_diag tool will include removal of the model's vortex,
# allowing diagnostics to be computed along any arbitrarily defined track.)
#
# Novel aspects of this use case:
# * This is the first example use case to run the tc_diag tool.
# * Example of running for a single tropical cyclone forecast case from
# Tropical Storm Bret (2023) using GFS data.

##############################################################################
# Scientific Objective
# --------------------
#
# TODO: Add content here
# Generate intermediate data files, in which the input model's data have been
# transformed to a range-azimuth grid, in preparation for further diagnostic
# calculations using Python-based routines.

##############################################################################
# Datasets
# --------
#
# **Forecast:** GFS FV3
# **Track:** A Deck
# **Forecast:** GFS grib files
#
# **Track:** a-deck file (Automated Tropical Cyclone Forecast System format)
#
# **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
Expand All @@ -26,6 +56,11 @@
# 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:** Users may obtain real-time data from the deterministic GFS runs from
# NOAA's NOMADS server:
# https://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.YYYYMMDD/ZZ/atmos/
# where YYYYMMDD is the date (4-digit year, 2-digit month, 2-digit day),
# ZZ is the initialization hour of the desired model cycle (00, 06, 12, 18).

##############################################################################
# METplus Components
Expand All @@ -42,8 +77,8 @@
# TCDiag is the only tool called in this example. It processes the following
# run times:
#
# **Init:** 2016-09-29- 00Z
# **Forecast lead:** 141, 143, and 147 hour
# **Init:** 2023-06-20 0000Z
# **Forecast lead:** 0, 6, and 12 hours
#

##############################################################################
Expand All @@ -67,7 +102,7 @@
# 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:`TCDiag MET Configuration<tc-rmw-met-conf>` section of the User's Guide for more information on the environment variables used in the file below:
# .. note:: See the :ref:`TCDiag MET Configuration<tc-diag-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/TCDiagConfig_wrapped
Expand Down Expand Up @@ -96,7 +131,8 @@
# Output for this use case will be found in met_tool_wrapper/TCDiag (relative to **OUTPUT_BASE**)
# and will contain the following files:
#
# * tc_diag_aal142016.nc
# * tc_diag_AL032023_GFSO_2023062012_cyl_grid_nest.nc
# * tc_diag_AL032023_GFSO_2023062012_cyl_grid_parent.nc
#

##############################################################################
Expand All @@ -105,8 +141,10 @@
#
# .. note::
#
# * DiagnosticsUseCase
# * TCDiagToolUseCase
# * GRIB2FileUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
1 change: 1 addition & 0 deletions docs/use_cases/met_tool_wrapper/TCGen/TCGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
#
# * TCGenToolUseCase
# * DTCOrgUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
# .. note::
#
# * TCMPRPlotterUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
#
# * TCPairsToolUseCase
# * SBUOrgUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
#
# * TCPairsToolUseCase
# * DTCOrgUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
1 change: 1 addition & 0 deletions docs/use_cases/met_tool_wrapper/TCRMW/TCRMW.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
#
# * TCRMWToolUseCase
# * GRIB2FileUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
1 change: 1 addition & 0 deletions docs/use_cases/met_tool_wrapper/TCStat/TCStat.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
# .. note::
#
# * TCStatToolUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
# * SBUOrgUseCase
# * DiagnosticsUseCase
# * RuntimeFreqUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
# * SBUOrgUseCase
# * DiagnosticsUseCase
# * RuntimeFreqUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@
# * SBUOrgUseCase
# * DiagnosticsUseCase
# * RuntimeFreqUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@
# * TCPairsToolUseCase
# * SBUOrgUseCase
# * CyclonePlotterUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
#
# * TCandExtraTCAppUseCase
# * GridStatToolUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
# * NOAAEMCOrgUseCase
# * SBUOrgUseCase
# * DTCOrgUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
# * MediumRangeAppUseCase
# * SBUOrgUseCase
# * DTCOrgUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
# .. note::
#
# * TCGenToolUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
#
# * TCPairsToolUseCase
# * TCStatToolUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
#
# * TCRMWToolUseCase
# * GRIB2FileUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
# * UserScriptUseCase
# * PointStatToolUseCase
# * ASCII2NCToolUseCase
# * TropicalCycloneUseCase
#
# Navigate to the :ref:`quick-search` page to discover other similar use cases.
#
Expand Down
23 changes: 13 additions & 10 deletions internal/tests/pytests/wrappers/tc_diag/test_tc_diag_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

deck_template = 'aal14{date?fmt=%Y}_short.dat'
input_template = 'gfs.subset.t00z.pgrb2.0p25.f*'
output_template = 'tc_diag_aal14{date?fmt=%Y}.nc'
output_template = '{date?fmt=%Y}'

time_fmt = '%Y%m%d%H'
run_times = ['2016092900']
Expand All @@ -24,6 +24,9 @@
'{ name="TMP"; level="P100"; }];'
)

input_domain = 'parent'
input_tech_id_list = 'GFSO'


def get_data_dir(config):
return os.path.join(config.getdir('METPLUS_BASE'),
Expand All @@ -46,9 +49,11 @@ def set_minimum_config_settings(config):
config.set('config', 'TC_DIAG_CONFIG_FILE',
'{PARM_BASE}/met_config/TCDiagConfig_wrapped')
config.set('config', 'TC_DIAG_DECK_TEMPLATE', deck_template)
config.set('config', 'TC_DIAG_INPUT_TEMPLATE', input_template)
config.set('config', 'TC_DIAG_INPUT1_TEMPLATE', input_template)
config.set('config', 'TC_DIAG_INPUT1_DOMAIN', input_domain)
config.set('config', 'TC_DIAG_INPUT1_TECH_ID_LIST', input_tech_id_list)
config.set('config', 'TC_DIAG_OUTPUT_DIR',
'{OUTPUT_BASE}/TCDiag/output')
'{OUTPUT_BASE}/tc_diag')
config.set('config', 'TC_DIAG_OUTPUT_TEMPLATE', output_template)

config.set('config', 'BOTH_VAR1_NAME', 'PRMSL')
Expand Down Expand Up @@ -231,13 +236,11 @@ def test_tc_diag_run(metplus_config, config_overrides,
config_file = wrapper.c_dict.get('CONFIG_FILE')
out_dir = wrapper.c_dict.get('OUTPUT_DIR')

expected_cmds = [(f"{app_path} "
f"-deck {deck_dir}/aal142016_short.dat "
f"-data {file_list_file} "
f"-config {config_file} "
f"-out {out_dir}/tc_diag_aal142016.nc "
f"{verbosity}"),
]
expected_cmds = [
(f"{app_path} -deck {deck_dir}/aal142016_short.dat "
f"-data {input_domain} {input_tech_id_list} {file_list_file} "
f"-config {config_file} -outdir {out_dir}/2016/ {verbosity}"),
]

all_cmds = wrapper.run_all_times()
print(f"ALL COMMANDS: {all_cmds}")
Expand Down
2 changes: 1 addition & 1 deletion internal/tests/use_cases/all_use_cases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Category: met_tool_wrapper
59::IODA2NC::met_tool_wrapper/IODA2NC/IODA2NC.conf
60::PointStat_python_embedding_obs:: met_tool_wrapper/PointStat/PointStat_python_embedding_obs.conf
61::PlotPointObs:: met_tool_wrapper/PlotPointObs/PlotPointObs.conf
#62::TCDiag:: met_tool_wrapper/TCDiag/TCDiag.conf
62::TCDiag:: met_tool_wrapper/TCDiag/TCDiag.conf

Category: air_quality_and_comp
0::EnsembleStat_fcstICAP_obsMODIS_aod::model_applications/air_quality_and_comp/EnsembleStat_fcstICAP_obsMODIS_aod.conf
Expand Down
Loading
Loading