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 #1402 config cleanup model applications #1722

Merged
merged 44 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4a0afcf
Per #1402, added additional comments to config file including links t…
georgemccabe Feb 2, 2022
0fc46b6
Merge branch 'develop' into feature_1402_config_cleanup
georgemccabe Mar 15, 2022
7046183
rearrange variables and added link to user's guide
georgemccabe Mar 15, 2022
e9ba518
updated comment to note that variables in the section are optional
georgemccabe Jun 7, 2022
a31407f
Merge branch 'develop' into feature_1402_config_cleanup
georgemccabe Jun 15, 2022
b0110a7
added URL for use case documentation
georgemccabe Jun 15, 2022
cce7b49
Merge branch 'develop' into feature_1402_config_cleanup
georgemccabe Jun 30, 2022
6ae90f2
per #1402, rearrange and clean up config file
georgemccabe Jun 30, 2022
7b02fe7
added missing config variables from CyclonePlotter to glossary and wr…
georgemccabe Jul 6, 2022
6c45365
per #1402, clean up use case conf files, ci-run-all-diff
georgemccabe Jul 6, 2022
2d76352
per #1402, clean up Point2Grid conf file
georgemccabe Jul 6, 2022
551f8c7
per #1402, clean up rest of met_tool_wrapper use case conf files, ci-…
georgemccabe Jul 6, 2022
1b0f46b
removed conf file that is no longer needed
georgemccabe Jul 13, 2022
c024bd7
Merge branch 'develop' into feature_1402_config_cleanup
georgemccabe Jul 14, 2022
049fb1c
per #1402, clean up use cases in air_quality_and_comp, climate, and d…
georgemccabe Jul 14, 2022
f98e178
Merge branch 'develop' into feature_1402_config_cleanup_model_app
georgemccabe Jul 14, 2022
c0787cb
per #1402, clean up use cases in marine_and_cryosphere
georgemccabe Jul 14, 2022
0e97a84
Merge branch 'develop' into feature_1402_config_cleanup_model_app
georgemccabe Jul 15, 2022
2116f06
changed URL to use latest instead of develop because even though the …
georgemccabe Jul 15, 2022
22a2737
per #1402, clean up use case config files for medium_range use cases
georgemccabe Jul 15, 2022
84f2f8c
Merge branch 'develop' into feature_1402_config_cleanup_model_app
georgemccabe Jul 19, 2022
664ec51
per #1402, rearrange and clean up config files for precipitation use …
georgemccabe Jul 19, 2022
ce09848
per #1402, rearrange and clean up config files for s2s, s2s_mid_lat, …
georgemccabe Jul 22, 2022
c0bd80b
fix logic that logs default value used to properly output False vs. e…
georgemccabe Jul 22, 2022
05156fd
fixed logic to not require MTD_SINGLE_RUN to be set for MTD by using …
georgemccabe Jul 22, 2022
2787978
added wrapped StatAnalysis config file back because the config file f…
georgemccabe Jul 22, 2022
ed05775
added missing import needed if an error occurs
georgemccabe Jul 22, 2022
1cd974f
added wrapped StatAnalysis config file back because the config file f…
georgemccabe Jul 22, 2022
d7f7cb8
run use cases that failed in the last run and ci-run-diff
georgemccabe Jul 22, 2022
ef6f3a6
fixed path that used CONFIG_DIR because variable was removed
georgemccabe Jul 22, 2022
ccfa89a
turn off use cases that passed to test again
georgemccabe Jul 22, 2022
4e2c002
per #1402, rearrange and clean up config files for short_range use cases
georgemccabe Jul 22, 2022
da4e01b
per #1402, rearrange and clean up space_weather config files
georgemccabe Jul 22, 2022
c5b2a9a
per #1402, updated another use case conf
georgemccabe Jul 22, 2022
dcc8028
add support for setting match_points in the TCPairs wrapped config fi…
georgemccabe Jul 22, 2022
40ee888
per #1402, rearrange and clean up config files for tc_and_extra_tc us…
georgemccabe Jul 22, 2022
6ad33e7
Merge branch 'develop' into feature_1402_config_cleanup_model_app
georgemccabe Jul 26, 2022
dd5c2eb
turn off use cases
georgemccabe Jul 27, 2022
367d111
Merge branch 'develop' into feature_1402_config_cleanup_model_app
georgemccabe Jul 27, 2022
a4f4af4
if TC_PAIRS_MATCH_POINTS is unset, set 'match_points = TRUE;'. This i…
georgemccabe Jul 27, 2022
6471b51
fixed TCPairs unit tests to handle default value for match_points
georgemccabe Jul 27, 2022
a41115f
added variables that are needed for use case and were accidentally re…
georgemccabe Jul 27, 2022
4d318db
log error and increment error count if required lat/lon bound variabl…
georgemccabe Jul 27, 2022
748c098
skip metplus_final.conf in check for new output to prevent false alar…
georgemccabe Jul 28, 2022
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 docs/Users_Guide/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9648,3 +9648,8 @@ METplus Configuration Glossary
Set the resolution for CyclonePlotter output.

| *Used by:* CyclonePlotter

TC_PAIRS_MATCH_POINTS
Specify the value for 'match_points' in the MET configuration file for TCPairs.

| *Used by:* TCPairs
12 changes: 12 additions & 0 deletions docs/Users_Guide/wrappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7829,6 +7829,7 @@ METplus Configuration
| :term:`TC_PAIRS_RUN_ONCE`
| :term:`TC_PAIRS_CHECK_DUP`
| :term:`TC_PAIRS_INTERP12`
| :term:`TC_PAIRS_MATCH_POINTS`
|

.. warning:: **DEPRECATED:**
Expand Down Expand Up @@ -8039,6 +8040,17 @@ see :ref:`How METplus controls MET config file settings<metplus-control-met>`.
* - :term:`TC_PAIRS_VALID_END`
- valid_end

**${METPLUS_MATCH_POINTS}**

.. list-table::
:widths: 5 5
:header-rows: 0

* - METplus Config(s)
- MET Config File
* - :term:`TC_PAIRS_MATCH_POINTS`
- match_points

**${METPLUS_DLAND_FILE}**

.. list-table::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# and Ice Mapping System (IMS) and the National Centers for Environmental Prediction (NCEP)
# sea ice analysis. This is a validation and diagnostics use case because it is limited to a
# comparison between IMS analysis to NCEP analysis.
# Written by Lindsay Blank, NCAR. January 2020

####################################################################################################
# Datasets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ def test_tc_pairs_storm_id_lists(metplus_config, config_overrides,
# 19: interp12
({'TC_PAIRS_INTERP12': 'replace', },
{'METPLUS_INTERP12': 'interp12 = REPLACE;'}),
# 20 match_points
({'TC_PAIRS_MATCH_POINTS': 'False', },
{'METPLUS_MATCH_POINTS': 'match_points = FALSE;'}),

]
)
Expand All @@ -386,7 +389,7 @@ def test_tc_pairs_loop_order_processes(metplus_config, config_overrides,
env_var_values):
# run using init and valid time variables
for loop_by in ['INIT', 'VALID']:
remove_beg = remove_end = False
remove_beg = remove_end = remove_match_points = False
config = metplus_config()

set_minimum_config_settings(config, loop_by)
Expand Down Expand Up @@ -420,6 +423,12 @@ def test_tc_pairs_loop_order_processes(metplus_config, config_overrides,
)
remove_end = True

if f'METPLUS_MATCH_POINTS' not in env_var_values:
env_var_values[f'METPLUS_MATCH_POINTS'] = (
'match_points = TRUE;'
)
remove_match_points = True

wrapper = TCPairsWrapper(config)
assert wrapper.isOK

Expand Down Expand Up @@ -456,6 +465,8 @@ def test_tc_pairs_loop_order_processes(metplus_config, config_overrides,
del env_var_values[f'METPLUS_{loop_by}_BEG']
if remove_end:
del env_var_values[f'METPLUS_{loop_by}_END']
if remove_match_points:
del env_var_values['METPLUS_MATCH_POINTS']


@pytest.mark.parametrize(
Expand Down Expand Up @@ -510,6 +521,10 @@ def test_tc_pairs_read_all_files(metplus_config, config_overrides,
f'{loop_by.lower()}_end = "{run_times[-1]}";'
)

env_var_values['METPLUS_MATCH_POINTS'] = (
'match_points = TRUE;'
)

wrapper = TCPairsWrapper(config)
assert wrapper.isOK

Expand Down
5 changes: 3 additions & 2 deletions metplus/util/config_metplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def check_default(self, sec, name, default):
raise

# print debug message saying default value was used
if not default:
if default == '':
default_text = 'empty string'
else:
default_text = default
Expand Down Expand Up @@ -1766,7 +1766,8 @@ def skip_field_info_validation(config):
process_list = [item[0] for item in get_process_list(config)]

# if running MTD in single mode, you don't need matching FCST/OBS
if 'MTD' in process_list and config.getbool('config', 'MTD_SINGLE_RUN'):
if ('MTD' in process_list and
config.getbool('config', 'MTD_SINGLE_RUN', False)):
return True

# if running any app other than the reformatters, you need matching FCST/OBS, so don't skip
Expand Down
5 changes: 5 additions & 0 deletions metplus/util/diff_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ def compare_dir(dir_a, dir_b, debug=False, save_diff=False):

for filename in files:
filepath_b = os.path.join(root, filename)

# skip metplus_final.conf
if filepath_b.endswith('metplus_final.conf'):
continue

filepath_a = filepath_b.replace(dir_b, dir_a)
if not os.path.exists(filepath_a):
# check if missing file is actually diff file that was generated
Expand Down
20 changes: 8 additions & 12 deletions metplus/wrappers/cyclone_plotter_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,37 +134,33 @@ def __init__(self, config, instance=None):
else:
self.logger.debug("Getting lons and lats that define the plot's extent")
west_lon = (self.config.getstr('config',
'CYCLONE_PLOTTER_WEST_LON')
'CYCLONE_PLOTTER_WEST_LON', '')
)
east_lon = (self.config.getstr('config',
'CYCLONE_PLOTTER_EAST_LON')
'CYCLONE_PLOTTER_EAST_LON', '')
)
north_lat = (self.config.getstr('config',
'CYCLONE_PLOTTER_NORTH_LAT')
'CYCLONE_PLOTTER_NORTH_LAT', '')
)
south_lat = (self.config.getstr('config',
'CYCLONE_PLOTTER_SOUTH_LAT')
'CYCLONE_PLOTTER_SOUTH_LAT', '')
)

# Check for unconfigured lons and lats needed for defining the extent
if not west_lon:
self.logger.error("Missing CYCLONE_PLOTTER_WEST_LON in config file. ")
sys.exit("Missing the CYCLONE_PLOTTER_WEST_LON please check config file")
self.log_error("Missing CYCLONE_PLOTTER_WEST_LON in config file. ")
else:
self.west_lon = (float(west_lon))
if not east_lon:
self.logger.error("Missing CYCLONE_PLOTTER_EAST_LON in config file. ")
sys.exit("Missing the CYCLONE_PLOTTER_EAST_LON please check config file")
self.log_error("Missing CYCLONE_PLOTTER_EAST_LON in config file. ")
else:
self.east_lon = (float(east_lon))
if not south_lat:
self.logger.error("Missing CYCLONE_PLOTTER_SOUTH_LAT in config file. ")
sys.exit("Missing the CYCLONE_PLOTTER_SOUTH_LAT please check config file")
self.log_error("Missing CYCLONE_PLOTTER_SOUTH_LAT in config file. ")
else:
self.south_lat = float(south_lat)
if not north_lat:
self.logger.error("Missing CYCLONE_PLOTTER_NORTH_LAT in config file. ")
sys.exit("Missing the CYCLONE_PLOTTER_NORTH_LAT please check config file")
self.log_error("Missing CYCLONE_PLOTTER_NORTH_LAT in config file. ")
else:
self.north_lat = float(north_lat)

Expand Down
7 changes: 7 additions & 0 deletions metplus/wrappers/tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class TCPairsWrapper(CommandBuilder):
'METPLUS_VALID_EXC',
'METPLUS_CHECK_DUP',
'METPLUS_INTERP12',
'METPLUS_MATCH_POINTS',
]

WILDCARDS = {
Expand Down Expand Up @@ -177,6 +178,12 @@ def create_c_dict(self):
extra_args={'remove_quotes': True,
'uppercase': True})

self.add_met_config(name='match_points', data_type='bool')

# if unset, set match_points to TRUE to match old default in wrapped
if not self.env_var_dict.get('METPLUS_MATCH_POINTS'):
self.env_var_dict['METPLUS_MATCH_POINTS'] = 'match_points = TRUE;'

c_dict['INIT_INCLUDE'] = getlist(
self.get_wrapper_or_generic_config('INIT_INCLUDE')
)
Expand Down
3 changes: 2 additions & 1 deletion parm/met_config/TCPairsConfig_wrapped
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ anly_track = BDECK;
// Specify if only those track points common to both the ADECK and BDECK
// tracks be written out.
//
match_points = TRUE;
//match_points =
${METPLUS_MATCH_POINTS}

//
// Specify the NetCDF output of the gen_dland tool containing a gridded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,5 @@ TC_PAIRS_MISSING_VAL = -9999
#TC_PAIRS_CHECK_DUP =

#TC_PAIRS_INTERP12 =

#TC_PAIRS_MATCH_POINTS =
2 changes: 2 additions & 0 deletions parm/use_cases/met_tool_wrapper/TCPairs/TCPairs_tropical.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ TC_PAIRS_DLAND_FILE = MET_BASE/tc_data/dland_global_tenth_degree.nc
#TC_PAIRS_CHECK_DUP =

#TC_PAIRS_INTERP12 =

#TC_PAIRS_MATCH_POINTS =
Loading