Skip to content

Commit

Permalink
bugfix 1486 pb2nc window variables (#1507)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemccabe authored Mar 11, 2022
1 parent c6c9d67 commit 081f73f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal_tests/pytests/pb2nc/test_pb2nc_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ def test_find_input_files(metplus_config, offsets, offset_to_find):
'OBS_PB2NC_WINDOW_END': '1800',
},
{'METPLUS_OBS_WINDOW_DICT': 'obs_window = {beg = -1800;end = 1800;}'}),
# test legacy PB2NC_WINDOW_[BEGIN/END]
({'PB2NC_WINDOW_BEGIN': '-1800', },
{'METPLUS_OBS_WINDOW_DICT': 'obs_window = {beg = -1800;}'}),
({'PB2NC_WINDOW_END': '1800', },
{'METPLUS_OBS_WINDOW_DICT': 'obs_window = {end = 1800;}'}),
({'PB2NC_MASK_GRID': 'FULL', },
{'METPLUS_MASK_DICT': 'mask = {grid = "FULL";}'}),
Expand Down
6 changes: 6 additions & 0 deletions metplus/util/met_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ def add_met_config_dict(config, app_name, output_dict, dict_name, items):
metplus_configs.append(
f"OBS_{app_name}_WINDOW_{suffix}".upper()
)

# also add support for legacy PB2NC_WINDOW_[BEGIN/END]
metplus_configs.append(
f"{app_name}_WINDOW_{suffix}".upper()
)

# also add OBS_WINDOW_[BEGIN/END]
metplus_configs.append(f"OBS_WINDOW_{suffix}")

Expand Down
2 changes: 2 additions & 0 deletions metplus/wrappers/command_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,11 @@ def handle_obs_window_legacy(self, c_dict):
('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}'
Expand Down

0 comments on commit 081f73f

Please sign in to comment.