threedi-modelchecker 2.10.0.dev4__tar.gz → 2.10.2.dev0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/CHANGES.rst +15 -2
- {threedi_modelchecker-2.10.0.dev4/threedi_modelchecker.egg-info → threedi_modelchecker-2.10.2.dev0}/PKG-INFO +2 -2
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/pyproject.toml +1 -1
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/__init__.py +1 -1
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/other.py +59 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/config.py +5 -5
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_other.py +53 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0/threedi_modelchecker.egg-info}/PKG-INFO +2 -2
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker.egg-info/requires.txt +1 -1
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/LICENSE +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/MANIFEST.in +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/README.rst +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/setup.cfg +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/__init__.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/base.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/cross_section_definitions.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/factories.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/geo_query.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/raster.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/checks/timeseries.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/exporters.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/interfaces/__init__.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/interfaces/raster_interface.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/interfaces/raster_interface_gdal.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/interfaces/raster_interface_rasterio.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/model_checks.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/scripts.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/__init__.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/conftest.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/data/__init__.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/data/empty.gpkg +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/data/empty.sqlite +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/factories.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_base.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_cross_section_definitions.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_factories.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_raster.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_checks_timeseries.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_exporters.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/tests/test_model_checks.py +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker.egg-info/SOURCES.txt +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker.egg-info/dependency_links.txt +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker.egg-info/entry_points.txt +0 -0
- {threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker.egg-info/top_level.txt +0 -0
|
@@ -2,8 +2,21 @@ Changelog of threedi-modelchecker
|
|
|
2
2
|
=================================
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
2.
|
|
6
|
-
|
|
5
|
+
2.10.2 (unreleased)
|
|
6
|
+
-------------------
|
|
7
|
+
|
|
8
|
+
- Rename groundwater.equilibrium_infiltration_rate_type to equilibrium_infiltration_rate_aggregation
|
|
9
|
+
- Rename control_measure_location.object_id to connection_node_id
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
2.10.1 (2024-08-20)
|
|
13
|
+
-------------------
|
|
14
|
+
|
|
15
|
+
- Add check for control_table.action_table contents
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
2.10.0 (2024-08-16)
|
|
19
|
+
-------------------
|
|
7
20
|
|
|
8
21
|
- Adapt modelchecker to work with schema upgrades for structure control (0.224)
|
|
9
22
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threedi-modelchecker
|
|
3
|
-
Version: 2.10.
|
|
3
|
+
Version: 2.10.2.dev0
|
|
4
4
|
Summary: Checks validity of a 3Di schematisation
|
|
5
5
|
Author-email: Nelen & Schuurmans <info@nelen-schuurmans.nl>
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
Requires-Dist: Click
|
|
16
16
|
Requires-Dist: GeoAlchemy2!=0.11.*,>=0.9
|
|
17
17
|
Requires-Dist: SQLAlchemy>=1.4
|
|
18
|
-
Requires-Dist: threedi-schema
|
|
18
|
+
Requires-Dist: threedi-schema==0.224.*
|
|
19
19
|
Provides-Extra: rasterio
|
|
20
20
|
Requires-Dist: rasterio>=1.3.10; extra == "rasterio"
|
|
21
21
|
Provides-Extra: test
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import re
|
|
1
2
|
from abc import ABC, abstractmethod
|
|
2
3
|
from dataclasses import dataclass
|
|
3
4
|
from typing import List, Literal, NamedTuple
|
|
@@ -1100,3 +1101,61 @@ class TagsValidCheck(BaseCheck):
|
|
|
1100
1101
|
|
|
1101
1102
|
def description(self) -> str:
|
|
1102
1103
|
return f"{self.table.name}.{self.column} refers to tag ids that are not present in Tags, "
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
class TableStrCheck(BaseCheck):
|
|
1107
|
+
def __init__(
|
|
1108
|
+
self, column, pattern, filters=None, level=CheckLevel.ERROR, error_code=0
|
|
1109
|
+
):
|
|
1110
|
+
self.pattern = pattern
|
|
1111
|
+
super().__init__(
|
|
1112
|
+
column=column, filters=filters, level=level, error_code=error_code
|
|
1113
|
+
)
|
|
1114
|
+
|
|
1115
|
+
def get_invalid(self, session: Session) -> List[NamedTuple]:
|
|
1116
|
+
# return mock list in case the table is empty when it shouldn't be
|
|
1117
|
+
invalids = []
|
|
1118
|
+
for record in self.to_check(session).all():
|
|
1119
|
+
if re.match(self.pattern, getattr(record, self.column.name)) is None:
|
|
1120
|
+
invalids.append(record)
|
|
1121
|
+
return invalids
|
|
1122
|
+
|
|
1123
|
+
|
|
1124
|
+
class ControlTableActionTableCheckDefault(TableStrCheck):
|
|
1125
|
+
def __init__(self, level=CheckLevel.ERROR, error_code=0):
|
|
1126
|
+
# check for action_table for action_type != set_discharge_coefficients
|
|
1127
|
+
# expected format: multiple rows, separated by \n of "val,val"
|
|
1128
|
+
super().__init__(
|
|
1129
|
+
column=models.ControlTable.action_table,
|
|
1130
|
+
pattern=r"^(-?\d+(\.\d+)?,-?\d+(\.\d+)?\n?)+$",
|
|
1131
|
+
filters=models.ControlTable.action_type
|
|
1132
|
+
!= constants.ControlTableActionTypes.set_discharge_coefficients,
|
|
1133
|
+
level=level,
|
|
1134
|
+
error_code=error_code,
|
|
1135
|
+
)
|
|
1136
|
+
|
|
1137
|
+
def description(self) -> str:
|
|
1138
|
+
return (
|
|
1139
|
+
f"{self.table.name}.{self.column} is not properly formatted."
|
|
1140
|
+
f"Expected one or more rows of: 'number, number number'"
|
|
1141
|
+
)
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
class ControlTableActionTableCheckDischargeCoefficients(TableStrCheck):
|
|
1145
|
+
def __init__(self, level=CheckLevel.ERROR, error_code=0):
|
|
1146
|
+
# check for action_table for action_type = set_discharge_coefficients
|
|
1147
|
+
# expected format: multiple rows, separated by \n of "val,val val"
|
|
1148
|
+
super().__init__(
|
|
1149
|
+
column=models.ControlTable.action_table,
|
|
1150
|
+
pattern=r"^(-?\d+(\.\d+)?,-?\d+(\.\d+)? -?\d+(\.\d+)?\n?)+$",
|
|
1151
|
+
filters=models.ControlTable.action_type
|
|
1152
|
+
== constants.ControlTableActionTypes.set_discharge_coefficients,
|
|
1153
|
+
level=level,
|
|
1154
|
+
error_code=error_code,
|
|
1155
|
+
)
|
|
1156
|
+
|
|
1157
|
+
def description(self) -> str:
|
|
1158
|
+
return (
|
|
1159
|
+
f"{self.table.name}.{self.column} is not properly formatted."
|
|
1160
|
+
f"Expected one or more rows of: 'number, number'"
|
|
1161
|
+
)
|
{threedi_modelchecker-2.10.0.dev4 → threedi_modelchecker-2.10.2.dev0}/threedi_modelchecker/config.py
RENAMED
|
@@ -1412,12 +1412,12 @@ CHECKS += [
|
|
|
1412
1412
|
),
|
|
1413
1413
|
QueryCheck(
|
|
1414
1414
|
error_code=406,
|
|
1415
|
-
column=models.GroundWater.
|
|
1415
|
+
column=models.GroundWater.equilibrium_infiltration_rate_aggregation,
|
|
1416
1416
|
invalid=Query(models.GroundWater).filter(
|
|
1417
|
-
models.GroundWater.
|
|
1417
|
+
models.GroundWater.equilibrium_infiltration_rate_aggregation == None,
|
|
1418
1418
|
~is_none_or_empty(models.GroundWater.equilibrium_infiltration_rate_file),
|
|
1419
1419
|
),
|
|
1420
|
-
message="groundwater.
|
|
1420
|
+
message="groundwater.equilibrium_infiltration_rate_aggregation should be defined when using an equilibrium_infiltration_rate_file.",
|
|
1421
1421
|
),
|
|
1422
1422
|
QueryCheck(
|
|
1423
1423
|
error_code=407,
|
|
@@ -2564,7 +2564,7 @@ CHECKS += [FirstTimeSeriesEqualTimestepsCheck(error_code=1206)]
|
|
|
2564
2564
|
CHECKS += [
|
|
2565
2565
|
ForeignKeyCheck(
|
|
2566
2566
|
error_code=1220,
|
|
2567
|
-
column=models.ControlMeasureLocation.
|
|
2567
|
+
column=models.ControlMeasureLocation.connection_node_id,
|
|
2568
2568
|
reference_column=models.ConnectionNode.id,
|
|
2569
2569
|
)
|
|
2570
2570
|
]
|
|
@@ -2642,7 +2642,7 @@ not_null_cols = [
|
|
|
2642
2642
|
models.ControlTable.target_type,
|
|
2643
2643
|
models.ControlMeasureMap.weight,
|
|
2644
2644
|
models.ControlMeasureMap.control_measure_location_id,
|
|
2645
|
-
models.ControlMeasureLocation.
|
|
2645
|
+
models.ControlMeasureLocation.connection_node_id,
|
|
2646
2646
|
]
|
|
2647
2647
|
CHECKS += [
|
|
2648
2648
|
NotNullCheck(error_code=1230 + i, column=col) for i, col in enumerate(not_null_cols)
|
|
@@ -14,6 +14,8 @@ from threedi_modelchecker.checks.other import (
|
|
|
14
14
|
ChannelManholeLevelCheck,
|
|
15
15
|
ConnectionNodesDistance,
|
|
16
16
|
ConnectionNodesLength,
|
|
17
|
+
ControlTableActionTableCheckDefault,
|
|
18
|
+
ControlTableActionTableCheckDischargeCoefficients,
|
|
17
19
|
CorrectAggregationSettingsExist,
|
|
18
20
|
CrossSectionLocationCheck,
|
|
19
21
|
CrossSectionSameConfigurationCheck,
|
|
@@ -901,3 +903,54 @@ def test_tags_valid(session):
|
|
|
901
903
|
assert len(check.get_invalid(session)) == 1
|
|
902
904
|
factories.TagsFactory(id=2, description="bar")
|
|
903
905
|
assert len(check.get_invalid(session)) == 0
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
@pytest.mark.parametrize(
|
|
909
|
+
"action_table, valid",
|
|
910
|
+
[
|
|
911
|
+
("1,2", True),
|
|
912
|
+
("1,2\n3,4", True),
|
|
913
|
+
("2,3\n3,4\n", True),
|
|
914
|
+
("1.0,2", True),
|
|
915
|
+
("1,2.1", True),
|
|
916
|
+
("1, 2", False),
|
|
917
|
+
("1;2", False),
|
|
918
|
+
("1,2 3", False),
|
|
919
|
+
("1,2,3", False),
|
|
920
|
+
],
|
|
921
|
+
)
|
|
922
|
+
def test_control_table_action_table_check_default(session, action_table, valid):
|
|
923
|
+
factories.ControlTableFactory(
|
|
924
|
+
action_table=action_table,
|
|
925
|
+
action_type=constants.ControlTableActionTypes.set_capacity,
|
|
926
|
+
)
|
|
927
|
+
check = ControlTableActionTableCheckDefault()
|
|
928
|
+
assert (len(check.get_invalid(session)) == 0) == valid
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
@pytest.mark.parametrize(
|
|
932
|
+
"action_table, valid",
|
|
933
|
+
[
|
|
934
|
+
("1,2 3", True),
|
|
935
|
+
("1,2 3\n3,4 5", True),
|
|
936
|
+
("2,3 3\n3,4 5\n", True),
|
|
937
|
+
("1.0,2 3", True),
|
|
938
|
+
("1,2.1 3", True),
|
|
939
|
+
("1,2.1 3", True),
|
|
940
|
+
("1,2.1 3.3", True),
|
|
941
|
+
("1,2", False),
|
|
942
|
+
("1, 2 3", False),
|
|
943
|
+
("1;2 3", False),
|
|
944
|
+
("1,2,3", False),
|
|
945
|
+
("1,2 3 4", False),
|
|
946
|
+
],
|
|
947
|
+
)
|
|
948
|
+
def test_control_table_action_table_check_discharge_coefficients(
|
|
949
|
+
session, action_table, valid
|
|
950
|
+
):
|
|
951
|
+
factories.ControlTableFactory(
|
|
952
|
+
action_table=action_table,
|
|
953
|
+
action_type=constants.ControlTableActionTypes.set_discharge_coefficients,
|
|
954
|
+
)
|
|
955
|
+
check = ControlTableActionTableCheckDischargeCoefficients()
|
|
956
|
+
assert (len(check.get_invalid(session)) == 0) == valid
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threedi-modelchecker
|
|
3
|
-
Version: 2.10.
|
|
3
|
+
Version: 2.10.2.dev0
|
|
4
4
|
Summary: Checks validity of a 3Di schematisation
|
|
5
5
|
Author-email: Nelen & Schuurmans <info@nelen-schuurmans.nl>
|
|
6
6
|
License: MIT
|
|
@@ -15,7 +15,7 @@ License-File: LICENSE
|
|
|
15
15
|
Requires-Dist: Click
|
|
16
16
|
Requires-Dist: GeoAlchemy2!=0.11.*,>=0.9
|
|
17
17
|
Requires-Dist: SQLAlchemy>=1.4
|
|
18
|
-
Requires-Dist: threedi-schema
|
|
18
|
+
Requires-Dist: threedi-schema==0.224.*
|
|
19
19
|
Provides-Extra: rasterio
|
|
20
20
|
Requires-Dist: rasterio>=1.3.10; extra == "rasterio"
|
|
21
21
|
Provides-Extra: test
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|