From 54e3d2bb1bad28370170b6b90919cebc5cb27a98 Mon Sep 17 00:00:00 2001 From: Thomas Gilon Date: Tue, 23 Apr 2024 23:04:26 +0200 Subject: [PATCH 1/7] Fix typo --- scripts/prepare_sector_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/prepare_sector_network.py b/scripts/prepare_sector_network.py index b6ec98b2..9f53e317 100755 --- a/scripts/prepare_sector_network.py +++ b/scripts/prepare_sector_network.py @@ -97,7 +97,7 @@ def define_spatial(nodes, options): spatial.gas.industry = nodes + " gas for industry" spatial.gas.industry_cc = nodes + " gas for industry CC" spatial.gas.biogas_to_gas = nodes + " biogas to gas" - spatial.gas.biogas_to_gas_cc = nodes + "biogas to gas CC" + spatial.gas.biogas_to_gas_cc = nodes + " biogas to gas CC" else: spatial.gas.nodes = ["EU gas"] spatial.gas.locations = ["EU"] From 97035092acc13c87b5cd56b7e9e8d96bf0887439 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 13:20:53 +0200 Subject: [PATCH 2/7] 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] From 315f5ef64ffd701083b10b4c4f11b49473bb9826 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 13:25:13 +0200 Subject: [PATCH 3/7] Update release_notes.rst with hydro bugfix --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index dbc857bc..f65f4cf2 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -172,6 +172,8 @@ Upcoming Release * Bugfix: allow modelling sector-coupled landlocked regions. (Fixed handling of offshore wind.) +* Bugfix: approximation of hydro power generation if Portugal or Spain are not included works now. + * Adapt the disabling of transmission expansion in myopic foresight optimisations when limit is already reached to also handle cost limits. * Fix duplicated years and grouping years reference in `add_land_use_constraint_m`. From 9d36d2bc9b76bf25fa927d63173f6cb4b1226f62 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 13:37:32 +0200 Subject: [PATCH 4/7] Fix copy_timeslice copy timeslice would add data although country not present in load --- scripts/build_electricity_demand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_electricity_demand.py b/scripts/build_electricity_demand.py index 7615bbc6..fc8af372 100755 --- a/scripts/build_electricity_demand.py +++ b/scripts/build_electricity_demand.py @@ -129,7 +129,7 @@ def copy_timeslice(load, cntry, start, stop, delta, fn_load=None): load.loc[start:stop, cntry] = load.loc[ start - delta : stop - delta, cntry ].values - elif fn_load is not None: + elif fn_load is not None and cntry in load: duration = pd.date_range(freq="h", start=start - delta, end=stop - delta) load_raw = load_timeseries(fn_load, duration, [cntry]) load.loc[start:stop, cntry] = load_raw.loc[ From a184f159c0653eaae71d6d64b634af0c60b4f9d1 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 13:38:36 +0200 Subject: [PATCH 5/7] Update release_notes.rst --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index f65f4cf2..b73b56f8 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -174,6 +174,8 @@ Upcoming Release * Bugfix: approximation of hydro power generation if Portugal or Spain are not included works now. +* Bugfix: copy_timeslice does not copy anymore, if country not present in load data. + * Adapt the disabling of transmission expansion in myopic foresight optimisations when limit is already reached to also handle cost limits. * Fix duplicated years and grouping years reference in `add_land_use_constraint_m`. From 3b77b4a370c869d927bf9710c0aeee34a48d7663 Mon Sep 17 00:00:00 2001 From: Johannes Schmidt Date: Mon, 6 May 2024 18:46:04 +0200 Subject: [PATCH 6/7] Fix that code works if either ES or PT is present --- scripts/build_hydro_profile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/build_hydro_profile.py b/scripts/build_hydro_profile.py index f1e56532..ed3bbd1d 100644 --- a/scripts/build_hydro_profile.py +++ b/scripts/build_hydro_profile.py @@ -139,8 +139,10 @@ 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 - if ("ES" and "PT") in runoff: - runoff.loc[1978, ["ES", "PT"]] = runoff.loc[1979, ["ES", "PT"]] + if "ES" in runoff: + runoff.loc[1978, ["ES"]] = runoff.loc[1979, ["ES"]] + if "PT" in runoff: + runoff.loc[1978, ["PT"]] = runoff.loc[1979, ["PT"]] runoff_eia = runoff.loc[eia_stats.index] From ff99db5cb5bf3a703d546a50961b23b5231421ed Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 7 May 2024 10:53:07 +0200 Subject: [PATCH 7/7] Update scripts/build_hydro_profile.py --- scripts/build_hydro_profile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build_hydro_profile.py b/scripts/build_hydro_profile.py index ed3bbd1d..6a0315c7 100644 --- a/scripts/build_hydro_profile.py +++ b/scripts/build_hydro_profile.py @@ -140,9 +140,9 @@ def approximate_missing_eia_stats(eia_stats, runoff_fn, countries): # fix outliers; exceptional floods in 1977-1979 in ES & PT if "ES" in runoff: - runoff.loc[1978, ["ES"]] = runoff.loc[1979, ["ES"]] + runoff.loc[1978, "ES"] = runoff.loc[1979, "ES"] if "PT" in runoff: - runoff.loc[1978, ["PT"]] = runoff.loc[1979, ["PT"]] + runoff.loc[1978, "PT"] = runoff.loc[1979, "PT"] runoff_eia = runoff.loc[eia_stats.index]