Skip to content

Commit

Permalink
Per #2299, updated list of deprecated env vars that were previously u…
Browse files Browse the repository at this point in the history
…sed in wrapped MET config files
  • Loading branch information
georgemccabe committed Sep 14, 2023
1 parent a4d7929 commit e000454
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 30 deletions.
15 changes: 15 additions & 0 deletions metplus/wrappers/ascii2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ class ASCII2NCWrapper(LoopTimesWrapper):
'METPLUS_TIME_SUMMARY_DICT',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'TIME_SUMMARY_FLAG',
'TIME_SUMMARY_RAW_DATA',
'TIME_SUMMARY_BEG',
'TIME_SUMMARY_END',
'TIME_SUMMARY_STEP',
'TIME_SUMMARY_WIDTH',
'TIME_SUMMARY_GRIB_CODES',
'TIME_SUMMARY_VAR_NAMES',
'TIME_SUMMARY_TYPES',
'TIME_SUMMARY_VALID_FREQ',
'TIME_SUMMARY_VALID_THRESH',
]

def __init__(self, config, instance=None):
self.app_name = "ascii2nc"
self.app_path = os.path.join(config.getdir('MET_BIN_DIR', ''),
Expand Down
24 changes: 0 additions & 24 deletions metplus/wrappers/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,30 +305,6 @@ def _handle_window_once(self, input_list, default_val=0):

return default_val

def handle_obs_window_legacy(self, c_dict):
"""! Handle obs window config variables like
OBS_<app_name>_WINDOW_[BEGIN/END]. Set c_dict values for begin and end
to handle old method of setting env vars in MET config files, i.e.
OBS_WINDOW_[BEGIN/END]. Set env_var_dict value if any of the values
are set
@param c_dict dictionary to read items from
"""
edges = [('BEGIN', -5400),
('END', 5400)]
app = self.app_name.upper()

# check {app}_WINDOW_{edge} to support PB2NC_WINDOW_[BEGIN/END]
for edge, default_val in edges:
input_list = [f'OBS_{app}_WINDOW_{edge}',
f'{app}_OBS_WINDOW_{edge}',
f'{app}_WINDOW_{edge}',
f'OBS_WINDOW_{edge}',
]
output_key = f'OBS_WINDOW_{edge}'
value = self._handle_window_once(input_list, default_val)
c_dict[output_key] = value

def handle_file_window_variables(self, c_dict, data_types=None):
"""! Handle all window config variables like
[FCST/OBS]_<app_name>_WINDOW_[BEGIN/END] and
Expand Down
5 changes: 4 additions & 1 deletion metplus/wrappers/ensemble_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ class EnsembleStatWrapper(CompareGriddedWrapper):
'METPLUS_ECLV_POINTS',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'CLIMO_MEAN_FILE',
'CLIMO_STDEV_FILE',
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
]

OUTPUT_FLAGS = [
Expand Down
2 changes: 1 addition & 1 deletion metplus/wrappers/grid_diag_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class GridDiagWrapper(RuntimeFreqWrapper):
'METPLUS_MASK_DICT',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'DESC',
'DATA_FIELD',
Expand Down
12 changes: 11 additions & 1 deletion metplus/wrappers/grid_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,21 @@ class GridStatWrapper(CompareGriddedWrapper):
'METPLUS_SEEPS_P1_THRESH',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
'CLIMO_MEAN_FILE',
'CLIMO_STDEV_FILE',
'VERIF_MASK',
'FCST_FIELD',
'OBS_FIELD',
'FCST_TIME',
'INPUT_BASE',
'NEIGHBORHOOD_WIDTH',
'NEIGHBORHOOD_SHAPE',
'NEIGHBORHOOD_COV_THRESH',
]

OUTPUT_FLAGS = [
Expand Down
16 changes: 15 additions & 1 deletion metplus/wrappers/mode_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,23 @@ class MODEWrapper(CompareGriddedWrapper):
'METPLUS_OBS_MULTIVAR_LEVEL',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
'VERIF_MASK',
'FCST_FIELD',
'OBS_FIELD',
'QUILT',
'FCST_CONV_RADIUS',
'OBS_CONV_RADIUS',
'FCST_CONV_THRESH',
'OBS_CONV_THRESH',
'FCST_MERGE_THRESH',
'OBS_MERGE_THRESH',
'FCST_MERGE_FLAG',
'OBS_MERGE_FLAG',
]

WEIGHTS = {
Expand Down
16 changes: 16 additions & 0 deletions metplus/wrappers/mtd_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ class MTDWrapper(CompareGriddedWrapper):
'METPLUS_OUTPUT_PREFIX',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
'FCST_FIELD',
'OBS_FIELD',
'FCST_CONV_RADIUS',
'OBS_CONV_RADIUS',
'FCST_CONV_THRESH',
'OBS_CONV_THRESH',
'MIN_VOLUME',
'FCST_FILE_TYPE',
'OBS_FILE_TYPE',
]

def __init__(self, config, instance=None):
self.app_name = 'mtd'
self.app_path = os.path.join(config.getdir('MET_BIN_DIR', ''),
Expand Down
16 changes: 16 additions & 0 deletions metplus/wrappers/pb2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ class PB2NCWrapper(LoopTimesWrapper):
'METPLUS_OBS_BUFR_MAP',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'PB2NC_MESSAGE_TYPE',
'PB2NC_STATION_ID',
'OBS_WINDOW_BEGIN',
'OBS_WINDOW_END',
'PB2NC_GRID',
'PB2NC_POLY',
'OBS_BUFR_VAR_LIST',
'TIME_SUMMARY_FLAG',
'TIME_SUMMARY_BEG',
'TIME_SUMMARY_END',
'TIME_SUMMARY_VAR_NAMES',
'TIME_SUMMARY_TYPES',
]

def __init__(self, config, instance=None):
self.app_name = 'pb2nc'
self.app_path = os.path.join(config.getdir('MET_BIN_DIR', ''),
Expand Down
9 changes: 8 additions & 1 deletion metplus/wrappers/point_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ class PointStatWrapper(CompareGriddedWrapper):
'METPLUS_SEEPS_P1_THRESH',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
'CLIMO_MEAN_FILE',
'CLIMO_STDEV_FILE',
'FCST_FIELD',
'OBS_FIELD',
'OBS_WINDOW_BEGIN',
'OBS_WINDOW_END',
'POINT_STAT_POLY',
'POINT_STAT_GRID',
'POINT_STAT_STATION_ID',
Expand Down
10 changes: 9 additions & 1 deletion metplus/wrappers/series_analysis_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,20 @@ class SeriesAnalysisWrapper(RuntimeFreqWrapper):
'METPLUS_MASK_DICT',
]

# handle deprecated env vars used pre v4.0.0
# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'MODEL',
'OBTYPE',
'REGRID_TO_GRID',
'CLIMO_MEAN_FILE',
'CLIMO_STDEV_FILE',
'METPLUS_CTS_LIST',
'METPLUS_STAT_LIST',
'FCST_FILE_TYPE',
'OBS_FILE_TYPE',
'FCST_FIELD',
'OBS_FIELD',
'STAT_LIST',
]

# variable names of output_stats dictionary
Expand Down
16 changes: 16 additions & 0 deletions metplus/wrappers/tc_pairs_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ class TCPairsWrapper(RuntimeFreqWrapper):
'METPLUS_DIAG_CONVERT_MAP_LIST',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'INIT_BEG',
'INIT_END',
'VALID_BEG',
'VALID_END',
'INIT_INCLUDE',
'INIT_EXCLUDE',
'MODEL',
'STORM_ID',
'BASIN',
'CYCLONE',
'STORM_NAME',
'DLAND_FILE',
]

WILDCARDS = {
'basin': '??',
'cyclone': '*',
Expand Down
40 changes: 40 additions & 0 deletions metplus/wrappers/tc_stat_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,46 @@ class TCStatWrapper(RuntimeFreqWrapper):
'METPLUS_OUT_VALID_MASK',
]

# deprecated env vars that are no longer supported in the wrapped MET conf
DEPRECATED_WRAPPER_ENV_VAR_KEYS = [
'AMODEL',
'BMODEL',
'DESC',
'STORM_ID',
'BASIN',
'CYCLONE',
'STORM_NAME',
'INIT_INCLUDE',
'INIT_EXCLUDE',
'VALID_INCLUDE',
'VALID_EXCLUDE',
'INIT_HOUR',
'VALID_HOUR',
'LEAD',
'LEAD_REQ',
'INIT_MASK',
'VALID_MASK',
'TRACK_WATCH_WARN',
'COLUMN_THRESH_NAME',
'COLUMN_THRESH_VAL',
'COLUMN_STR_NAME',
'COLUMN_STR_VAL',
'INIT_THRESH_NAME',
'INIT_THRESH_VAL',
'INIT_STR_NAME',
'INIT_STR_VAL',
'JOBS',
'INIT_BEG',
'INIT_END',
'VALID_BEG',
'VALID_END',
'LANDFALL_BEG',
'LANDFALL_END',
'WATER_ONLY',
'LANDFALL',
'MATCH_POINTS',
]

def __init__(self, config, instance=None):
self.app_name = 'tc_stat'
self.app_path = os.path.join(config.getdir('MET_BIN_DIR', ''),
Expand Down

0 comments on commit e000454

Please sign in to comment.