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

Spatial cluster refactor #673

Merged
merged 13 commits into from Jul 11, 2023
Merged

Spatial cluster refactor #673

merged 13 commits into from Jul 11, 2023

Conversation

FabianHofmann
Copy link
Collaborator

  • The spatial clustering module was refactored. The changes lead to performance improvements and a more consistent clustering API.
    • The network object has a new accessor cluster which allows accessing clustering routines from the network itself. For example, n.cluster.cluster_spatially_by_kmeans returns a spatially clustered version of the network.
    • The default clustering strategies were refined. Per default, columns like efficiency and p_max_pu are now aggregated by the capacity weighted mean.
    • The clustering module now applies the custom strategies to time-dependant data.
    • Breaking change: The Clustering class no longer contains a positive and negative linemap.

Checklist

  • Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • Newly introduced dependencies are added to environment.yaml, environment_docs.yaml and setup.py (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • I consent to the release of this PR's code under the MIT license.

@codecov
Copy link

codecov bot commented Jul 10, 2023

Codecov Report

Patch coverage: 85.85% and project coverage change: +1.04 🎉

Comparison is base (ee13f0b) 77.42% compared to head (c41e5ec) 78.47%.

❗ Current head c41e5ec differs from pull request most recent head 881b46f. Consider uploading reports for the commit 881b46f to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #673      +/-   ##
==========================================
+ Coverage   77.42%   78.47%   +1.04%     
==========================================
  Files          27       28       +1     
  Lines        6699     6691       -8     
  Branches     1424     1398      -26     
==========================================
+ Hits         5187     5251      +64     
+ Misses       1208     1136      -72     
  Partials      304      304              
Impacted Files Coverage Δ
pypsa/clustering/__init__.py 82.75% <81.48%> (-17.25%) ⬇️
pypsa/clustering/spatial.py 70.00% <86.36%> (+26.82%) ⬆️
pypsa/components.py 78.11% <100.00%> (ø)

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@fneum fneum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, provided that test with PyPSA-Eur checks out!

Is test/test_networkclustering_module.py still needed or obsolete now?

doc/release_notes.rst Outdated Show resolved Hide resolved
@FabianHofmann
Copy link
Collaborator Author

Double-checked against pypsa-eur

@FabianHofmann FabianHofmann enabled auto-merge (squash) July 11, 2023 08:15
@fneum fneum disabled auto-merge July 11, 2023 08:28
@fneum fneum merged commit 8c330f3 into master Jul 11, 2023
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants