diff --git a/geoprob_pipe/calculations/systems/base_objects/system_calculation.py b/geoprob_pipe/calculations/systems/base_objects/system_calculation.py index 81973b08..112135d0 100644 --- a/geoprob_pipe/calculations/systems/base_objects/system_calculation.py +++ b/geoprob_pipe/calculations/systems/base_objects/system_calculation.py @@ -16,6 +16,15 @@ "relaxation_factor": 0.4, } +# DEFAULT_RELIABILITY_SETTINGS: Dict[str, Union[str, float, int]] = { +# "reliability_method": ReliabilityMethod.form.__str__(), +# "variation_coefficient": 0.02, +# "maximum_iterations": 10_000, +# "relaxation_factor": 0.4, +# "epsilon_beta": 0.05, +# "relaxation_loops": 10, +# } + class SystemSetup: diff --git a/geoprob_pipe/calculations/systems/build_and_run.py b/geoprob_pipe/calculations/systems/build_and_run.py index 7e54cbba..085970c9 100644 --- a/geoprob_pipe/calculations/systems/build_and_run.py +++ b/geoprob_pipe/calculations/systems/build_and_run.py @@ -1,5 +1,5 @@ from __future__ import annotations -from typing import TYPE_CHECKING, List +from typing import TYPE_CHECKING, List, Optional from geoprob_pipe.calculations.systems.mappers.calculations import ( CALCULATION_MAPPER) from multiprocessing import Pool, cpu_count @@ -54,8 +54,10 @@ class CalcResult: validation_message: ValidationMessages -def _init_worker(geohydrologisch_model, geopackage_filepath, - to_run_vakken_ids): +def _init_worker( + geohydrologisch_model: str, + geopackage_filepath: str, + to_run_vakken_ids: Optional[List[int]]): """ Initiator voor de worker, dit zorgt ervoor dat de tijdrovende stappen een keer per worker worden uitgevoerd en dan beschikbaar blijven voor iedere run. @@ -70,6 +72,10 @@ def _init_worker(geohydrologisch_model, geopackage_filepath, def _worker(row_unique: dict): """ De worker functie die op de parallelle rekenkernen wordt gedraaid. + + :param row_unique: Identificatie naar unieke berekening, bijvoorbeeld + {'uittredepunt_id': 1, 'ondergrondscenario_naam': 'scenario1', 'vak_id': 4}. + :return: Tuple[Optional[CalcResult], Optional[str], Optional[dict]] """ log_buffer = StringIO() buffer_handler = logging.StreamHandler(log_buffer) diff --git a/geoprob_pipe/calculations/systems/model4a/initial_input.py b/geoprob_pipe/calculations/systems/model4a/initial_input.py index a33a0940..a8e77eec 100644 --- a/geoprob_pipe/calculations/systems/model4a/initial_input.py +++ b/geoprob_pipe/calculations/systems/model4a/initial_input.py @@ -204,7 +204,7 @@ "remark": "", "unit": "kN/m³", "distribution_type": DistributionType.log_normal, - "mean": 13.9, + "mean": 15.0, "variation": 0.05, "source": "excel", }, @@ -225,7 +225,7 @@ "unit": "m", "distribution_type": DistributionType.log_normal, "mean": 2.8e-4, - "variation": 0.15, + "variation": 0.12, "source": "excel", }, { @@ -281,7 +281,7 @@ "remark": "", "unit": "kN/m³", "distribution_type": DistributionType.deterministic, - "mean": 16.5, + "mean": 26.0, "source": "excel", }, { diff --git a/geoprob_pipe/calculations/systems/moria/validation.py b/geoprob_pipe/calculations/systems/moria/validation.py index b021d296..f6c611e2 100644 --- a/geoprob_pipe/calculations/systems/moria/validation.py +++ b/geoprob_pipe/calculations/systems/moria/validation.py @@ -1,12 +1,29 @@ from geoprob_pipe.calculations.systems.mappers.initial_input import INITIAL_INPUT_MORIA -from geoprob_pipe.utils.df_validation import ColumnValidation, requirements -from geoprob_pipe.calculations.systems.validation import GAMMA_KORREL +from geoprob_pipe.utils.df_validation import ColumnValidation, requirements, filters +from geoprob_pipe.calculations.systems.validation import ( + FILTER_IS_NOT_CDF_CURVE, D_WVP, L_BUT, L_INTREDE, BUITENWATERSTAND, D70, D70_M, ETA, G, GAMMA_KORREL, + GAMMA_SAT_DEKLAAG, GAMMA_WATER, I_C_H, K_WVP, LAMBDA_VOORLAND, MODELFACTOR_3D, MODELFACTOR_ANISO, MODELFACTOR_FF, + MODELFACTOR_H, MODELFACTOR_ML, MODELFACTOR_P, MODELFACTOR_U, MV_EXIT, PHI_EXIT_GEMIDDELD, POLDERPEIL, R_C_DEKLAAG, + R_EXIT, THETA, TOP_ZAND, V) PARAMETER = ColumnValidation(column_name="parameter", requirements=[ requirements.IsIn(values=[item["name"] for item in INITIAL_INPUT_MORIA])]) +BUITENWATERSTAND_GEMIDDELD = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["buitenwaterstand_gemiddeld"]), + FILTER_IS_NOT_CDF_CURVE))]) + + MORIA_VALIDATION_REQUIREMENTS = { - "Parameter invoer": [PARAMETER, GAMMA_KORREL] + "Parameter invoer": [ + PARAMETER, + D_WVP, L_BUT, L_INTREDE, BUITENWATERSTAND, BUITENWATERSTAND_GEMIDDELD, D70, D70_M, ETA, G, GAMMA_KORREL, + GAMMA_SAT_DEKLAAG, GAMMA_WATER, I_C_H, K_WVP, LAMBDA_VOORLAND, MODELFACTOR_3D, MODELFACTOR_ANISO, + MODELFACTOR_FF, MODELFACTOR_H, MODELFACTOR_ML, MODELFACTOR_P, MODELFACTOR_U, MV_EXIT, PHI_EXIT_GEMIDDELD, + POLDERPEIL, R_C_DEKLAAG, R_EXIT, THETA, TOP_ZAND, V + ] } diff --git a/geoprob_pipe/calculations/systems/validation.py b/geoprob_pipe/calculations/systems/validation.py index ed021fe2..23a13f78 100644 --- a/geoprob_pipe/calculations/systems/validation.py +++ b/geoprob_pipe/calculations/systems/validation.py @@ -1,11 +1,212 @@ from geoprob_pipe.utils.df_validation import ColumnValidation, requirements, ValidationRequirement, filters +FILTER_IS_NOT_CDF_CURVE = filters.is_in(column="distribution_type", values=['deterministic', 'log_normal', 'normal']) + + +D_WVP = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.2, right=1_000, + filters=filters.combine( + filters.is_in(column="parameter", values=["D_wvp"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +L_BUT = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=1, right=2_000, + filters=filters.combine( + filters.is_in(column="parameter", values=["L_but"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +L_INTREDE = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=2, right=5_000, + filters=filters.combine( + filters.is_in(column="parameter", values=["L_intrede"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +BUITENWATERSTAND = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["buitenwaterstand"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +D70 = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-0.00001, right=0.001, filters=filters.combine( + filters.is_in(column="parameter", values=["d70"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +D70_M = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-0.00001, right=0.001, filters=filters.combine( + filters.is_in(column="parameter", values=["d70_m"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +ETA = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.1, right=0.9, filters=filters.combine( + filters.is_in(column="parameter", values=["eta"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +G = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=5, right=20, filters=filters.combine( + filters.is_in(column="parameter", values=["g"]), + FILTER_IS_NOT_CDF_CURVE))]) + + 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. ", - filters=filters.is_in(column="parameter", values=["gamma_korrel"]) - ) -]) + filters=filters.combine(filters.is_in(column="parameter", values=["gamma_korrel"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +GAMMA_SAT_DEKLAAG = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=9.81, right=25, filters=filters.combine( + filters.is_in(column="parameter", values=["gamma_sat_deklaag"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +GAMMA_WATER = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=5, right=20, filters=filters.combine( + filters.is_in(column="parameter", values=["gamma_water"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +I_C_H = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.05, right=1.0, filters=filters.combine( + filters.is_in(column="parameter", values=["i_c_h"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +K_WVP = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=1, right=400, filters=filters.combine( + filters.is_in(column="parameter", values=["k_wvp"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +LAMBDA_VOORLAND = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0, right=5_000, filters=filters.combine( + filters.is_in(column="parameter", values=["lambda_voorland"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_3D = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_3d"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_ANISO = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_aniso"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_FF = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_ff"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_H = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_h"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_ML = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_ml"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_P = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_p"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MODELFACTOR_U = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.5, right=5, filters=filters.combine( + filters.is_in(column="parameter", values=["modelfactor_u"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +MV_EXIT = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["mv_exit"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +PHI_EXIT_GEMIDDELD = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["phi_exit_gemiddeld"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +POLDERPEIL = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["polderpeil"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +R_C_DEKLAAG = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0, right=2, filters=filters.combine( + filters.is_in(column="parameter", values=["r_c_deklaag"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +R_EXIT = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.0, right=1.0, filters=filters.combine( + filters.is_in(column="parameter", values=["r_exit"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +THETA = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=15, right=60, filters=filters.combine( + filters.is_in(column="parameter", values=["theta"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +TOP_ZAND = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=-99, right=999, filters=filters.combine( + filters.is_in(column="parameter", values=["top_zand"]), + FILTER_IS_NOT_CDF_CURVE))]) + + +V = ColumnValidation(column_name="mean", requirements=[ + requirements.IsInRange( + left=0.0000001, right=0.00001, filters=filters.combine( + filters.is_in(column="parameter", values=["v"]), + FILTER_IS_NOT_CDF_CURVE))]) diff --git a/geoprob_pipe/changelog.py b/geoprob_pipe/changelog.py index 14883b2e..e3fa28a7 100644 --- a/geoprob_pipe/changelog.py +++ b/geoprob_pipe/changelog.py @@ -1,5 +1,7 @@ CHANGELOG = { + "2.2.3": + "Bug fix. Validation issue.", "2.2.0": "New feature. Het is nu mogelijk om op scenario-niveau de invoer van uittredepunten te specificeren.", "2.1.0": diff --git a/geoprob_pipe/cmd_app/general/traject_parameters.py b/geoprob_pipe/cmd_app/general/traject_parameters.py index c51ee9e0..6fba88c1 100644 --- a/geoprob_pipe/cmd_app/general/traject_parameters.py +++ b/geoprob_pipe/cmd_app/general/traject_parameters.py @@ -31,7 +31,7 @@ def _specify_traject_id(app_settings: ApplicationSettings): ).execute() traject_id = traject_id.strip() - if traject_id is "": + if traject_id == "": print(BColors.OKBLUE, f"Je hebt geen traject_id gespecificeerd. Je invoer is leeg. ", BColors.ENDC) continue @@ -56,7 +56,7 @@ def _specify_signaleringswaarde(app_settings: ApplicationSettings): ).execute() signaleringswaarde = signaleringswaarde.strip() - if signaleringswaarde is "": + if signaleringswaarde == "": print(BColors.OKBLUE, f"Je hebt geen signaleringswaarde gespecificeerd. Je invoer is leeg. ", BColors.ENDC) continue @@ -83,7 +83,7 @@ def _specify_ondergrens(app_settings: ApplicationSettings, signaleringswaarde: i ).execute() ondergrens = ondergrens.strip() - if ondergrens is "": + if ondergrens == "": print(BColors.OKBLUE, f"Je hebt geen ondergrens gespecificeerd. Je invoer is leeg. ", BColors.ENDC) continue @@ -141,7 +141,7 @@ def _specify_w(app_settings: ApplicationSettings): ).execute() w = w.strip() - if w is "": + if w == "": print(BColors.OKBLUE, f"Je hebt geen w gespecificeerd. Je invoer is leeg. ", BColors.ENDC) continue diff --git a/geoprob_pipe/cmd_app/parameter_input/added_input_parameters.py b/geoprob_pipe/cmd_app/parameter_input/added_input_parameters.py index 79e4428d..f5b556a9 100644 --- a/geoprob_pipe/cmd_app/parameter_input/added_input_parameters.py +++ b/geoprob_pipe/cmd_app/parameter_input/added_input_parameters.py @@ -120,8 +120,9 @@ def _export_expanded_input(app_settings: ApplicationSettings): dst_path = dst_path.replace(".xlsx", f"_{datetime_stamp}.xlsx") # Export - df.to_excel(dst_path) - + df.to_excel(dst_path, index=False) + print(f"{BColors.UNDERLINE}Exporteren van 'expanded' tabel compleet:\n" + f"{dst_path}{BColors.ENDC}") def inquire_to_import_export_tables_and_figures_or_continue( app_settings: ApplicationSettings, tables: InputParameterTables, diff --git a/geoprob_pipe/cmd_app/parameter_input/initiate_input_excel_tables.py b/geoprob_pipe/cmd_app/parameter_input/initiate_input_excel_tables.py index ce0266e5..7a567597 100644 --- a/geoprob_pipe/cmd_app/parameter_input/initiate_input_excel_tables.py +++ b/geoprob_pipe/cmd_app/parameter_input/initiate_input_excel_tables.py @@ -4,7 +4,7 @@ import sqlite3 from geoprob_pipe.cmd_app.utils.misc import get_geohydrological_model from geoprob_pipe.calculations.systems.mappers.initial_input import INITIAL_INPUT_MAPPER -from pandas import DataFrame +from pandas import DataFrame, NA import numpy as np if TYPE_CHECKING: from geoprob_pipe.cmd_app.cmd import ApplicationSettings @@ -59,8 +59,8 @@ def push_parameter_invoer_tabel(app_settings: ApplicationSettings): # Add missing columns df_parameter_invoer.loc[:, "scope"] = "traject" - df_parameter_invoer.loc[:, "scope_referentie"] = "" - df_parameter_invoer.loc[:, "ondergrondscenario_naam"] = "" + df_parameter_invoer.loc[:, "scope_referentie"] = NA + df_parameter_invoer.loc[:, "ondergrondscenario_naam"] = NA df_parameter_invoer.loc[:, "bronnen"] = "" df_parameter_invoer.loc[:, "opmerking"] = "" df_parameter_invoer.loc[:, "fragility_values_ref"] = "" diff --git a/geoprob_pipe/cmd_app/spatial_layers/hrd/hrd.py b/geoprob_pipe/cmd_app/spatial_layers/hrd/hrd.py index 22f9939f..234d01b7 100644 --- a/geoprob_pipe/cmd_app/spatial_layers/hrd/hrd.py +++ b/geoprob_pipe/cmd_app/spatial_layers/hrd/hrd.py @@ -26,11 +26,17 @@ def _hrd_data_requested(app_settings: ApplicationSettings) -> bool: return bool(int(row[2])) # Optionally ask and then store choice - choices_list = ["Ja", "Nee"] + choices_list = ["Ja", "Nee", "Applicatie afsluiten"] choice = inquirer.select( message=f"Wil je HRD-data importeren? Dit is optioneel. " f"Je kunt ook handmatig overschrijdingsfrequentielijnen toevoegen.", choices=choices_list, default=choices_list[0]).execute() + + # Close app? + if choice == "Applicatie afsluiten": + sys.exit("Applicatie afgesloten") + + # Handle choices keuze = True if choice == "Nee": keuze = False diff --git a/geoprob_pipe/utils/df_validation/requirements.py b/geoprob_pipe/utils/df_validation/requirements.py index b165b48b..5a280a2b 100644 --- a/geoprob_pipe/utils/df_validation/requirements.py +++ b/geoprob_pipe/utils/df_validation/requirements.py @@ -11,17 +11,28 @@ def is_string(s: Series) -> Series: IsString = ValidationRequirement(requirement=is_string, failure_msg="Value in column is not a string (textual).") -def is_in(values: List): - assert isinstance(values, List) - return lambda s: s.isin(values) - - def is_in_range( left: float, right: float, inclusive: Literal["both", "neither", "left", "right"] = "both") -> Callable[[Series], Series]: return lambda s: s.between(left, right, inclusive=inclusive) +class IsInRange(ValidationRequirement): + def __init__( + self, + left: float, + right: float, + inclusive: Literal["both", "neither", "left", "right"] = "both", + filters: Optional[Callable[[DataFrame], Series]] = None, + stop_validation_on_failure: bool = False + ): + super().__init__( + requirement=is_in_range(left=left, right=right, inclusive=inclusive), + failure_msg=f"Value should be in range {left} to {right} (inclusive={inclusive}).", + filters=filters, + stop_validation_on_failure=stop_validation_on_failure) + + def is_not_null(s: Series) -> Series: return s.notna() @@ -30,6 +41,11 @@ def is_null(s: Series) -> Series: return ~s.notna() +def is_in(values: List): + assert isinstance(values, List) + return lambda s: s.isin(values) + + class IsIn(ValidationRequirement): def __init__( self, values: List, filters: Optional[Callable[[DataFrame], Series]] = None, @@ -44,7 +60,8 @@ def is_integer(s: Series) -> Series: def is_whole_number(s: Series) -> Series: - return s.notna() & (s % 1 == 0) + numeric = to_numeric(s, errors="coerce") + return s.notna() & (numeric % 1 == 0) def is_numeric(s: Series) -> Series: diff --git a/pyproject.toml b/pyproject.toml index 6b6e90dc..731910ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "geoprob_pipe" -version = "2.2.1" +version = "2.2.3" description = "Execute probabilistic piping calculations using the Deltares probabilic library." authors = [ "Chris Pitzalis ", @@ -20,10 +20,12 @@ classifiers = [ ] [tool.poetry.dependencies] -python = "~3.12" -pandas = "<3.0" # pydra-core 0.0.10 and earlier is not update to the latest version of pandas. +python = ">=3.12,<3.13" # TODO: Unit test and add 3.13 en 3.14 +pandas = ">=2.0,<3.0" # pydra-core 0.0.10 and earlier is not update to the latest version of pandas. +pydra-core = "0.0.10" # TODO: There is a newer version available. Test with that. +probabilistic-library = "26.1.1" +# The following is not yet restricted, but should be TODO scipy = "^1.16.1" -pydra-core = "^0.0.9" geopandas = "^1.1.1" plotly = "^6.2.0" openpyxl = "^3.1.5" @@ -32,7 +34,6 @@ colorlog = "^6.9.0" typer = "^0.17.3" inquirerpy = "^0.3.4" rasterio = "^1.4.3" -probabilistic-library = "^26.1.1" [tool.poetry.scripts] diff --git a/readme_images/coverage.svg b/readme_images/coverage.svg index a9be2c5a..ccbab791 100644 --- a/readme_images/coverage.svg +++ b/readme_images/coverage.svg @@ -15,7 +15,7 @@ coverage coverage - 29% - 29% + 39% + 39% diff --git a/requirements.txt b/requirements.txt index 1da17519..da5ca3f0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,11 @@ +pandas==2.* # pydra-core 0.0.10 and earlier is not update to the latest version of pandas. +pydra-core==0.0.10 +probabilistic-library==26.1.1 + +# The following is not yet restricted dotenv -pandas<3.0.0 # pydra-core 0.0.10 and earlier is not update to the latest version of pandas. -pydra-core +pandas<3.0.0 +pydra-core<=0.0.10 # TODO Later Should Middel: Er bestaat ook een Python-wrapper voor Hydra-Ring. Pydra-core vervangen? openpyxl colorlog diff --git a/tests/calculations/systems/test_build_and_run.py b/tests/calculations/systems/test_build_and_run.py new file mode 100644 index 00000000..bf851b6c --- /dev/null +++ b/tests/calculations/systems/test_build_and_run.py @@ -0,0 +1,41 @@ + + +def test_worker(): + ## + from geoprob_pipe.calculations.systems.build_and_run import _worker, _init_worker + from repo_utils.utils import repository_root_path + import os + from geoprob_pipe.cmd_app.cmd import ApplicationSettings + + app_settings = ApplicationSettings() + repo_root = repository_root_path() + filepath = os.path.join(repo_root, "tests", "systeem_testen", "224", "Traject224_MORIA_WBN_prob.geoprob_pipe.gpkg") + app_settings.workspace_dir = os.path.dirname(filepath) + app_settings.geopackage_filename = os.path.basename(filepath) + model = app_settings.geohydrologisch_model + _init_worker( + geohydrologisch_model=model, + geopackage_filepath=filepath, + to_run_vakken_ids=None) + result = _worker(row_unique={'uittredepunt_id': 1, 'ondergrondscenario_naam': 'scenario1', 'vak_id': 4}) + + ## + + +def test_build_and_run_system_calculations(): + ## + + from geoprob_pipe import GeoProbPipe + from repo_utils.utils import repository_root_path + import os + from geoprob_pipe.cmd_app.cmd import ApplicationSettings + + app_settings = ApplicationSettings() + repo_root = repository_root_path() + filepath = os.path.join(repo_root, "tests", "systeem_testen", "224", "Traject224_MORIA_WBN_prob.geoprob_pipe.gpkg") + app_settings.workspace_dir = os.path.dirname(filepath) + app_settings.geopackage_filename = os.path.basename(filepath) + app_settings.to_run = "vakken:4,5" + _ = GeoProbPipe(app_settings) + + ## diff --git a/tests/input_data/__init__.py b/tests/input_data/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/input_data/test_traject_normering.py b/tests/input_data/test_traject_normering.py new file mode 100644 index 00000000..2620ed3d --- /dev/null +++ b/tests/input_data/test_traject_normering.py @@ -0,0 +1,20 @@ + + +def test_class_traject_normering(): + ## + + from geoprob_pipe.input_data.traject_normering import TrajectNormering + from repo_utils.utils import repository_root_path + import os + from geoprob_pipe.cmd_app.cmd import ApplicationSettings + + app_settings = ApplicationSettings() + repo_root = repository_root_path() + # filepath = os.path.join(repo_root, "tests", "systeem_testen", "224", "Traject224_MORIA_WBN_prob.geoprob_pipe.gpkg") + filepath = os.path.join(repo_root, "tests", "systeem_testen", "224", "Traject224_v2.2.3.geoprob_pipe.gpkg") + app_settings.workspace_dir = os.path.dirname(filepath) + app_settings.geopackage_filename = os.path.basename(filepath) + + _ = TrajectNormering(app_settings=app_settings) + + ## \ No newline at end of file diff --git a/tests/systeem_testen/224/Traject224_v2.2.3.geoprob_pipe.gpkg b/tests/systeem_testen/224/Traject224_v2.2.3.geoprob_pipe.gpkg new file mode 100644 index 00000000..64e03fb9 Binary files /dev/null and b/tests/systeem_testen/224/Traject224_v2.2.3.geoprob_pipe.gpkg differ diff --git a/workspaces/ArdJan_testset/input/input.xlsx b/workspaces/ArdJan_testset/input/input.xlsx deleted file mode 100644 index f1b39427..00000000 Binary files a/workspaces/ArdJan_testset/input/input.xlsx and /dev/null differ diff --git a/workspaces/example_new_calculations/input/input.xlsx b/workspaces/example_new_calculations/input/input.xlsx deleted file mode 100644 index 5d6d747d..00000000 Binary files a/workspaces/example_new_calculations/input/input.xlsx and /dev/null differ diff --git a/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.config.sqlite b/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.config.sqlite deleted file mode 100644 index 73f3e89d..00000000 Binary files a/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.config.sqlite and /dev/null differ diff --git a/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.sqlite b/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.sqlite deleted file mode 100644 index a57dfd7d..00000000 Binary files a/workspaces/traject_224/input/WBI2017_Bovenrijn_224_v04.sqlite and /dev/null differ diff --git a/workspaces/traject_224/input/hlcd.sqlite b/workspaces/traject_224/input/hlcd.sqlite deleted file mode 100644 index 1bf2956e..00000000 Binary files a/workspaces/traject_224/input/hlcd.sqlite and /dev/null differ diff --git a/workspaces/traject_224/input/hr_frequency_lines/vk0224_0001_1_WA_hm0386.csv b/workspaces/traject_224/input/hr_frequency_lines/vk0224_0001_1_WA_hm0386.csv deleted file mode 100644 index dc3cf668..00000000 --- a/workspaces/traject_224/input/hr_frequency_lines/vk0224_0001_1_WA_hm0386.csv +++ /dev/null @@ -1,85 +0,0 @@ -Level,Exceedance_Frequency -3.586,5.86082403 -3.686,5.66715759 -3.786,5.37800029 -3.886,5.03955286 -3.986,4.65422534 -4.086,4.25895799 -4.186,3.87473238 -4.286,3.4946515 -4.386,3.16913082 -4.486,2.87305072 -4.586,2.60476 -4.686,2.36236175 -4.786,2.14137909 -4.886,1.95592542 -4.986,1.79941894 -5.086,1.66965893 -5.186,1.56109352 -5.286,1.45785137 -5.386,1.34839483 -5.486,1.23049159 -5.586,1.10195949 -5.686,0.972351541 -5.786,0.852178144 -5.886,0.745570882 -5.986,0.653309851 -6.086,0.57226996 -6.186,0.507372845 -6.286,0.455555565 -6.386,0.413471011 -6.486,0.377025191 -6.586,0.344538549 -6.686,0.312729867 -6.786,0.285667641 -6.886,0.260376924 -6.986,0.236387057 -7.086,0.212597359 -7.186,0.187947097 -7.286,0.163624477 -7.386,0.140761641 -7.486,0.119296711 -7.586,0.0998199898 -7.686,0.0828114163 -7.786,0.0684686435 -7.886,0.0571681563 -7.986,0.0480819547 -8.086,0.0400199856 -8.186,0.0337491654 -8.286,0.0280634018 -8.386,0.0234993639 -8.486,0.019523801 -8.586,0.0162010836 -8.686,0.0134446987 -8.786,0.0110803622 -8.886,0.00891552984 -8.986,0.00697635452 -9.086,0.00540370571 -9.186,0.00406119701 -9.286,0.00287141843 -9.386,0.00200511735 -9.486,0.00134678614 -9.586,0.000867293232 -9.686,0.000563885163 -9.786,0.000339243143 -9.886,0.000194149581 -9.986,0.000105695088 -10.086,6.29898933e-05 -10.186,3.67998314e-05 -10.286,2.21641306e-05 -10.386,1.41027935e-05 -10.486,9.02138407e-06 -10.586,5.68953915e-06 -10.686,3.55528158e-06 -10.786,2.25311343e-06 -10.886,1.40811258e-06 -10.986,9.01344258e-07 -11.086,5.60828605e-07 -11.186,3.47763638e-07 -11.286,2.15759828e-07 -11.386,1.30680626e-07 -11.486,8.06021806e-08 -11.586,4.6956722e-08 -11.686,2.60818195e-08 -11.786,1.32012175e-08 -11.886,5.8894924e-09 diff --git a/workspaces/traject_224/input/hr_frequency_lines/vk0224_0002_1_WA_hm0384.csv b/workspaces/traject_224/input/hr_frequency_lines/vk0224_0002_1_WA_hm0384.csv deleted file mode 100644 index dc3cf668..00000000 --- a/workspaces/traject_224/input/hr_frequency_lines/vk0224_0002_1_WA_hm0384.csv +++ /dev/null @@ -1,85 +0,0 @@ -Level,Exceedance_Frequency -3.586,5.86082403 -3.686,5.66715759 -3.786,5.37800029 -3.886,5.03955286 -3.986,4.65422534 -4.086,4.25895799 -4.186,3.87473238 -4.286,3.4946515 -4.386,3.16913082 -4.486,2.87305072 -4.586,2.60476 -4.686,2.36236175 -4.786,2.14137909 -4.886,1.95592542 -4.986,1.79941894 -5.086,1.66965893 -5.186,1.56109352 -5.286,1.45785137 -5.386,1.34839483 -5.486,1.23049159 -5.586,1.10195949 -5.686,0.972351541 -5.786,0.852178144 -5.886,0.745570882 -5.986,0.653309851 -6.086,0.57226996 -6.186,0.507372845 -6.286,0.455555565 -6.386,0.413471011 -6.486,0.377025191 -6.586,0.344538549 -6.686,0.312729867 -6.786,0.285667641 -6.886,0.260376924 -6.986,0.236387057 -7.086,0.212597359 -7.186,0.187947097 -7.286,0.163624477 -7.386,0.140761641 -7.486,0.119296711 -7.586,0.0998199898 -7.686,0.0828114163 -7.786,0.0684686435 -7.886,0.0571681563 -7.986,0.0480819547 -8.086,0.0400199856 -8.186,0.0337491654 -8.286,0.0280634018 -8.386,0.0234993639 -8.486,0.019523801 -8.586,0.0162010836 -8.686,0.0134446987 -8.786,0.0110803622 -8.886,0.00891552984 -8.986,0.00697635452 -9.086,0.00540370571 -9.186,0.00406119701 -9.286,0.00287141843 -9.386,0.00200511735 -9.486,0.00134678614 -9.586,0.000867293232 -9.686,0.000563885163 -9.786,0.000339243143 -9.886,0.000194149581 -9.986,0.000105695088 -10.086,6.29898933e-05 -10.186,3.67998314e-05 -10.286,2.21641306e-05 -10.386,1.41027935e-05 -10.486,9.02138407e-06 -10.586,5.68953915e-06 -10.686,3.55528158e-06 -10.786,2.25311343e-06 -10.886,1.40811258e-06 -10.986,9.01344258e-07 -11.086,5.60828605e-07 -11.186,3.47763638e-07 -11.286,2.15759828e-07 -11.386,1.30680626e-07 -11.486,8.06021806e-08 -11.586,4.6956722e-08 -11.686,2.60818195e-08 -11.786,1.32012175e-08 -11.886,5.8894924e-09 diff --git a/workspaces/traject_224/input/input.xlsx b/workspaces/traject_224/input/input.xlsx deleted file mode 100644 index 0d7905c8..00000000 Binary files a/workspaces/traject_224/input/input.xlsx and /dev/null differ diff --git a/workspaces/traject_224/input_v1.xlsx b/workspaces/traject_224/input_v1.xlsx deleted file mode 100644 index 76618c03..00000000 Binary files a/workspaces/traject_224/input_v1.xlsx and /dev/null differ diff --git a/workspaces/traject_224/input_v2.xlsx b/workspaces/traject_224/input_v2.xlsx deleted file mode 100644 index 011a3338..00000000 Binary files a/workspaces/traject_224/input_v2.xlsx and /dev/null differ diff --git a/workspaces/traject_224/input_v3_in_use.xlsx b/workspaces/traject_224/input_v3_in_use.xlsx deleted file mode 100644 index ec53d255..00000000 Binary files a/workspaces/traject_224/input_v3_in_use.xlsx and /dev/null differ