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

bugfix 1486 pb2nc window variables #1507

Merged
merged 1 commit into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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