Fix approximate_missing_eia_stats

Function crasehd when 'ET' or 'PT' not present in list of countries.
This commit is contained in:
Johannes Schmidt 2024-05-06 13:20:53 +02:00 committed by GitHub
parent c05cfff765
commit 97035092ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -139,7 +139,8 @@ def approximate_missing_eia_stats(eia_stats, runoff_fn, countries):
runoff.index = runoff.index.astype(int) runoff.index = runoff.index.astype(int)
# fix outliers; exceptional floods in 1977-1979 in ES & PT # 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] runoff_eia = runoff.loc[eia_stats.index]