base_network: Add underwater_fraction to links
This commit is contained in:
parent
a3ee75a2a7
commit
4e078002af
@ -260,6 +260,11 @@ def _set_countries_and_substations(n):
|
|||||||
|
|
||||||
return buses
|
return buses
|
||||||
|
|
||||||
|
def _set_links_underwater_fraction(n):
|
||||||
|
offshore_shape = gpd.read_file(snakemake.input.offshore_shapes).set_index('id').unary_union
|
||||||
|
links = gpd.GeoSeries(n.links.geometry.map(loads))
|
||||||
|
n.links['underwater_fraction'] = links.intersection(offshore_shape).length / links.length
|
||||||
|
|
||||||
def base_network():
|
def base_network():
|
||||||
buses = _load_buses_from_eg()
|
buses = _load_buses_from_eg()
|
||||||
|
|
||||||
@ -293,6 +298,8 @@ def base_network():
|
|||||||
|
|
||||||
_set_countries_and_substations(n)
|
_set_countries_and_substations(n)
|
||||||
|
|
||||||
|
_set_links_underwater_fraction(n)
|
||||||
|
|
||||||
return n
|
return n
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user