selective cherry-pick from 91eff472a7

This commit is contained in:
Fabian Neumann 2024-02-12 10:12:03 +01:00
parent 94f72d7276
commit 49171901d7

View File

@ -68,8 +68,6 @@ def load_timeseries(fn, years, countries):
load : pd.DataFrame load : pd.DataFrame
Load time-series with UTC timestamps x ISO-2 countries Load time-series with UTC timestamps x ISO-2 countries
""" """
logger.info(f"Retrieving load data from '{fn}'.")
return ( return (
pd.read_csv(fn, index_col=0, parse_dates=[0], date_format="%Y-%m-%dT%H:%M:%SZ") pd.read_csv(fn, index_col=0, parse_dates=[0], date_format="%Y-%m-%dT%H:%M:%SZ")
.tz_localize(None) .tz_localize(None)
@ -182,20 +180,26 @@ def manual_adjustment(load, fn_load):
Manual adjusted and interpolated load time-series with UTC Manual adjusted and interpolated load time-series with UTC
timestamps x ISO-2 countries timestamps x ISO-2 countries
""" """
if "MK" in load:
if "AL" not in load or load.AL.isnull().values.all():
load["AL"] = load["MK"] * (4.1 / 7.4)
if "RS" in load:
if "KV" not in load or load.KV.isnull().values.all():
load["KV"] = load["RS"] * (4.8 / 27.0)
if "ME" in load:
if "AL" not in load and "AL" in countries: if "AL" not in load and "AL" in countries:
if "ME" in load:
load["AL"] = load.ME * (5.7 / 2.9) load["AL"] = load.ME * (5.7 / 2.9)
if "MK" not in load and "MK" in countries: elif "MK" in load:
load["AL"] = load["MK"] * (4.1 / 7.4)
if "MK" in countries:
if "MK" not in load or load.MK.isnull().sum() > len(load) / 2:
if "ME" in load:
load["MK"] = load.ME * (6.7 / 2.9) load["MK"] = load.ME * (6.7 / 2.9)
if "BA" not in load and "BA" in countries: if "BA" not in load and "BA" in countries:
if "ME" in load:
load["BA"] = load.HR * (11.0 / 16.2) load["BA"] = load.HR * (11.0 / 16.2)
if "KV" not in load or load.KV.isnull().values.all():
if "RS" in load:
load["KV"] = load["RS"] * (4.8 / 27.0)
copy_timeslice(load, "GR", "2015-08-11 21:00", "2015-08-15 20:00", Delta(weeks=1)) copy_timeslice(load, "GR", "2015-08-11 21:00", "2015-08-15 20:00", Delta(weeks=1))
copy_timeslice(load, "AT", "2018-12-31 22:00", "2019-01-01 22:00", Delta(days=2)) copy_timeslice(load, "AT", "2018-12-31 22:00", "2019-01-01 22:00", Delta(days=2))
copy_timeslice(load, "CH", "2010-01-19 07:00", "2010-01-19 22:00", Delta(days=1)) copy_timeslice(load, "CH", "2010-01-19 07:00", "2010-01-19 22:00", Delta(days=1))
@ -258,7 +262,7 @@ if __name__ == "__main__":
if "snakemake" not in globals(): if "snakemake" not in globals():
from _helpers import mock_snakemake from _helpers import mock_snakemake
snakemake = mock_snakemake("build_electricity_demand") snakemake = mock_snakemake("build_electricity_demand", run="network2019")
configure_logging(snakemake) configure_logging(snakemake)