From fbbf1ba0ee190ea5c9f2b88d5ad2559662d3e478 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Mon, 23 Mar 2020 17:05:59 +0100 Subject: [PATCH 1/2] environment: PyPSA 0.17 --- environment.docs.yaml | 3 +-- environment.yaml | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/environment.docs.yaml b/environment.docs.yaml index 1c60e90a..19c3d224 100755 --- a/environment.docs.yaml +++ b/environment.docs.yaml @@ -5,7 +5,7 @@ channels: dependencies: #- python - pip - # - pypsa>=0.16 # until PyPSA/a3c0991 released + - pypsa>=0.17 - atlite # Dependencies of the workflow itself @@ -47,7 +47,6 @@ dependencies: - vresutils==0.3.1 - git+https://github.com/PyPSA/glaes.git#egg=glaes - git+https://github.com/PyPSA/geokit.git#egg=geokit - - git+https://github.com/PyPSA/pypsa.git#egg=pypsa # until PyPSA/a3c0991 released - cdsapi - sphinx - sphinx_rtd_theme diff --git a/environment.yaml b/environment.yaml index 39e85c49..72da4445 100644 --- a/environment.yaml +++ b/environment.yaml @@ -8,7 +8,7 @@ dependencies: - python - pip - # - pypsa>=0.16 # until PyPSA/a3c0991 released + - pypsa>=0.17 - atlite # Dependencies of the workflow itself @@ -53,5 +53,4 @@ dependencies: - vresutils==0.3.1 - git+https://github.com/PyPSA/glaes.git#egg=glaes - git+https://github.com/PyPSA/geokit.git#egg=geokit - - git+https://github.com/PyPSA/pypsa.git#egg=pypsa # until PyPSA/a3c0991 released - cdsapi From 3c1c604c7e6424b657d5970eff012432bd0fbfb0 Mon Sep 17 00:00:00 2001 From: Fabian Neumann Date: Sun, 29 Mar 2020 11:39:18 +0200 Subject: [PATCH 2/2] cluster: skip recalculation of link parameters if empty (#149) --- scripts/cluster_network.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/cluster_network.py b/scripts/cluster_network.py index 6e07ae4f..cc1ac54a 100644 --- a/scripts/cluster_network.py +++ b/scripts/cluster_network.py @@ -262,13 +262,15 @@ def clustering_for_n_clusters(n, n_clusters, aggregate_carriers=None, generator_strategies={'p_nom_max': p_nom_max_strategy}, scale_link_capital_costs=False) - nc = clustering.network - nc.links['underwater_fraction'] = (n.links.eval('underwater_fraction * length') - .div(nc.links.length).dropna()) - nc.links['capital_cost'] = (nc.links['capital_cost'] - .add((nc.links.length - n.links.length) - .clip(lower=0).mul(extended_link_costs), - fill_value=0)) + if not n.links.empty: + nc = clustering.network + nc.links['underwater_fraction'] = (n.links.eval('underwater_fraction * length') + .div(nc.links.length).dropna()) + nc.links['capital_cost'] = (nc.links['capital_cost'] + .add((nc.links.length - n.links.length) + .clip(lower=0).mul(extended_link_costs), + fill_value=0)) + return clustering def save_to_geojson(s, fn):