pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

Duplicated offshore regions

Open p-glaum opened this issue 3 years ago • 7 comments

Checklist

  • [x] I am using the current master branch or the latest release. Please indicate.
  • [x] I am running on an up-to-date pypsa-eur environment. Update via conda env update -f envs/environment.yaml.

Describe the Bug

This is not a real bug, as it does not cause any error. However, in the offshore regions there are bus regions which have exactly the same shape (polygon)

Can be fixed with a one-liner in build_bus_regions

p-glaum avatar Jul 19 '22 14:07 p-glaum

Noticed that, too. I think it's worth fixing. If you know how, go ahead!

fneum avatar Feb 22 '23 17:02 fneum

I just remove the duplicate regions afterwards but I did not dig deeper into the cause. I am not sure if there are identical buses as well. For my fix, I just did:

offshore_regions_c.drop_duplicates(subset="geometry", inplace=True ) 

p-glaum avatar Feb 23 '23 07:02 p-glaum

I just remove the duplicate regions afterwards but I did not dig deeper into the cause. I am not sure if there are identical buses as well.

Could you quickly check that? At least then we know where this is coming from.

FabianHofmann avatar Feb 23 '23 08:02 FabianHofmann

I just checked and apparently there are buses with an offshore substation having identical x and y coordinates (bus (5859, 5860), (6660, 6661) and (6744, 6745)). This is an error in the buses.csv, as there are duplicated entries for those buses. So we can just adjust it under data/entsoegridkit/buses.csv

p-glaum avatar Feb 24 '23 10:02 p-glaum

I will open a PR

p-glaum avatar Feb 24 '23 10:02 p-glaum

Thanks for tracing the bug to its origin @p-glaum !

fneum avatar Feb 24 '23 10:02 fneum

Apparently, the substation have the same coordinates but not the same voltage level. In the script base_network, for the "substations_off" they select the substation with the higher voltage level for on onshore buses. But the problem there is for the buses which are offshore, there is no such filter that only the high voltage buses are selected. So for a few offshore buses, there are two voltage levels and both are selected which duplicates the regions.

https://github.com/PyPSA/pypsa-eur/blob/80eadcf24aea9b1805d8ebfa66de0422e10f0c04/scripts/base_network.py#L546-L548

I am not 100% sure if we can just have instead:

buses["substation_off"] = ((hv_b & offshore_b) | (hv_b & onshore_b)) & (
        ~buses["under_construction"]
    )

p-glaum avatar Jun 09 '23 06:06 p-glaum