From 3acc4a22360cbf6c3f22c63880f55c465ee8244b Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Tue, 12 Apr 2022 14:52:37 +0200 Subject: [PATCH 01/12] update country reference from Germany to Belgium in tutorial --- doc/tutorial.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/tutorial.rst b/doc/tutorial.rst index 76970aff..c37abb39 100644 --- a/doc/tutorial.rst +++ b/doc/tutorial.rst @@ -43,7 +43,7 @@ For more information on the data dependencies of PyPSA-Eur, continue reading :re How to customise PyPSA-Eur? =========================== -The model can be adapted to only include selected countries (e.g. Germany) instead of all European countries to limit the spatial scope. +The model can be adapted to only include selected countries (e.g. Belgium) instead of all European countries to limit the spatial scope. .. literalinclude:: ../config.tutorial.yaml :language: yaml From 49f1c0f6299401fc99ea2ebb849ff45be68397a4 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Fri, 15 Apr 2022 18:36:37 +0200 Subject: [PATCH 02/12] Merge pull request #348 from PyPSA/annuity add_electricity: remove vresutils.costdata.annuity dependency --- scripts/add_electricity.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/add_electricity.py b/scripts/add_electricity.py index ad932cd8..ceef2390 100755 --- a/scripts/add_electricity.py +++ b/scripts/add_electricity.py @@ -94,7 +94,6 @@ import geopandas as gpd import powerplantmatching as pm from powerplantmatching.export import map_country_bus -from vresutils.costdata import annuity from vresutils import transfer as vtransfer idx = pd.IndexSlice @@ -105,6 +104,18 @@ logger = logging.getLogger(__name__) def normed(s): return s/s.sum() +def calculate_annuity(n, r): + """Calculate the annuity factor for an asset with lifetime n years and + discount rate of r, e.g. annuity(20, 0.05) * 20 = 1.6""" + + if isinstance(r, pd.Series): + return pd.Series(1/n, index=r.index).where(r == 0, r/(1. - 1./(1.+r)**n)) + elif r > 0: + return r / (1. - 1./(1.+r)**n) + else: + return 1 / n + + def _add_missing_carriers_from_costs(n, costs, carriers): missing_carriers = pd.Index(carriers).difference(n.carriers.index) if missing_carriers.empty: return @@ -138,7 +149,7 @@ def load_costs(tech_costs, config, elec_config, Nyears=1.): "investment" : 0, "lifetime" : 25}) - costs["capital_cost"] = ((annuity(costs["lifetime"], costs["discount rate"]) + + costs["capital_cost"] = ((calculate_annuity(costs["lifetime"], costs["discount rate"]) + costs["FOM"]/100.) * costs["investment"] * Nyears) From dcac3ea6e1f8df9c8eca4e67c87512412310d252 Mon Sep 17 00:00:00 2001 From: martacki Date: Thu, 28 Apr 2022 12:59:25 +0200 Subject: [PATCH 03/12] respect stores in make_summary script --- scripts/make_summary.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index af1ecf36..a14000ef 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -171,6 +171,9 @@ def calculate_capacity(n,label,capacity): if 'p_nom_opt' in c.df.columns: c_capacities = abs(c.df.p_nom_opt.multiply(c.df.sign)).groupby(c.df.carrier).sum() capacity = include_in_summary(capacity, [c.list_name], label, c_capacities) + elif 'e_nom_opt' in c.df.columns: + c_capacities = abs(c.df.e_nom_opt.multiply(c.df.sign)).groupby(c.df.carrier).sum() + capacity = include_in_summary(capacity, [c.list_name], label, c_capacities) for c in n.iterate_components(n.passive_branch_components): c_capacities = c.df['s_nom_opt'].groupby(c.df.carrier).sum() From d12405d848ce83134bf0011f25d2394c020733d4 Mon Sep 17 00:00:00 2001 From: martacki Date: Fri, 29 Apr 2022 13:48:58 +0200 Subject: [PATCH 04/12] respect stores for energy_supply.csv --- scripts/make_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index a14000ef..972b245d 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -235,11 +235,11 @@ def calculate_supply(n, label, supply): def calculate_supply_energy(n, label, supply_energy): """calculate the total dispatch of each component at the buses where the loads are attached""" - load_types = n.loads.carrier.value_counts().index + load_types = n.buses.carrier.unique() for i in load_types: - buses = n.loads.bus[n.loads.carrier == i].values + buses = n.buses.query("carrier == @i").index bus_map = pd.Series(False,index=n.buses.index) From ac7c94337e98735906d87bb2da5c6b1d4bc2a5f2 Mon Sep 17 00:00:00 2001 From: martacki Date: Fri, 29 Apr 2022 13:51:54 +0200 Subject: [PATCH 05/12] respect stores for supply.csv --- scripts/make_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index 972b245d..c070d33f 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -188,11 +188,11 @@ def calculate_capacity(n,label,capacity): def calculate_supply(n, label, supply): """calculate the max dispatch of each component at the buses where the loads are attached""" - load_types = n.loads.carrier.value_counts().index + load_types = n.buses.carrier.unique() for i in load_types: - buses = n.loads.bus[n.loads.carrier == i].values + buses = n.buses.query("carrier == @i").index bus_map = pd.Series(False,index=n.buses.index) From 4706422f4b5e2da52031d59440909374cec35be6 Mon Sep 17 00:00:00 2001 From: Ebbe Kyhl <69363603+ebbekyhl@users.noreply.github.com> Date: Fri, 27 May 2022 16:14:01 +0200 Subject: [PATCH 06/12] Update version of powerplantmatching Hi, I recently became aware that I was using an older version (0.4.8) of the powerplantmatching. I tested my setup with the newer version (0.5.3), and it runs without any issues. The following is a comment/question on the powerplantmatching dataset, which maybe is relevant to mention: With regard to pumped-hydro storage (PHS), the newest version of powerplantmatching entails an energy storage capacity of 4.3 TWh (Europe-aggregate, assuming 6-hours duration for plants that do not have duration specified). In the earlier version 0.4.8, this was vastly overestimated at 10 TWh. As comparison, Geth et al. (2015) showed 1.3 TWh (including Norway and Switzerland) using 2012-numbers. PHS power capacity has increased from roughly 50 to 55 GW from 2014 to 2020 (iha, 2015, 2021), so energy storage capacity most likely is increased as well. But is it fair to say that energy storage capacity has been quadrupled since 2012 (from 1.3 TWh to 4.3 TWh)? Or how can we interpret this difference? Sources: Geth et al., 2015, https://doi.org/10.1016/j.rser.2015.07.145 iha, 2015, https://www.aler-renovaveis.org/contents/lerpublication/iha_2015_sept_hydropower-status-report.pdf iha, 2021, https://assets-global.website-files.com/5f749e4b9399c80b5e421384/60c37321987070812596e26a_IHA20212405-status-report-02_LR.pdf --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 3c69b77b..eaad600f 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -24,7 +24,7 @@ dependencies: - yaml - pytables - lxml - - powerplantmatching>=0.4.8 + - powerplantmatching==0.5.3 - numpy - pandas - geopandas From b6032fb891c3506d1720b0609fa979e6d2d87321 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Sat, 28 May 2022 14:48:32 +0100 Subject: [PATCH 07/12] fix crs bug --- scripts/build_renewable_profiles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build_renewable_profiles.py b/scripts/build_renewable_profiles.py index a2b2eda6..41e1b54d 100644 --- a/scripts/build_renewable_profiles.py +++ b/scripts/build_renewable_profiles.py @@ -240,7 +240,7 @@ if __name__ == '__main__': # use named function np.greater with partially frozen argument instead # and exclude areas where: -max_depth > grid cell depth func = functools.partial(np.greater,-config['max_depth']) - excluder.add_raster(snakemake.input.gebco, codes=func, crs=4236, nodata=-1000) + excluder.add_raster(snakemake.input.gebco, codes=func, crs=4326, nodata=-1000) if 'min_shore_distance' in config: buffer = config['min_shore_distance'] From edb81a9e6a4ce2f7f53aeacf68d15aaa48799509 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Sat, 28 May 2022 14:50:44 +0100 Subject: [PATCH 08/12] add release note --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 3f131dc0..80211635 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -70,6 +70,8 @@ Upcoming Release * Use updated SARAH-2 and ERA5 cutouts with slightly wider scope to east and additional variables. +* Fix crs bug. Change crs 4236 to 4326. + PyPSA-Eur 0.4.0 (22th September 2021) ===================================== From 3bb8a7967a92b15f86ad5d914be1ada37bf60ff2 Mon Sep 17 00:00:00 2001 From: Ebbe Kyhl <69363603+ebbekyhl@users.noreply.github.com> Date: Mon, 30 May 2022 08:15:54 +0200 Subject: [PATCH 09/12] Powerplantmatching version 0.5.3 as lower bound --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index eaad600f..a2cba37f 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -24,7 +24,7 @@ dependencies: - yaml - pytables - lxml - - powerplantmatching==0.5.3 + - powerplantmatching>=0.5.3 - numpy - pandas - geopandas From 798c015bf6e8f34e35d5e9accd5eb0323487c655 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 3 Jun 2022 17:03:10 +0100 Subject: [PATCH 10/12] restrict rasterio version --- envs/environment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index a2cba37f..69025845 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -37,7 +37,7 @@ dependencies: - pyomo - matplotlib - proj - - fiona <= 1.18.20 # Till issue https://github.com/Toblerity/Fiona/issues/1085 is not solved + - fiona<=1.18.20 # Till issue https://github.com/Toblerity/Fiona/issues/1085 is not solved # Keep in conda environment when calling ipython - ipython @@ -45,7 +45,7 @@ dependencies: # GIS dependencies: - cartopy - descartes - - rasterio + - rasterio<=1.2.8 # 1.2.10 creates error https://github.com/PyPSA/atlite/issues/238 # PyPSA-Eur-Sec Dependencies - geopy From 21f627c74ec0b3153d60969f542052694b142e1c Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 3 Jun 2022 17:05:32 +0100 Subject: [PATCH 11/12] update version --- envs/environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/envs/environment.yaml b/envs/environment.yaml index 69025845..f8060de1 100644 --- a/envs/environment.yaml +++ b/envs/environment.yaml @@ -45,7 +45,7 @@ dependencies: # GIS dependencies: - cartopy - descartes - - rasterio<=1.2.8 # 1.2.10 creates error https://github.com/PyPSA/atlite/issues/238 + - rasterio<=1.2.9 # 1.2.10 creates error https://github.com/PyPSA/atlite/issues/238 # PyPSA-Eur-Sec Dependencies - geopy From e974a30fd3dcf6cc8d005251b1247778cdffb933 Mon Sep 17 00:00:00 2001 From: Max Parzen Date: Fri, 3 Jun 2022 17:14:30 +0100 Subject: [PATCH 12/12] add release note --- doc/release_notes.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 80211635..963a1175 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -72,6 +72,8 @@ Upcoming Release * Fix crs bug. Change crs 4236 to 4326. +* Update rasterio version to correctly calculate exclusion raster + PyPSA-Eur 0.4.0 (22th September 2021) =====================================