threedi-modelchecker 2.8.2.dev0__tar.gz → 2.10.0.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.
Files changed (44) hide show
  1. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/CHANGES.rst +7 -1
  2. {threedi_modelchecker-2.8.2.dev0/threedi_modelchecker.egg-info → threedi_modelchecker-2.10.0.dev0}/PKG-INFO +2 -2
  3. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/pyproject.toml +2 -1
  4. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/__init__.py +1 -1
  5. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/config.py +76 -66
  6. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/conftest.py +2 -2
  7. threedi_modelchecker-2.10.0.dev0/threedi_modelchecker/tests/data/empty.sqlite +3 -0
  8. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/factories.py +2 -51
  9. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0/threedi_modelchecker.egg-info}/PKG-INFO +2 -2
  10. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker.egg-info/SOURCES.txt +2 -1
  11. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker.egg-info/requires.txt +1 -1
  12. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/LICENSE +0 -0
  13. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/MANIFEST.in +0 -0
  14. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/README.rst +0 -0
  15. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/setup.cfg +0 -0
  16. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/__init__.py +0 -0
  17. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/base.py +0 -0
  18. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/cross_section_definitions.py +0 -0
  19. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/factories.py +0 -0
  20. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/geo_query.py +0 -0
  21. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/other.py +0 -0
  22. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/raster.py +0 -0
  23. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/checks/timeseries.py +0 -0
  24. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/exporters.py +0 -0
  25. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/interfaces/__init__.py +0 -0
  26. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/interfaces/raster_interface.py +0 -0
  27. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/interfaces/raster_interface_gdal.py +0 -0
  28. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/interfaces/raster_interface_rasterio.py +0 -0
  29. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/model_checks.py +0 -0
  30. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/scripts.py +0 -0
  31. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/__init__.py +0 -0
  32. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/data/__init__.py +0 -0
  33. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/data/empty.gpkg +0 -0
  34. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_base.py +0 -0
  35. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_cross_section_definitions.py +0 -0
  36. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_factories.py +0 -0
  37. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_other.py +0 -0
  38. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_raster.py +0 -0
  39. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_checks_timeseries.py +0 -0
  40. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_exporters.py +0 -0
  41. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker/tests/test_model_checks.py +0 -0
  42. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker.egg-info/dependency_links.txt +0 -0
  43. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker.egg-info/entry_points.txt +0 -0
  44. {threedi_modelchecker-2.8.2.dev0 → threedi_modelchecker-2.10.0.dev0}/threedi_modelchecker.egg-info/top_level.txt +0 -0
@@ -2,7 +2,13 @@ Changelog of threedi-modelchecker
2
2
  =================================
3
3
 
4
4
 
5
- 2.8.2 (unreleased)
5
+ 2.9.1 (unreleased)
6
+ ------------------
7
+
8
+ - Adapt modelchecker to work with schema upgrades for structure control (0.224)
9
+
10
+
11
+ 2.9.0 (2024-08-01)
6
12
  ------------------
7
13
 
8
14
  - Adapt modelchecker to work with schema upgrades for inflow (0.223)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: threedi-modelchecker
3
- Version: 2.8.2.dev0
3
+ Version: 2.10.0.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==0.223.dev1
18
+ Requires-Dist: threedi-schema==0.224.0.dev0
19
19
  Provides-Extra: rasterio
20
20
  Requires-Dist: rasterio>=1.3.10; extra == "rasterio"
21
21
  Provides-Extra: test
@@ -19,7 +19,8 @@ dependencies = [
19
19
  "Click",
20
20
  "GeoAlchemy2>=0.9,!=0.11.*",
21
21
  "SQLAlchemy>=1.4",
22
- "threedi-schema==0.223.dev1"
22
+ "threedi-schema==0.224.0.dev0"
23
+ # "threedi-schema@git+https://github.com/nens/threedi-schema@margriet_70_schema_300_structure_control",
23
24
  ]
24
25
 
25
26
  [project.optional-dependencies]
@@ -1,5 +1,5 @@
1
1
  from .model_checks import * # NOQA
2
2
 
3
3
  # fmt: off
4
- __version__ = '2.8.2.dev0'
4
+ __version__ = '2.10.0.dev0'
5
5
  # fmt: on
@@ -2559,88 +2559,98 @@ CHECKS += [
2559
2559
  ]
2560
2560
  CHECKS += [FirstTimeSeriesEqualTimestepsCheck(error_code=1206)]
2561
2561
 
2562
- ## 122x Structure controls
2562
+ ## 12xx Structure controls
2563
2563
 
2564
2564
  CHECKS += [
2565
2565
  ForeignKeyCheck(
2566
2566
  error_code=1220,
2567
- column=models.ControlMeasureMap.object_id,
2567
+ column=models.ControlMeasureLocation.object_id,
2568
2568
  reference_column=models.ConnectionNode.id,
2569
- filters=models.ControlMeasureMap.object_type == "v2_connection_node",
2570
- )
2571
- ]
2572
- CHECKS += [
2573
- ForeignKeyCheck(
2574
- error_code=1221,
2575
- column=control_table.target_id,
2576
- reference_column=models.Channel.id,
2577
- filters=control_table.target_type == "v2_channel",
2578
- )
2579
- for control_table in (models.ControlMemory, models.ControlTable)
2580
- ]
2581
- CHECKS += [
2582
- ForeignKeyCheck(
2583
- error_code=1222,
2584
- column=control_table.target_id,
2585
- reference_column=models.Pipe.id,
2586
- filters=control_table.target_type == "v2_pipe",
2587
- )
2588
- for control_table in (models.ControlMemory, models.ControlTable)
2589
- ]
2590
- CHECKS += [
2591
- ForeignKeyCheck(
2592
- error_code=1223,
2593
- column=control_table.target_id,
2594
- reference_column=models.Orifice.id,
2595
- filters=control_table.target_type == "v2_orifice",
2596
- )
2597
- for control_table in (models.ControlMemory, models.ControlTable)
2598
- ]
2599
- CHECKS += [
2600
- ForeignKeyCheck(
2601
- error_code=1224,
2602
- column=control_table.target_id,
2603
- reference_column=models.Culvert.id,
2604
- filters=control_table.target_type == "v2_culvert",
2605
- )
2606
- for control_table in (models.ControlMemory, models.ControlTable)
2607
- ]
2608
- CHECKS += [
2609
- ForeignKeyCheck(
2610
- error_code=1225,
2611
- column=control_table.target_id,
2612
- reference_column=models.Weir.id,
2613
- filters=control_table.target_type == "v2_weir",
2614
- )
2615
- for control_table in (models.ControlMemory, models.ControlTable)
2616
- ]
2617
- CHECKS += [
2618
- ForeignKeyCheck(
2619
- error_code=1226,
2620
- column=control_table.target_id,
2621
- reference_column=models.Pumpstation.id,
2622
- filters=control_table.target_type == "v2_pumpstation",
2623
- )
2624
- for control_table in (models.ControlMemory, models.ControlTable)
2625
- ]
2569
+ filters=models.ControlMeasureLocation.object_type == "connection_node",
2570
+ )
2571
+ ]
2572
+
2573
+ # 1221 - 1226
2574
+ ref_cols = [
2575
+ models.Channel.id,
2576
+ models.Pipe.id,
2577
+ models.Orifice.id,
2578
+ models.Culvert.id,
2579
+ models.Weir.id,
2580
+ models.Pumpstation.id,
2581
+ ]
2582
+ target_types = [
2583
+ "v2_channel",
2584
+ "v2_pipe",
2585
+ "v2_orifice",
2586
+ "v2_culvert",
2587
+ "v2_weir",
2588
+ "v2_pumpstation",
2589
+ ]
2590
+ for i, (ref_col, target_type) in enumerate(zip(ref_cols, target_types)):
2591
+ for control_table in (models.ControlMemory, models.ControlTable):
2592
+ CHECKS += [
2593
+ ForeignKeyCheck(
2594
+ error_code=1221 + i,
2595
+ column=control_table.target_id,
2596
+ reference_column=ref_col,
2597
+ filters=control_table.target_type == target_type,
2598
+ )
2599
+ ]
2600
+
2601
+
2626
2602
  CHECKS += [
2627
2603
  QueryCheck(
2628
2604
  error_code=1227,
2629
- column=models.Control.id,
2630
- invalid=Query(models.Control).filter(
2605
+ column=models.ControlMeasureMap.id,
2606
+ invalid=Query(models.ControlMeasureMap).filter(
2631
2607
  (
2632
- (models.Control.control_type == "memory")
2633
- & models.Control.control_id.not_in(Query(models.ControlMemory.id))
2608
+ (models.ControlMeasureMap.control_type == "memory")
2609
+ & models.ControlMeasureMap.control_id.not_in(
2610
+ Query(models.ControlMemory.id)
2611
+ )
2634
2612
  )
2635
2613
  | (
2636
- (models.Control.control_type == "table")
2637
- & models.Control.control_id.not_in(Query(models.ControlTable.id))
2614
+ (models.ControlMeasureMap.control_type == "table")
2615
+ & models.ControlMeasureMap.control_id.not_in(
2616
+ Query(models.ControlTable.id)
2617
+ )
2638
2618
  )
2639
2619
  ),
2640
- message="v2_control.control_id references an id in v2_control_memory or v2_control_table, but the table it references does not contain an entry with that id.",
2620
+ message="v2_control_measure_map.control_id references an id in memory_control or table_control, but the table it references does not contain an entry with that id.",
2641
2621
  )
2642
2622
  ]
2643
2623
 
2624
+ CHECKS += [
2625
+ ForeignKeyCheck(
2626
+ error_code=1228,
2627
+ column=models.ControlMeasureMap.control_measure_location_id,
2628
+ reference_column=models.ControlMeasureLocation.id,
2629
+ )
2630
+ ]
2631
+
2632
+ # 1230 - 1242
2633
+ not_null_cols = [
2634
+ models.ControlMemory.measure_variable,
2635
+ models.ControlMemory.action_type,
2636
+ models.ControlMemory.action_value_1,
2637
+ models.ControlMemory.action_value_2,
2638
+ models.ControlMemory.target_type,
2639
+ models.ControlMemory.target_id,
2640
+ models.ControlTable.action_table,
2641
+ models.ControlTable.action_type,
2642
+ models.ControlTable.measure_variable,
2643
+ models.ControlTable.target_type,
2644
+ models.ControlMeasureMap.weight,
2645
+ models.ControlMeasureMap.control_measure_location_id,
2646
+ models.ControlMeasureLocation.object_id,
2647
+ models.ControlMeasureLocation.object_type,
2648
+ ]
2649
+ CHECKS += [
2650
+ NotNullCheck(error_code=1230 + i, column=col) for i, col in enumerate(not_null_cols)
2651
+ ]
2652
+
2653
+
2644
2654
  ## 018x cross section parameters (continues 008x)
2645
2655
  vegetation_parameter_columns = [
2646
2656
  models.CrossSectionDefinition.vegetation_drag_coefficients,
@@ -20,8 +20,8 @@ def threedi_db(tmpdir_factory):
20
20
  https://factoryboy.readthedocs.io/en/latest/orms.html#managing-sessions
21
21
  """
22
22
  tmp_path = tmpdir_factory.mktemp("spatialite4")
23
- tmp_sqlite = tmp_path / "empty.gpkg"
24
- shutil.copyfile(data_dir / "empty.gpkg", tmp_sqlite)
23
+ tmp_sqlite = tmp_path / "empty.sqlite"
24
+ shutil.copyfile(data_dir / "empty.sqlite", tmp_sqlite)
25
25
  db = ThreediDatabase(tmp_sqlite)
26
26
  schema = ModelSchema(db)
27
27
  schema.upgrade(backup=False, upgrade_spatialite_version=False)
@@ -0,0 +1,3 @@
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ff9eba57d54653c0e4d61130ba70152a0f5d0181b8658d4d367673532eba190
3
+ size 7139328
@@ -41,12 +41,6 @@ class ModelSettingsFactory(factory.alchemy.SQLAlchemyModelFactory):
41
41
  friction_type = constants.FrictionType.CHEZY
42
42
 
43
43
 
44
- class ControlGroupFactory(factory.alchemy.SQLAlchemyModelFactory):
45
- class Meta:
46
- model = models.ControlGroup
47
- sqlalchemy_session = None
48
-
49
-
50
44
  class ConnectionNodeFactory(factory.alchemy.SQLAlchemyModelFactory):
51
45
  class Meta:
52
46
  model = models.ConnectionNode
@@ -194,24 +188,6 @@ class Lateral2DFactory(factory.alchemy.SQLAlchemyModelFactory):
194
188
  type = constants.Later2dType.SURFACE
195
189
 
196
190
 
197
- # class ImperviousSurfaceFactory(factory.alchemy.SQLAlchemyModelFactory):
198
- # class Meta:
199
- # model = models.ImperviousSurface
200
- # sqlalchemy_session = None
201
- #
202
- # surface_class = "pand"
203
- # surface_inclination = "vlak"
204
- # area = 0.0
205
-
206
-
207
- # class ImperviousSurfaceMapFactory(factory.alchemy.SQLAlchemyModelFactory):
208
- # class Meta:
209
- # model = models.ImperviousSurfaceMap
210
- # sqlalchemy_session = None
211
- #
212
- # percentage = 100.0
213
-
214
-
215
191
  class SurfaceParameterFactory(factory.alchemy.SQLAlchemyModelFactory):
216
192
  class Meta:
217
193
  model = models.SurfaceParameter
@@ -279,7 +255,8 @@ class ControlMemoryFactory(factory.alchemy.SQLAlchemyModelFactory):
279
255
  sqlalchemy_session = None
280
256
 
281
257
  action_type = constants.ControlTableActionTypes.set_discharge_coefficients
282
- action_value = "0.0 -1.0"
258
+ action_value_1 = 0.0
259
+ action_value_2 = -1.0
283
260
  measure_variable = constants.MeasureVariables.waterlevel
284
261
  target_type = constants.StructureControlTypes.channel
285
262
  target_id = 10
@@ -289,32 +266,6 @@ class ControlMemoryFactory(factory.alchemy.SQLAlchemyModelFactory):
289
266
  lower_threshold = -1.0
290
267
 
291
268
 
292
- class ControlMeasureGroupFactory(factory.alchemy.SQLAlchemyModelFactory):
293
- class Meta:
294
- model = models.ControlMeasureGroup
295
- sqlalchemy_session = None
296
-
297
-
298
- class ControlMeasureMapFactory(factory.alchemy.SQLAlchemyModelFactory):
299
- class Meta:
300
- model = models.ControlMeasureMap
301
- sqlalchemy_session = None
302
-
303
- object_type = "v2_connection_nodes"
304
- object_id = 101
305
- weight = 0.1
306
-
307
-
308
- class ControlFactory(factory.alchemy.SQLAlchemyModelFactory):
309
- class Meta:
310
- model = models.Control
311
- sqlalchemy_session = None
312
-
313
- start = "0"
314
- end = "300"
315
- measure_frequency = 10
316
-
317
-
318
269
  class CulvertFactory(factory.alchemy.SQLAlchemyModelFactory):
319
270
  class Meta:
320
271
  model = models.Culvert
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: threedi-modelchecker
3
- Version: 2.8.2.dev0
3
+ Version: 2.10.0.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==0.223.dev1
18
+ Requires-Dist: threedi-schema==0.224.0.dev0
19
19
  Provides-Extra: rasterio
20
20
  Requires-Dist: rasterio>=1.3.10; extra == "rasterio"
21
21
  Provides-Extra: test
@@ -38,4 +38,5 @@ threedi_modelchecker/tests/test_checks_timeseries.py
38
38
  threedi_modelchecker/tests/test_exporters.py
39
39
  threedi_modelchecker/tests/test_model_checks.py
40
40
  threedi_modelchecker/tests/data/__init__.py
41
- threedi_modelchecker/tests/data/empty.gpkg
41
+ threedi_modelchecker/tests/data/empty.gpkg
42
+ threedi_modelchecker/tests/data/empty.sqlite
@@ -1,7 +1,7 @@
1
1
  Click
2
2
  GeoAlchemy2!=0.11.*,>=0.9
3
3
  SQLAlchemy>=1.4
4
- threedi-schema==0.223.dev1
4
+ threedi-schema==0.224.0.dev0
5
5
 
6
6
  [rasterio]
7
7
  rasterio>=1.3.10