Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexibility to cluster the network to a specified shapefile instead of only GADM regions #486

Open
PeterKlein11 opened this issue Oct 25, 2022 · 4 comments
Labels
alternative_clustering The issue relates to improvements of alternative clustering

Comments

@PeterKlein11
Copy link

The ability to cluster to administrative zones is very helpful. In some cases it would be useful to be able to cluster to a given input shape file as an alternative. One example would be if there are utility supply regions that do not align with administrative boundaries. I am happy to help contribute to this task.

Regards
Peter

@pz-max
Copy link
Member

pz-max commented Oct 25, 2022

Hi Peter,
This contribution is highly welcome! The config.yaml could be modified from:

cluster_options:
alternative_clustering: false # "False" use Voronoi shapes, "True" use GADM shapes

to

cluster_options: 
   clustering_shape: Voronoi   # "Voronoi" network structure, "Gadm" administrative zones, "Custom" any shape

Looking forward to seeing the PR. Feel free to join one of our open workflow meetings if you have questions. This is happening every Thursday between 16-16:30 (UK time). This Thursday between 16-17:00 (Uk time) is also our public/open monthly meeting happening. See agenda.

@davide-f
Copy link
Member

davide-f commented Jan 3, 2025

Hello!

I'm moving here the discussion on #142, with links to #1272, #1248, #979, #700, and maybe #107.
Alternative clustering has risen some attention.
I'll be investigating the feasibility of restructuring the alternative clustering to improve its stability, and report here.

The proposal is to possibly revise the alternative_clustering to disentable build_bus_regions and cluster_network: the bus regions could be created using voronoi or any other shape, whereas the clustering can adopt another shape.

To achieve this, #1195 is needed as it simplifies some parts of the workflow.

We can use this issue to track the updates.

FYI @ekatef and @hazemakhalek

@davide-f
Copy link
Member

davide-f commented Jan 5, 2025

The possible features we can provide to the users while solving these issues are:

  1. disentable the shapes to be possibly used in cluster_network and base_network/build_bus_regions
  2. provide an option to provide custom shape to build_bus_regions within to execute voronoi cells. Instead of performing voronoi cells on country shapes, we can perform it on the custom shapes. This ensures that the geometries of buses in alternative clustering do not overlap. However, I believe other issues will appear with this when there are missing buses in custom shapes, this may be of secondary priority.
  3. merge build_bus_regions and cluster_network (as done in pypsa-eur) and provide an option to this combined rule that allows to specify the bus regions. When that is performed, the nodes of each region are merged. This in principle is equivalent to a pre-clustering of the nodes with custom shapes and could be enhanced in the future.

@yerbol-akhmetov this is partially the answer to your question; feel free to integrate and give your view :)

@ekatef ekatef added the alternative_clustering The issue relates to improvements of alternative clustering label Jan 7, 2025
@choiHenry
Copy link
Contributor

choiHenry commented Jan 8, 2025

  1. provide an option to provide custom shape to build_bus_regions within to execute voronoi cells. Instead of performing voronoi cells on country shapes, we can perform it on the custom shapes. This ensures that the geometries of buses in alternative clustering do not overlap. However, I believe other issues will appear with this when there are missing buses in custom shapes, this may be of secondary priority.

Hi @davide-f and @ekatef. For this providing an option to use custom shapes, I have an interest. I want to use my custom administrative shapes for research. I guess by revising gadm_shapes inputs(in every rule that takes gadm_shapes.geojson...!) in the Snakefile as

"""
Turn off the given gadm_shapes
specify the custom geojson file path
"""
# gadm_shapes="resources/" + RDIR + "shapes/gadm_shapes.geojson",
gadm_shapes="/path/to/custom/shape-file"

Using the above code with the alternative clustering modification in #1272, I could successfully run snakemake -j 1 solve_all_networks and checked the result is consistent with the custom shapes.

I guess this way of replacing all the GADM inputs manually could be improved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alternative_clustering The issue relates to improvements of alternative clustering
Projects
None yet
Development

No branches or pull requests

5 participants