Skip to content

Commit

Permalink
nbconvert
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Oct 21, 2024
1 parent bf917d7 commit d42a965
Show file tree
Hide file tree
Showing 70 changed files with 11,112 additions and 17,606 deletions.
600 changes: 0 additions & 600 deletions src/peilbeheerst_model/01_test_parse_crossings.ipynb

This file was deleted.

519 changes: 519 additions & 0 deletions src/peilbeheerst_model/01_test_parse_crossings.py

Large diffs are not rendered by default.

101 changes: 0 additions & 101 deletions src/peilbeheerst_model/01b_ad_krw_to_peilgebieden.ipynb

This file was deleted.

44 changes: 44 additions & 0 deletions src/peilbeheerst_model/01b_ad_krw_to_peilgebieden.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import pathlib

import geopandas as gpd
import pandas as pd
from IPython.core.display import HTML

from peilbeheerst_model import ParseCrossings, waterschap_data

print_df = {}
for waterschap, waterschap_struct in waterschap_data.items():
for funcname, func_args in waterschap_struct.items():
if funcname not in print_df:
print_df[funcname] = []
print_df[funcname].append(pd.Series(func_args, name=waterschap))

for funcname, df in print_df.items():
print(HTML(f"<h2>Function {funcname}:</h2>"))
print(pd.DataFrame(df))


for waterschap, waterschap_struct in waterschap_data.items():
print(f"\n{waterschap}...")

init_settings, crossing_settings = waterschap_struct.values()
gpkg = pathlib.Path(init_settings["output_path"])
if not gpkg.exists():
raise ValueError(gpkg)

df_peilgebieden = gpd.read_file(gpkg, layer="peilgebied")
org_shape = df_peilgebieden.shape
df_peilgebieden = ParseCrossings._make_valid_2dgeom(df_peilgebieden)

df_peilgebieden = ParseCrossings.add_krw_to_peilgebieden(
df_peilgebieden,
init_settings["krw_path"],
init_settings["krw_column_id"],
init_settings["krw_column_name"],
init_settings["krw_min_overlap"],
",",
)

assert df_peilgebieden.shape[0] == org_shape[0]
df_peilgebieden.to_file(gpkg, layer="peilgebied")
print(gpkg)
Loading

0 comments on commit d42a965

Please sign in to comment.