Skip to content
Merged
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
17 changes: 9 additions & 8 deletions process/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ def validate_input(self):
"""Checks the input IN.DAT file for any obsolete variables in the OBS_VARS dict contained
within obsolete_variables.py.
Then will print out what the used obsolete variables are (if any) before continuing the proces run.
#TODO: add a feature to stop 1 and force the variable to be updated if it is now obsolete.
"""

obsolete_variables = ov.OBS_VARS
Expand All @@ -522,18 +521,20 @@ def validate_input(self):
variables = line.strip().split(sep, 1)[0]
variables_in_in_dat.append(variables)

obs_vars_keys = []
for k in obsolete_variables:
obs_vars_keys.append(k)
obs_vars = []
replace_hints = []
for var in variables_in_in_dat:
new_var = obsolete_variables.get(var)
if new_var:
obs_vars.append(var)
replace_hints.append(new_var)

variable_check = any(i in variables_in_in_dat for i in obs_vars_keys)

if variable_check:
if len(replace_hints) > 0:
print(
"The IN.DAT file contains obsolete variables from the OBS_VARS dictionary."
)
print(
f"The obsolete variables in your IN.DAT file are: {set(obs_vars_keys) & set(variables_in_in_dat)}. Please change them to the corresponding new variable(s) before continuing."
f"The obsolete variables in your IN.DAT file are: {obs_vars}. Please change them to the following corresponding new variable(s) before continuing: {replace_hints}."
)
else:
print("The IN.DAT file does not contain any obsolete variables.")
Expand Down