Skip to content

Commit

Permalink
update logging and add try except
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert John committed Oct 18, 2024
1 parent d89bd65 commit 78f6c2d
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ def create_tables():

def update_kba_filename_from_scenario_year(fn, scenario):
"""filename containing hardcoded DATE string. replace with scenario year from param"""
year = str(int(scenario.split("status20")[1]) + 1)
print(f"fn {fn}; scenario {scenario}; year {year}")
print("type(year)", type(year), "len(year)", len(year))
return fn.replace("YEAR", year)
year = str(int(scenario.split("status")[1]) + 1)
print(f"fn {fn}; scenario {scenario}; year {year}", "type(year)", type(year), "len(year)", len(year))
try:
return fn.replace("YEAR", year)
except Exception as E:
print(f"fn is {fn}. year is {year}. Setting year=2020 hard. Cannot replace year due to {E}.")
return fn.replace("YEAR", "2020")


def download_and_preprocess():
Expand Down

0 comments on commit 78f6c2d

Please sign in to comment.