From 97035092acc13c87b5cd56b7e9e8d96bf0887439 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 13:20:53 +0200 Subject: [PATCH] Fix approximate_missing_eia_stats Function crasehd when 'ET' or 'PT' not present in list of countries. --- scripts/build_hydro_profile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/build_hydro_profile.py b/scripts/build_hydro_profile.py index cd51ce90..f1e56532 100644 --- a/scripts/build_hydro_profile.py +++ b/scripts/build_hydro_profile.py @@ -139,7 +139,8 @@ def approximate_missing_eia_stats(eia_stats, runoff_fn, countries): runoff.index = runoff.index.astype(int) # fix outliers; exceptional floods in 1977-1979 in ES & PT - runoff.loc[1978, ["ES", "PT"]] = runoff.loc[1979, ["ES", "PT"]] + if ("ES" and "PT") in runoff: + runoff.loc[1978, ["ES", "PT"]] = runoff.loc[1979, ["ES", "PT"]] runoff_eia = runoff.loc[eia_stats.index]