cluster: skip recalculation of link parameters if empty (#149)
This commit is contained in:
parent
fbbf1ba0ee
commit
3c1c604c7e
@ -262,13 +262,15 @@ def clustering_for_n_clusters(n, n_clusters, aggregate_carriers=None,
|
|||||||
generator_strategies={'p_nom_max': p_nom_max_strategy},
|
generator_strategies={'p_nom_max': p_nom_max_strategy},
|
||||||
scale_link_capital_costs=False)
|
scale_link_capital_costs=False)
|
||||||
|
|
||||||
nc = clustering.network
|
if not n.links.empty:
|
||||||
nc.links['underwater_fraction'] = (n.links.eval('underwater_fraction * length')
|
nc = clustering.network
|
||||||
.div(nc.links.length).dropna())
|
nc.links['underwater_fraction'] = (n.links.eval('underwater_fraction * length')
|
||||||
nc.links['capital_cost'] = (nc.links['capital_cost']
|
.div(nc.links.length).dropna())
|
||||||
.add((nc.links.length - n.links.length)
|
nc.links['capital_cost'] = (nc.links['capital_cost']
|
||||||
.clip(lower=0).mul(extended_link_costs),
|
.add((nc.links.length - n.links.length)
|
||||||
fill_value=0))
|
.clip(lower=0).mul(extended_link_costs),
|
||||||
|
fill_value=0))
|
||||||
|
|
||||||
return clustering
|
return clustering
|
||||||
|
|
||||||
def save_to_geojson(s, fn):
|
def save_to_geojson(s, fn):
|
||||||
|
Loading…
Reference in New Issue
Block a user