-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
70 changed files
with
11,112 additions
and
17,606 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
101 changes: 0 additions & 101 deletions
101
src/peilbeheerst_model/01b_ad_krw_to_peilgebieden.ipynb
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.