hydamo-validation 1.3.1__tar.gz → 1.4.0__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.

Potentially problematic release.


This version of hydamo-validation might be problematic. Click here for more details.

Files changed (53) hide show
  1. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/PKG-INFO +32 -5
  2. hydamo_validation-1.4.0/README.md +75 -0
  3. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/__init__.py +1 -1
  4. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/functions/topologic.py +9 -3
  5. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/logical_validation.py +5 -2
  6. hydamo_validation-1.4.0/hydamo_validation/schemas/hydamo/HyDAMO_2.4.json +6919 -0
  7. hydamo_validation-1.4.0/hydamo_validation/schemas/rules/rules_1.4.json +1128 -0
  8. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/PKG-INFO +32 -5
  9. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/SOURCES.txt +3 -0
  10. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_dommelerwaard.py +7 -1
  11. hydamo_validation-1.4.0/tests/test_hydamo_2_4.py +137 -0
  12. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_wrij.py +3 -0
  13. hydamo_validation-1.3.1/README.md +0 -48
  14. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/LICENSE +0 -0
  15. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/datamodel.py +0 -0
  16. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/datasets.py +0 -0
  17. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/functions/__init__.py +0 -0
  18. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/functions/general.py +0 -0
  19. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/functions/logic.py +0 -0
  20. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/geometry.py +0 -0
  21. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/hydamo/HyDAMO_2.2.json +0 -0
  22. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/hydamo/HyDAMO_2.3.json +0 -0
  23. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/rules/rules_1.0.json +0 -0
  24. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/rules/rules_1.1.json +0 -0
  25. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/rules/rules_1.2.json +0 -0
  26. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/schemas/rules/rules_1.3.json +0 -0
  27. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/styles/hydroobject.qml +0 -0
  28. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/styles/hydroobject.sld +0 -0
  29. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/styles.py +0 -0
  30. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/summaries.py +0 -0
  31. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/syntax_validation.py +0 -0
  32. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/utils.py +0 -0
  33. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation/validator.py +0 -0
  34. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/dependency_links.txt +0 -0
  35. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/requires.txt +0 -0
  36. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/top_level.txt +0 -0
  37. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/hydamo_validation.egg-info/zip-safe +0 -0
  38. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/pyproject.toml +0 -0
  39. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/setup.cfg +0 -0
  40. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/setup.py +0 -0
  41. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_datasets.py +0 -0
  42. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_general_functions.py +0 -0
  43. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_hydamo_2_2.py +0 -0
  44. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_init.py +0 -0
  45. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_logic_functions.py +0 -0
  46. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_not_overlapping.py +0 -0
  47. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_productie.py +0 -0
  48. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_structures_at_interersections.py +0 -0
  49. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_summaries.py +0 -0
  50. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_testset.py +0 -0
  51. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_topologic_functions.py +0 -0
  52. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_validationrules.py +0 -0
  53. {hydamo_validation-1.3.1 → hydamo_validation-1.4.0}/tests/test_wrij_profielen.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hydamo_validation
3
- Version: 1.3.1
3
+ Version: 1.4.0
4
4
  Summary: Validation module for HyDAMO data
5
5
  Author-email: Daniel Tollenaar <daniel@d2hydro.nl>
6
6
  License: MIT
@@ -57,11 +57,38 @@ Download or clone the repository. Now simply install the module in the activated
57
57
  pip install .
58
58
  ```
59
59
 
60
- ## Run an example
61
- A working example with data can be found in `notebooks/test_wrij.ipynb`. In the activated environment launch jupyter notebook by:
60
+ ## Run in Python
62
61
 
62
+ ### Specify a coverage directory
63
+ To get the validator running you need some AHN data. You can find these in the [data directory](https://github.com/HetWaterschapshuis/HyDAMOValidatieModule/tree/ee9ea1efed385deb692b89057e9c97114fd8c3be/tests/data/dtm) of this directory. We assume you copy this to `your/local/ahn/dir`. Now specify your coverage and init the validator in a python-script:
64
+
65
+ ```
66
+ from hydamo_validation import validator
67
+ from pathlib import Path
68
+
69
+ coverage = {"AHN": Path("your/local/ahn/dir")}
70
+
71
+ hydamo_validator = validator(
72
+ output_types=["geopackage", "csv", "geojson"], coverages=coverage, log_level="INFO"
73
+ )
74
+
75
+ ```
76
+
77
+ With this validator you can validate a directory that directory should have the following structure. The name of `datasets` directory and `ValidatorRules.json` are mandatory. Within datasets you can put one or more geopackages with `HyDAMO` layers.
78
+
79
+ ```
80
+ your/directory/
81
+ ├─ datasets/
82
+ │ ├─ hydamo.gpkg
83
+ ├─ ValidationRules.json
63
84
  ```
64
- jupyter notebook
85
+
86
+ Now you can validate the `HyDAMO` layers inside `your/ directory` by:
65
87
  ```
66
88
 
67
- Select `test_wrij.ipynb` read and run it.
89
+ directory = Path("your/directory")
90
+
91
+ datamodel, layer_summary, result_summary = hydamo_validator(
92
+ directory=directory, raise_error=False
93
+ )
94
+ ```
@@ -0,0 +1,75 @@
1
+ # The HyDAMO Validation Module: hydamo_validation
2
+
3
+ Validation Module for HyDAMO data.
4
+
5
+ ## Installation
6
+
7
+ ### Python installation
8
+ Make sure you have an Miniconda or Anaconda installation. You can download these here:
9
+ - https://www.anaconda.com/products/individual
10
+ - https://docs.conda.io/en/latest/miniconda.html
11
+
12
+ During installation, tick the box "Add Anaconda to PATH", ignore the red remarks
13
+
14
+ ### Create the `validatietool` environment
15
+ Use the `env/environment.yml` in the repository to create the conda environment: `validatietool`
16
+
17
+ ```
18
+ conda env create -f environment.yml
19
+ ```
20
+
21
+ After installation you can activate your environment in command prompt
22
+
23
+ ```
24
+ conda activate validatietool
25
+ ```
26
+
27
+ ### Install hydamo_validation
28
+ Simply install the module in the activated environment:
29
+
30
+ ```
31
+ pip install hydamo_validation
32
+ ```
33
+
34
+ ### Develop-install hydamo_validation
35
+ Download or clone the repository. Now simply install the module in the activated environment:
36
+
37
+ ```
38
+ pip install .
39
+ ```
40
+
41
+ ## Run in Python
42
+
43
+ ### Specify a coverage directory
44
+ To get the validator running you need some AHN data. You can find these in the [data directory](https://github.com/HetWaterschapshuis/HyDAMOValidatieModule/tree/ee9ea1efed385deb692b89057e9c97114fd8c3be/tests/data/dtm) of this directory. We assume you copy this to `your/local/ahn/dir`. Now specify your coverage and init the validator in a python-script:
45
+
46
+ ```
47
+ from hydamo_validation import validator
48
+ from pathlib import Path
49
+
50
+ coverage = {"AHN": Path("your/local/ahn/dir")}
51
+
52
+ hydamo_validator = validator(
53
+ output_types=["geopackage", "csv", "geojson"], coverages=coverage, log_level="INFO"
54
+ )
55
+
56
+ ```
57
+
58
+ With this validator you can validate a directory that directory should have the following structure. The name of `datasets` directory and `ValidatorRules.json` are mandatory. Within datasets you can put one or more geopackages with `HyDAMO` layers.
59
+
60
+ ```
61
+ your/directory/
62
+ ├─ datasets/
63
+ │ ├─ hydamo.gpkg
64
+ ├─ ValidationRules.json
65
+ ```
66
+
67
+ Now you can validate the `HyDAMO` layers inside `your/ directory` by:
68
+ ```
69
+
70
+ directory = Path("your/directory")
71
+
72
+ datamodel, layer_summary, result_summary = hydamo_validator(
73
+ directory=directory, raise_error=False
74
+ )
75
+ ```
@@ -1,7 +1,7 @@
1
1
  __author__ = ["Het Waterschapshuis", "D2HYDRO", "HKV", "HydroConsult"]
2
2
  __copyright__ = "Copyright 2021, HyDAMO ValidatieTool"
3
3
  __credits__ = ["D2HYDRO", "HKV", "HydroConsult"]
4
- __version__ = "1.3.1"
4
+ __version__ = "1.4.0"
5
5
 
6
6
  __license__ = "MIT"
7
7
  __maintainer__ = "Daniel Tollenaar"
@@ -4,6 +4,7 @@ from typing import Literal
4
4
  import geopandas as gpd
5
5
  import pandas as pd
6
6
  from shapely.geometry import Point
7
+ from hydamo_validation import geometry
7
8
 
8
9
  """
9
10
  In this block we define supporting functions. Supporting functions are ignored
@@ -364,7 +365,9 @@ def snaps_to_hydroobject(gdf, datamodel, method, tolerance=0.001, dtype=bool):
364
365
  """
365
366
 
366
367
  branches = datamodel.hydroobject
367
- gdf.snap_to_branch(branches, snap_method=method, maxdist=tolerance)
368
+ geometry.find_nearest_branch(
369
+ branches=branches, geometries=gdf, method=method, maxdist=tolerance
370
+ )
368
371
  series = ~gdf.branch_offset.isna()
369
372
  return series.astype(dtype)
370
373
 
@@ -651,12 +654,15 @@ def compare_longitudinal(
651
654
  Default dtype is bool
652
655
 
653
656
  """
657
+ branches = datamodel.hydroobject
654
658
  compare_gdf = getattr(datamodel, compare_object)
655
659
 
656
660
  # snap layers to to branches
657
- compare_gdf.snap_to_branch(datamodel.hydroobject, snap_method="overall")
658
- gdf.snap_to_branch(datamodel.hydroobject, snap_method="overall")
661
+ geometry.find_nearest_branch(
662
+ branches=branches, geometries=compare_gdf, method="overall"
663
+ )
659
664
 
665
+ geometry.find_nearest_branch(branches=branches, geometries=gdf, method="overall")
660
666
  return gdf.apply(
661
667
  lambda x: _compare_longitudinal(
662
668
  x, parameter, compare_gdf, compare_parameter, direction, logical_operator
@@ -129,7 +129,7 @@ def execute(
129
129
  if i["object"] in datamodel.data_layers
130
130
  ]
131
131
  logger.info(
132
- rf"lagen met valide objecten en regels: {[i["object"] for i in object_rules_sets]}"
132
+ rf"lagen met valide objecten en regels: {[i['object'] for i in object_rules_sets]}"
133
133
  )
134
134
  for object_rules in object_rules_sets:
135
135
  col_translation: dict = {}
@@ -280,7 +280,10 @@ def execute(
280
280
  hasattr(datamodel, "hydroobject")
281
281
  ):
282
282
  result_series = _process_topologic_function(
283
- getattr(datamodel, object_layer),
283
+ # getattr(
284
+ # datamodel, object_layer
285
+ # ), # FIXME: commented as we need to apply filter in topologic functions as well. Remove after tests pass
286
+ object_gdf,
284
287
  datamodel,
285
288
  function,
286
289
  input_variables,