Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
197037b
Bugfix validation
VincentJilesen May 11, 2026
bd77007
validation bugfix kolom soms niet numeric gelezen.
VincentJilesen May 11, 2026
b0c86a7
fix voor extreme waarden van pof en beta
VincentJilesen May 11, 2026
c20bc26
BaseInquiry class
VincentJilesen May 12, 2026
d65fb93
Standaard opvragen lijnen en metadata tabel aanpassing
VincentJilesen May 13, 2026
a82062c
WIP 13-05
VincentJilesen May 13, 2026
2340565
base_inquiry afgerond
VincentJilesen May 19, 2026
5cc4692
ShapeCouple class
VincentJilesen May 19, 2026
cfdcd9d
WIP 19-05
VincentJilesen May 19, 2026
0613d16
WIP 20-05: totaan rasters
VincentJilesen May 20, 2026
5a8d77b
wip 20-05 begin van aanpassen via parameter invoer keuze menu
VincentJilesen May 20, 2026
309d2ef
Bugfixes for test; check imports minder gevoeligheid voor circulaire …
VincentJilesen May 21, 2026
847ebbd
WIP 2105: gpkg import, batch_input, lines per scenario, polderpeil ni…
VincentJilesen May 21, 2026
d70db37
batch_invoer
VincentJilesen May 22, 2026
b036903
update keuzemenu
VincentJilesen May 22, 2026
2dfdc59
clean up while loops and placeholders
VincentJilesen May 22, 2026
c783c0b
bug fixes
VincentJilesen May 26, 2026
dbe02d9
bugfix polderpeil en maps
VincentJilesen May 26, 2026
65721a2
batch inquiry flag and explanation in .ini
VincentJilesen May 26, 2026
98b8327
shape couple bugfix punten buiten de polygon, geherordend exand_df
VincentJilesen May 26, 2026
7fa8ede
update todo
VincentJilesen May 26, 2026
2d84cf7
spellcheck
VincentJilesen May 27, 2026
4054cab
bugfix
VincentJilesen May 27, 2026
cc135c3
icicle bugfix
VincentJilesen May 27, 2026
b9c6c28
refactor
VincentJilesen May 29, 2026
cf5e3a2
test en fixes lijn invoer
VincentJilesen Jun 1, 2026
a297762
update database invoer bugfix
VincentJilesen Jun 1, 2026
8124014
bugfix distance lijnen
VincentJilesen Jun 2, 2026
e913eb8
beta map bugfix en comparison fix
VincentJilesen Jun 2, 2026
44787b0
documentatie
VincentJilesen Jun 2, 2026
ee81785
ruimtelijke invoer keuze menu restart flag
VincentJilesen Jun 3, 2026
eef4132
legenda betrouwbaarheidsindex grafiek buiten de plot geplaatst en wat…
VincentJilesen Jun 3, 2026
cd4eb9a
river_waterlevel documentatie
VincentJilesen Jun 3, 2026
f815be2
overview_alphas update met sceario namen en clean-up
VincentJilesen Jun 3, 2026
baa8cd4
overview_alphas documentatie
VincentJilesen Jun 3, 2026
046bfc7
views vervangen door copies in icicle
VincentJilesen Jun 3, 2026
4f5e9b1
a_vak en delta_length aan excel toegevoegd nog niet uitgelzen
VincentJilesen Jun 4, 2026
e691c4b
databese table hernoemt
VincentJilesen Jun 4, 2026
d463575
database uitgebreidt
VincentJilesen Jun 4, 2026
8bcb7b0
pandas tabellen correct ingevoerd, te openen in arcgis
VincentJilesen Jun 4, 2026
c7f6966
data__gis_parameter_invoer fix
VincentJilesen Jun 4, 2026
5e0fa9a
documentaie en fix voor physical_values
VincentJilesen Jun 4, 2026
8ea7ba9
a_vak en delta length uitgelezen
VincentJilesen Jun 4, 2026
e81252b
leesbaarheid
VincentJilesen Jun 4, 2026
a96961b
avak en dl toegevoegd aan valif parameters
VincentJilesen Jun 5, 2026
15980ff
fixme: a_vak in ReliabityProject
VincentJilesen Jun 5, 2026
ae3528a
test for check expanded parameters table
VincentJilesen Jun 9, 2026
5e301ff
bugfix expended invoer table
VincentJilesen Jun 9, 2026
82b2f68
WIP test
VincentJilesen Jun 9, 2026
a8257f6
validator stap 1 wip
VincentJilesen Jun 10, 2026
855ad46
validator voor de expanded-table
VincentJilesen Jun 11, 2026
a33b7a4
volgorde fix
VincentJilesen Jun 11, 2026
9f9f561
hrd fix en correctie in element_list
VincentJilesen Jun 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/rekenmethodiek/geohydrologische_modellen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ verschilt.
De grondwaterstroming vormt de drijvende kracht achter het proces van terugschrijdende erosie.
Door het analytische grondwatermodel 4A van :cite:`trw_2004` toe te passen,
kan de respons :math:`r_{exit}` in het uittredepunt worden beschreven als functie van de locatie in het
dwarspofiel :math:`x_{exit}` [m] en de geohydrologische parameters van model 4A.
dwarsprofiel :math:`x_{exit}` [m] en de geohydrologische parameters van model 4A.
Een uitgebreide toelichting op de onderliggende theorie van dit model is te vinden in :ref:`stationair-model`.

De respons in het uittredepunt wordt bepaald met:
Expand Down
15 changes: 13 additions & 2 deletions geoprob_pipe/app_object.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations
import os
import sqlite3
from datetime import datetime
from typing import TYPE_CHECKING, Optional, List
import pandas as pd
Expand All @@ -22,6 +23,8 @@
from geoprob_pipe.visualizations import Visualizations
from geoprob_pipe.calculations.systems.build_and_run import build_and_run_system_calculations
from geoprob_pipe.utils.update_metadata import update_metadata
from geoprob_pipe.utils.sql_contents import write_dfs_to_gpkg

import logging
if TYPE_CHECKING:
from geoprob_pipe.calculations.systems.build_and_run import CalcResult
Expand Down Expand Up @@ -51,6 +54,14 @@ def __init__(self, app_settings: ApplicationSettings) -> None:
self.time_start = datetime.now()

self.input_data = InputData(app_settings=app_settings) # TODO: Alter with new option

self.df_expanded = run_expand_input_tables(geopackage_filepath=self.input_data.app_settings.geopackage_filepath)
# TODO VJ: vind een betere plaats hiervoor
conn = sqlite3.connect(app_settings.geopackage_filepath)
df_add = self.df_expanded.copy()
df_add["parameter_input"] = df_add["parameter_input"].apply(str)
write_dfs_to_gpkg(conn, {"data__expanded_parameters": df_add})
conn.close()

# Read calculation settings
# self._read_calculation_settings() # TODO: Not part of new version
Expand Down Expand Up @@ -98,10 +109,10 @@ def export_archive(self):
self.spatial.export_geopackage()

# Parameter invoer als expanded
df_expanded = run_expand_input_tables(geopackage_filepath=self.input_data.app_settings.geopackage_filepath)

input_dir = os.path.join(export_dir, "input")
os.makedirs(input_dir, exist_ok=True)
df_expanded.to_excel(excel_writer=os.path.join(input_dir, "df_parameter_invoer_expanded.xlsx"), index=False)
self.df_expanded.to_excel(excel_writer=os.path.join(input_dir, "df_parameter_invoer_expanded.xlsx"), index=False)

# Input parameter figures
obj = InputParameterFigures.populate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _gather_variable_correlations(geopackage_filepath: str
conn = sqlite3.connect(geopackage_filepath)
cursor = conn.cursor()
cursor.execute("""
SELECT parameter_a, parameter_b, correlation FROM correlatie_invoer
SELECT parameter_a, parameter_b, correlation FROM data__correlatie_invoer
WHERE correlation <> 0.0;
""")
rows = cursor.fetchall() # This will be a list of tuples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def _validate_distributions_are_provided():
def _apply_distributions_on_variables():
for item in system_calculation.setup.distributions:
name = item['name']

# TODO FIXME a_vak en delta_length geven een validation msg, deze worden niet in dit gebruikt.
# Check if variable exists
if system_calculation.results.reliability_project.variables[name] is None:
system_calculation.validation_messages.add_warning(
Expand Down
18 changes: 18 additions & 0 deletions geoprob_pipe/calculations/systems/model4a/initial_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,22 @@
"mean": 0.3,
"source": "excel",
},
{
"name": "a_vak",
"description": "De mechanisme gevoelige fractie van het element.",
"remark": "",
"unit": "-",
"distribution_type": DistributionType.deterministic,
"mean": 1.0,
"source": "excel"
},
{
"name": "delta_length",
"description": "De equivalente onafhankelijke lengte voor STPH.",
"remark": "",
"unit": "m",
"distribution_type": DistributionType.deterministic,
"mean": 300.0,
"source": "excel"
},
]
20 changes: 19 additions & 1 deletion geoprob_pipe/calculations/systems/moria/initial_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
"remark": "",
"unit": "kN/m³",
"distribution_type": DistributionType.deterministic,
"mean": 16.5,
"mean": 26.0,
"source": "excel",
},
{
Expand All @@ -288,4 +288,22 @@
"mean": 0.3,
"source": "excel",
},
{
"name": "a_vak",
"description": "De mechanisme gevoelige fractie van het element.",
"remark": "",
"unit": "-",
"distribution_type": DistributionType.deterministic,
"mean": 1.0,
"source": "excel"
},
{
"name": "delta_length",
"description": "De equivalente onafhankelijke lengte voor STPH.",
"remark": "",
"unit": "m",
"distribution_type": DistributionType.deterministic,
"mean": 300.0,
"source": "excel"
},
]
2 changes: 1 addition & 1 deletion geoprob_pipe/calculations/systems/single_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def reproduce_single_calculation(
conn = sqlite3.connect(geopackage_filepath)
cursor = conn.cursor()
cursor.execute(
'SELECT "values" FROM geoprob_pipe_metadata WHERE metadata_type = ?',
'SELECT metadata_value FROM geoprob_pipe_metadata WHERE metadata_type = ?',
("geohydrologisch_model",))
geohydrologisch_model: str = cursor.fetchone()[0]

Expand Down
4 changes: 2 additions & 2 deletions geoprob_pipe/calculations/systems/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
GAMMA_KORREL = ColumnValidation(column_name="mean", requirements=[
ValidationRequirement(
requirement=requirements.is_in_range(left=23.0, right=29.0, inclusive="both"),
failure_msg=f"De parameter 'gamma_korrel' hoort 26.0 te zijn. "
f"De applicatie vereist dat deze tussen 23.0 en 29.0 is. ",
failure_msg="De parameter 'gamma_korrel' hoort 26.0 te zijn. "
"De applicatie vereist dat deze tussen 23.0 en 29.0 is. ",
filters=filters.combine(filters.is_in(column="parameter", values=["gamma_korrel"]),
FILTER_IS_NOT_CDF_CURVE))])

Expand Down
18 changes: 18 additions & 0 deletions geoprob_pipe/calculations/systems/wbi/initial_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,22 @@
"mean": 0.3,
"source": "excel",
},
{
"name": "a_vak",
"description": "De mechanisme gevoelige fractie van het element.",
"remark": "",
"unit": "-",
"distribution_type": DistributionType.deterministic,
"mean": 1.0,
"source": "excel"
},
{
"name": "delta_length",
"description": "De equivalente onafhankelijke lengte voor STPH.",
"remark": "",
"unit": "m",
"distribution_type": DistributionType.deterministic,
"mean": 300.0,
"source": "excel"
},
]
36 changes: 26 additions & 10 deletions geoprob_pipe/cmd_app/cmd.py
Original file line number Diff line number Diff line change
@@ -1,33 +1,49 @@
import typer
from rich.console import Console
import os
import sqlite3
from geoprob_pipe.utils import clear_terminal
from pathlib import Path
from configparser import ConfigParser
from datetime import datetime
from importlib.metadata import distributions
from typing import Dict, List, Optional

import typer
from rich.console import Console
from rich.panel import Panel

from geoprob_pipe.cmd_app.questionnaire import start_questionnaire
from typing import Optional, List, Dict
from geoprob_pipe.cmd_app.utils.misc import get_geoprob_pipe_version_number
from geoprob_pipe.utils import clear_terminal
from geoprob_pipe.utils.loggers import setup_base_logging
from importlib.metadata import distributions

app = typer.Typer(help="GeoProb-Pipe - CLI applicatie voor probabilistische piping berekeningen.", add_completion=False)


class ApplicationSettings:

def __init__(self):
self.workspace_dir: Optional[str] = None
self.geopackage_filename: Optional[str] = None
self.workspace_dir: Path = Path()
self.geopackage_filename: Path = Path()
self.datetime_stamp: str = datetime.now().strftime("%Y-%m-%d_%H%M%S")
self.to_run = "all"
# -> or vakken:1,2,3,4,5
self.debug: bool = os.getenv("GEOPROB_DEBUG") == "1"
# Flags
self.batch_input: bool = False # Flag for batch input

@property
def geopackage_filepath(self) -> str:
return os.path.join(self.workspace_dir, self.geopackage_filename)

@property
def batch_input_filepath(self) -> str:
return os.path.join(self.workspace_dir, "batch_input.ini")

@property
def input_config(self):
config = ConfigParser()
config.read(self.batch_input_filepath)
return config

@property
def hrd_dir(self):
path_to_hrd_dir = os.path.join(self.workspace_dir, "hrd_files")
Expand Down Expand Up @@ -61,7 +77,7 @@ def geohydrologisch_model(self) -> str:
conn = sqlite3.connect(self.geopackage_filepath)
cursor = conn.cursor()
cursor.execute("""
SELECT geoprob_pipe_metadata."values"
SELECT geoprob_pipe_metadata.metadata_value
FROM geoprob_pipe_metadata
WHERE metadata_type='geohydrologisch_model';
""")
Expand Down Expand Up @@ -103,7 +119,7 @@ def startup_geoprob_pipe():

debug_label: str = ""
if app_settings.debug:
debug_label = f", DEBUG=TRUE"
debug_label = ", DEBUG=TRUE"

clear_terminal()
console = Console()
Expand Down
22 changes: 11 additions & 11 deletions geoprob_pipe/cmd_app/comparisons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,41 +54,41 @@ def _load_result_data_from_geopackage(self):
"""Method om de data te verzamelen uit de opgegeven pakketten.

Raises:
ValueError: Als de `beta_limit_states` tabellen niet hetzelfde
ValueError: Als de `result__limit_states` tabellen niet hetzelfde
formaat hebben.
ValueError: Als de `beta_scenario` tabellen niet hetzelfde
ValueError: Als de `result__scenario` tabellen niet hetzelfde
formaat hebben.
ValueError: Als de `beta_uitredepunten` tabellen niet hetzelfde
ValueError: Als de `result__uitredepunten` tabellen niet hetzelfde
formaat hebben.
"""
conn_1 = sqlite3.connect(self.geopackage_filepath_1)
conn_2 = sqlite3.connect(self.geopackage_filepath_2)

self.df1_beta_limit_states = pd.read_sql(
"SELECT * FROM beta_limit_states;", conn_1
"SELECT * FROM result__limit_states;", conn_1
)
self.df2_beta_limit_states = pd.read_sql(
"SELECT * FROM beta_limit_states;", conn_2
"SELECT * FROM result__limit_states;", conn_2
)
if len(self.df1_beta_limit_states) != len(self.df2_beta_limit_states):
raise ValueError("De beta_limit_states tables hebben niet "
"hetzelfde formaat")

self.df1_beta_scenarios = pd.read_sql(
"SELECT * FROM beta_scenarios_final;", conn_1
"SELECT * FROM result__scenarios_final;", conn_1
)
self.df2_beta_scenarios = pd.read_sql(
"SELECT * FROM beta_scenarios_final;", conn_2
"SELECT * FROM result__scenarios_final;", conn_2
)
if len(self.df1_beta_scenarios) != len(self.df2_beta_scenarios):
raise ValueError("De beta_scenario tables hebben niet hetzelfde "
"formaat")

self.df1_beta_uittredepunten = pd.read_sql(
"SELECT * FROM beta_uittredepunten;", conn_1
"SELECT * FROM result__uittredepunten;", conn_1
)
self.df2_beta_uittredepunten = pd.read_sql(
"SELECT * FROM beta_uittredepunten;", conn_2
"SELECT * FROM result__uittredepunten;", conn_2
)
if len(self.df1_beta_uittredepunten) != len(self.df2_beta_uittredepunten):
raise ValueError("De beta_uittredepunten tables hebben niet "
Expand All @@ -108,11 +108,11 @@ def _load_uittredepunten_gdf(self):
"""
self.gdf1_uittredepunten = gpd.read_file(
self.geopackage_filepath_1,
layer="beta_uittredepunten"
layer="result__uittredepunten"
)
self.gdf2_uittredepunten = gpd.read_file(
self.geopackage_filepath_2,
layer="beta_uittredepunten"
layer="result__uittredepunten"
)
if len(self.gdf1_uittredepunten) != len(self.gdf2_uittredepunten):
raise ValueError("De beta_uittredepunten tables hebben niet "
Expand Down
Loading