Skip to content

Commit

Permalink
Deduplicate shortest path code (#176)
Browse files Browse the repository at this point in the history
The code was identical except for comments and print statements. So now
we move it all into a single function that is part of the package, so
the individual scripts are just a few lines.

Only AGV was an outlier since it had a lot of code after the shared
code. Perhaps @rbruijnshkv can comment on if that is needed or not.
Another difference I noticed is this, AGV has this set to 5:

```
        distance_interval = 50  # The distance interval you want to segment the lines at
```

This only deduplicates, I didn't want to start modifying the code at the
same time. So I cannot run it since it relies on local paths that I
don't have.
  • Loading branch information
visr authored Oct 22, 2024
1 parent 0e367e1 commit 68c5dbc
Show file tree
Hide file tree
Showing 14 changed files with 479 additions and 4,773 deletions.
3 changes: 2 additions & 1 deletion pixi.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14706,9 +14706,10 @@ packages:
name: peilbeheerst-model
version: 0.1.0
path: src/peilbeheerst_model
sha256: 21b935f0542b5dbb76baaf1944b11ef6fab94b5a5926565410fe3d62722c332d
sha256: e8c270f68d683c802990a8bb905cd665fd327b33e1d17bf3e01dfe9c49ec335e
requires_dist:
- geopandas
- matplotlib
- numpy
- pandas
- pydantic
Expand Down

Large diffs are not rendered by default.

454 changes: 2 additions & 452 deletions src/peilbeheerst_model/Shortest_path/02_shortest_path_HHSK.py

Large diffs are not rendered by default.

454 changes: 2 additions & 452 deletions src/peilbeheerst_model/Shortest_path/03_shortest_path_HHNK.py

Large diffs are not rendered by default.

453 changes: 2 additions & 451 deletions src/peilbeheerst_model/Shortest_path/04_shortest_path_Delfland.py

Large diffs are not rendered by default.

Large diffs are not rendered by default.

458 changes: 2 additions & 456 deletions src/peilbeheerst_model/Shortest_path/06_shortest_path_Zuiderzeeland.py

Large diffs are not rendered by default.

453 changes: 2 additions & 451 deletions src/peilbeheerst_model/Shortest_path/07_shortest_path_WSRL.py

Large diffs are not rendered by default.

454 changes: 2 additions & 452 deletions src/peilbeheerst_model/Shortest_path/08_shortest_path_Wetterskip.py

Large diffs are not rendered by default.

457 changes: 2 additions & 455 deletions src/peilbeheerst_model/Shortest_path/09_shortest_path_Rijnland.py

Large diffs are not rendered by default.

700 changes: 3 additions & 697 deletions src/peilbeheerst_model/Shortest_path/10_shortest_path_AGV.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/peilbeheerst_model/peilbeheerst_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
__version__ = "0.1.0"

from peilbeheerst_model.parse_crossings import ParseCrossings
from peilbeheerst_model.shortest_path import shortest_path_waterschap
from peilbeheerst_model.waterschappen import waterschap_data

__all__ = ["ParseCrossings", "waterschap_data"]
__all__ = ["ParseCrossings", "shortest_path_waterschap", "waterschap_data"]
443 changes: 443 additions & 0 deletions src/peilbeheerst_model/peilbeheerst_model/shortest_path.py

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion src/peilbeheerst_model/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@ authors = [
license = { text = "MIT" }

requires-python = ">=3.10"
dependencies = ["geopandas", "numpy", "pandas", "pydantic", "shapely", "tqdm", "matplotlib"]
dependencies = [
"geopandas",
"numpy",
"pandas",
"pydantic",
"shapely",
"tqdm",
"matplotlib",
"fiona",
"networkx",
]
dynamic = ["version"]

[project.optional-dependencies]
Expand Down

0 comments on commit 68c5dbc

Please sign in to comment.