Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 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
54f2058
system_calculations
VincentJilesen Jun 5, 2026
e4fef39
build_and_run
VincentJilesen Jun 5, 2026
0874447
InquirerPy aanpassing
VincentJilesen Jun 5, 2026
6fb5680
minor
VincentJilesen Jun 5, 2026
a4a0655
minor
VincentJilesen Jun 5, 2026
b8f1c39
minor
VincentJilesen Jun 8, 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
45 changes: 27 additions & 18 deletions geoprob_pipe/app_object.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
from __future__ import annotations

import logging
import os
import sqlite3
from datetime import datetime
from typing import TYPE_CHECKING, Optional, List
import pandas as pd
from typing import TYPE_CHECKING, List, Optional

from geoprob_pipe.cmd_app.parameter_input.expand_input_tables import run_expand_input_tables
from geoprob_pipe.cmd_app.parameter_input.input_parameter_figures import InputParameterFigures
from geoprob_pipe.cmd_app.parameter_input.input_parameter_tables import InputParameterTables

try:
import probabilistic_library
except ModuleNotFoundError:
raise ModuleNotFoundError(
"No module named 'probabilistic_library'. This package is not publicly available or part of the repository. \n"
"Please request the wheel-file through the developer and install it manually. Due to copyright reasons, do \n"
"not commit the wheel-file into the repository.")
import pandas as pd

from geoprob_pipe.calculations.systems.build_and_run import (
build_and_run_system_calculations,
)
from geoprob_pipe.cmd_app.parameter_input.expand_input_tables import (
run_expand_input_tables,
)
from geoprob_pipe.cmd_app.parameter_input.input_parameter_figures import (
InputParameterFigures,
)
from geoprob_pipe.input_data import InputData
from geoprob_pipe.results import Results
from geoprob_pipe.spatial import Spatial
from geoprob_pipe.visualizations import Visualizations
from geoprob_pipe.calculations.systems.build_and_run import build_and_run_system_calculations
from geoprob_pipe.utils.sql_contents import write_dfs_to_gpkg
from geoprob_pipe.utils.update_metadata import update_metadata
import logging
from geoprob_pipe.visualizations import Visualizations

if TYPE_CHECKING:
from geoprob_pipe.calculations.systems.build_and_run import CalcResult
from geoprob_pipe.cmd_app.cmd import ApplicationSettings
Expand Down Expand Up @@ -51,6 +52,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 +107,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 @@ -43,7 +43,7 @@ def __init__(
self.distributions: List[Dict] = distributions
self.correlations: List[Tuple[str, str, float]] = correlations
self.reliability_settings: Dict[str, Union[str, float, int]] = reliability_settings
if self.reliability_settings is None or self.reliability_settings.__len__() == 0:
if self.reliability_settings is dict():
self.reliability_settings = DEFAULT_RELIABILITY_SETTINGS
if self.correlations is None:
self.correlations = []
Expand All @@ -62,10 +62,10 @@ def __init__(self):
self.reliability_project = ReliabilityProject() # Initiated for later use
# -> Used for all reliability project calculations, i.e. the system limit states and the project limit state.
self.dps_limit_states: List[DesignPoint] = [] # Placeholder
self.dp_reliability: Optional[DesignPoint] = None # Placeholder
self.dp_reliability: DesignPoint = DesignPoint() # Placeholder

self.combine_project = CombineProject() # Initiated for later use
self.dp_combine: Optional[DesignPoint] = None # Placeholder
self.dp_combine: DesignPoint = DesignPoint() # Placeholder


class SystemCalculation:
Expand All @@ -75,15 +75,15 @@ def __init__(
self,
distributions: List[Dict],
correlations: List[Tuple[str, str, float]],
reliability_settings: Dict[str, Union[str, float, int]] = None,
reliability_settings: Dict[str, Union[str, float, int]] = DEFAULT_RELIABILITY_SETTINGS,

# Following will be assigned in children
variables_function: Optional[Callable] = None,
system_limit_states: Optional[List[Callable]] = None,
project_limit_state: Optional[Callable] = None,
):

if reliability_settings is None:
if reliability_settings is dict():
reliability_settings = DEFAULT_RELIABILITY_SETTINGS


Expand Down Expand Up @@ -127,7 +127,7 @@ def _apply_distributions(system_calculation: SystemCalculation):
""" Both initiates the variables and applies the distributions. """

def _initiatie_variables():
system_calculation.results.reliability_project.model = system_calculation.setup.variables_function
system_calculation.results.reliability_project.model = system_calculation.setup.variables_function # type:ignore

def _system_variable_keys() -> List[str]:
return_array = []
Expand Down Expand Up @@ -199,7 +199,7 @@ def _generate_dps_limit_states(system_calculation: SystemCalculation):
""" Generates the design points for the limit states separately, i.e. uplift, heave and Sellmeijer. It uses the
Reliability Project for this. """

for model_callable in system_calculation.setup.system_limit_states:
for model_callable in system_calculation.setup.system_limit_states: # type:ignore
system_calculation.results.reliability_project.model = model_callable
_apply_correlations(system_calculation=system_calculation)
# noinspection PyBroadException
Expand All @@ -218,7 +218,7 @@ def _generate_dps_limit_states(system_calculation: SystemCalculation):
def _generate_dp_reliability(system_calculation: SystemCalculation):
""" Generates the design point for the piping limit state, i.e. an encapsulating limit state for uplift, heave
and Sellmeijer. It uses the Reliability Project for this. """
model_callable: Callable = system_calculation.setup.project_limit_state
model_callable: Callable = system_calculation.setup.project_limit_state # type:ignore
system_calculation.results.reliability_project.model = model_callable
_apply_correlations(system_calculation=system_calculation)
# noinspection PyBroadException
Expand Down
2 changes: 1 addition & 1 deletion geoprob_pipe/calculations/systems/build_and_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def build_and_run_system_calculations(geoprob_pipe: GeoProbPipe) -> List[CalcRes
for res, error_logs, row in pool.imap_unordered(_worker, rows, chunksize=chunk_size):
if isinstance(res, CalcResult):
results.append(res)
if isinstance(error_logs, str):
if isinstance(error_logs, str) and isinstance(row, dict):
error_rows.append({
"uittredepunt_id": row["uittredepunt_id"],
"ondergrondscenario_naam": row["ondergrondscenario_naam"],
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"
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ class Model4aCalculation(SystemCalculation):
def __init__(
self,
distributions: List[Dict],
correlations: List[Tuple[str, str, float]] = None,
reliability_settings: Dict[str, Union[str, float, int]] = None
correlations: List[Tuple[str, str, float]] = list(),
reliability_settings: Dict[str, Union[str, float, int]] = dict()
):

super().__init__(
Expand Down
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"
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class MORIACalculation(SystemCalculation):
def __init__(
self,
distributions: List[Dict],
correlations: List[Tuple[str, str, float]] = None,
reliability_settings: Dict[str, Union[str, float, int]] = None
correlations: List[Tuple[str, str, float]] = list(),
reliability_settings: Dict[str, Union[str, float, int]] = dict()
):
super().__init__(
distributions=distributions, correlations=correlations, reliability_settings=reliability_settings)
Expand Down
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"
},
]
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class WBICalculation(SystemCalculation):
def __init__(
self,
distributions: List[Dict],
correlations: List[Tuple[str, str, float]] = None,
reliability_settings: Dict[str, Union[str, float, int]] = None
correlations: List[Tuple[str, str, float]] = list(),
reliability_settings: Dict[str, Union[str, float, int]] = dict()
):
super().__init__(
distributions=distributions, correlations=correlations, reliability_settings=reliability_settings)
Expand Down
38 changes: 27 additions & 11 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 All @@ -80,7 +96,7 @@ def _raise_if_multiple_installations():
installed_distributions.append({
"NAME": dist.metadata["Name"],
"VERSION": dist.version,
"LOCATION": dist.locate_file(""),
"LOCATION": str(dist.locate_file("")),
})
if installed_distributions.__len__() > 1:
raise RuntimeError(
Expand All @@ -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
Loading