threedigrid-builder 1.13.2.dev2__tar.gz → 1.14.1.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.
- {threedigrid-builder-1.13.2.dev2/threedigrid_builder.egg-info → threedigrid-builder-1.14.1.dev0}/PKG-INFO +2 -2
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/setup.py +1 -1
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/__init__.py +1 -1
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/settings.py +32 -5
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/db.py +69 -40
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_db.py +2 -2
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0/threedigrid_builder.egg-info}/PKG-INFO +2 -2
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/requires.txt +1 -1
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/CMakeLists.txt +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/LICENSE +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/MANIFEST.in +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/README.rst +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/array_utils.f90 +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/cells.f90 +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/geo_utils.f90 +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/parameters.f90 +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/quadtree.f90 +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/pyproject.toml +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/setup.cfg +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/application.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/__init__.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/array.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/interfaces.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/line_halfs.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/lines.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/linestrings.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/nodes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/pumps.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/base/surfaces.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/cli.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/constants.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/exceptions.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/__init__.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/boundary_conditions.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/channels.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/connection_nodes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/cross_section_definitions.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/cross_section_locations.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/dem_average_area.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/embedded.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/exchange_lines.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/fgrid/__init__.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/grid.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/grid_refinement.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/groundwater.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/initial_waterlevels.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/linear.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/lines_1d2d.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/obstacles.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/pipes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/potential_breaches.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/quadtree.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/structures.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/windshielding.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/zero_d.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/__init__.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/dict_out.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/geopackage.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/gridadmin.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/interface/raster_gdal.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/__init__.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/conftest.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_array.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_boundary_conditions.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_channels.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_connection_nodes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_cross_section_definitions.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_cross_section_locations.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_dem_average.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_dict_out.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_embedded.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_exchange_lines.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_grid.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_grid_refinements.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_gridadmin.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_groundwater.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_initial_waterlevels.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_line_halfs.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_linear.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_lines.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_lines_1d2d.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_linestrings.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_nodes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_obstacles.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_pipes.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_potential_breaches.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_pumps.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_quadtree.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_raster_interfaces.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_structures.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_windshielding.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/tests/test_zero_d.py +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/SOURCES.txt +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/dependency_links.txt +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/entry_points.txt +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/not-zip-safe +0 -0
- {threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threedigrid-builder
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.1.dev0
|
|
4
4
|
Summary: Generate a 3Di simulation grid from a model schematisation.
|
|
5
5
|
Home-page: https://docs.3di.lizard.net/
|
|
6
6
|
Author: Martijn Siemerink
|
|
@@ -19,7 +19,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
19
19
|
Requires-Python: >=3.8
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: numpy>=1.15
|
|
22
|
-
Requires-Dist: threedi-schema==0.
|
|
22
|
+
Requires-Dist: threedi-schema==0.222.dev0
|
|
23
23
|
Requires-Dist: shapely>=2
|
|
24
24
|
Requires-Dist: pyproj>=3
|
|
25
25
|
Requires-Dist: condenser[geo]>=0.1.1
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import copy
|
|
1
2
|
from dataclasses import dataclass
|
|
2
3
|
from dataclasses import fields
|
|
3
4
|
from threedigrid_builder.base import is_int_enum
|
|
@@ -7,7 +8,7 @@ from threedigrid_builder.constants import InfiltrationSurfaceOption
|
|
|
7
8
|
from threedigrid_builder.constants import InitializationType
|
|
8
9
|
from threedigrid_builder.constants import InterflowType
|
|
9
10
|
from threedigrid_builder.exceptions import SchematisationError
|
|
10
|
-
from typing import Optional
|
|
11
|
+
from typing import Any, Dict, Optional
|
|
11
12
|
|
|
12
13
|
import numpy as np
|
|
13
14
|
|
|
@@ -21,6 +22,10 @@ def greater_zero_check(obj, attr):
|
|
|
21
22
|
raise SchematisationError(f"'{attr}' must be greater than 0.")
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
def replace_keys(dict: Dict[str, Any], key_map: Dict[str, str]) -> Dict[str, Any]:
|
|
26
|
+
return {key if key not in key_map else key_map[key] : val for key, val in dict.items()}
|
|
27
|
+
|
|
28
|
+
|
|
24
29
|
@dataclass
|
|
25
30
|
class GridSettings:
|
|
26
31
|
"""Settings necessary for threedigrid-builder."""
|
|
@@ -39,6 +44,10 @@ class GridSettings:
|
|
|
39
44
|
@classmethod
|
|
40
45
|
def from_dict(cls, dct):
|
|
41
46
|
"""Construct skipping unknown fields and None values"""
|
|
47
|
+
schema_to_builder_map = {'minimum_cell_size': 'grid_space',
|
|
48
|
+
'calculation_point_distance_1d': 'dist_calc_points',
|
|
49
|
+
'nr_grid_levels': 'kmax'}
|
|
50
|
+
dct = replace_keys(copy.copy(dct), schema_to_builder_map)
|
|
42
51
|
class_fields = {f.name for f in fields(cls)}
|
|
43
52
|
return cls(
|
|
44
53
|
**{k: v for k, v in dct.items() if k in class_fields and v is not None}
|
|
@@ -47,7 +56,7 @@ class GridSettings:
|
|
|
47
56
|
def __post_init__(self):
|
|
48
57
|
# validations
|
|
49
58
|
if self.use_2d:
|
|
50
|
-
for field in ["
|
|
59
|
+
for field in ["grid_sminimum_cell_sizepace", "nr_grid_levels"]:
|
|
51
60
|
greater_zero_check(self, field)
|
|
52
61
|
|
|
53
62
|
|
|
@@ -55,16 +64,18 @@ class GridSettings:
|
|
|
55
64
|
class TablesSettings:
|
|
56
65
|
"""Settings necessary for threedi-tables."""
|
|
57
66
|
|
|
58
|
-
## from
|
|
67
|
+
## from ModelSettings
|
|
59
68
|
table_step_size: float
|
|
60
69
|
frict_coef: float
|
|
61
70
|
frict_coef_type: InitializationType
|
|
62
71
|
frict_type: FrictionType = FrictionType.MANNING
|
|
63
|
-
interception_global: Optional[float] = None
|
|
64
|
-
interception_type: Optional[InitializationType] = None
|
|
65
72
|
table_step_size_1d: float = None # actual default is set in __post_init__
|
|
66
73
|
maximum_table_step_size: float = None # actual default is set in __post_init__
|
|
67
74
|
|
|
75
|
+
## From Interception
|
|
76
|
+
interception_global: Optional[float] = None
|
|
77
|
+
interception_type: Optional[InitializationType] = None
|
|
78
|
+
|
|
68
79
|
# TODO --> https://github.com/nens/threedigrid-builder/issues/86
|
|
69
80
|
manhole_storage_area: Optional[float] = None
|
|
70
81
|
|
|
@@ -150,6 +161,22 @@ class TablesSettings:
|
|
|
150
161
|
def from_dict(cls, dct):
|
|
151
162
|
"""Construct skipping unknown fields and None values"""
|
|
152
163
|
class_fields = {f.name for f in fields(cls)}
|
|
164
|
+
schema_to_builder_map = {"groundwater_hydraulic_conductivity": "groundwater_hydro_connectivity",
|
|
165
|
+
"groundwater_hydraulic_conductivity_aggregation": "groundwater_hydro_connectivity_type",
|
|
166
|
+
"groundwater_impervious_layer_level_aggregation": "groundwater_impervious_layer_level_type",
|
|
167
|
+
"infiltration_decay_period_aggregation": "infiltration_decay_period_type",
|
|
168
|
+
"initial_infiltration_rate_aggregation": "initial_infiltration_rate_type",
|
|
169
|
+
"phreatic_storage_capacity_aggregation": "phreatic_storage_capacity_type",
|
|
170
|
+
"max_infiltration_volume": "max_infiltration_capacity",
|
|
171
|
+
"max_infiltration_volume_type": "max_infiltration_capacity_type",
|
|
172
|
+
"manhole_aboveground_storage_area": "manhole_storage_area",
|
|
173
|
+
"friction_coefficient": "frict_coef",
|
|
174
|
+
"minimum_table_step_size": "table_step_size",
|
|
175
|
+
"friction_type": "frict_type",
|
|
176
|
+
"friction_coefficient_type": "frict_coef_type",
|
|
177
|
+
"interception": "interception_global",
|
|
178
|
+
}
|
|
179
|
+
dct = replace_keys(copy.copy(dct), schema_to_builder_map)
|
|
153
180
|
return cls(
|
|
154
181
|
**{k: v for k, v in dct.items() if k in class_fields and v is not None}
|
|
155
182
|
)
|
|
@@ -44,7 +44,7 @@ __all__ = ["SQLite"]
|
|
|
44
44
|
# hardcoded source projection
|
|
45
45
|
SOURCE_EPSG = 4326
|
|
46
46
|
|
|
47
|
-
MIN_SQLITE_VERSION =
|
|
47
|
+
MIN_SQLITE_VERSION = 222
|
|
48
48
|
|
|
49
49
|
DAY_IN_SECONDS = 24.0 * 3600.0
|
|
50
50
|
|
|
@@ -82,7 +82,6 @@ def _set_initialization_type(
|
|
|
82
82
|
file_field = f"{global_field}_file"
|
|
83
83
|
if not type_field:
|
|
84
84
|
type_field = f"{global_field}_type"
|
|
85
|
-
|
|
86
85
|
# If the ``file_field`` contains a value, the initialization type will be changed to
|
|
87
86
|
# the ``default_type``, if supplied.
|
|
88
87
|
if dct[file_field]:
|
|
@@ -145,56 +144,53 @@ class SQLite:
|
|
|
145
144
|
"""
|
|
146
145
|
|
|
147
146
|
with self.get_session() as session:
|
|
148
|
-
|
|
149
|
-
if
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
)
|
|
147
|
+
model_settings = session.query(models.ModelSettings).order_by("id").first()
|
|
148
|
+
if (
|
|
149
|
+
model_settings.use_groundwater_flow
|
|
150
|
+
or model_settings.use_groundwater_storage
|
|
151
|
+
):
|
|
152
|
+
groundwater = _object_as_dict(session.query(models.GroundWater).one())
|
|
155
153
|
else:
|
|
156
154
|
groundwater = {}
|
|
157
|
-
if
|
|
158
|
-
interflow = _object_as_dict(
|
|
159
|
-
session.query(models.Interflow)
|
|
160
|
-
.filter_by(id=global_.interflow_settings_id)
|
|
161
|
-
.one()
|
|
162
|
-
)
|
|
155
|
+
if model_settings.use_interflow:
|
|
156
|
+
interflow = _object_as_dict(session.query(models.Interflow).one())
|
|
163
157
|
else:
|
|
164
158
|
interflow = {}
|
|
165
|
-
if
|
|
159
|
+
if model_settings.use_simple_infiltration:
|
|
166
160
|
infiltration = _object_as_dict(
|
|
167
|
-
session.query(models.SimpleInfiltration)
|
|
168
|
-
.filter_by(id=global_.simple_infiltration_settings_id)
|
|
169
|
-
.one()
|
|
161
|
+
session.query(models.SimpleInfiltration).one()
|
|
170
162
|
)
|
|
171
163
|
# older sqlites have no max_infiltration_capacity field
|
|
172
|
-
infiltration.setdefault("
|
|
164
|
+
infiltration.setdefault("max_infiltration_volume", None)
|
|
173
165
|
else:
|
|
174
166
|
infiltration = {}
|
|
175
|
-
if
|
|
167
|
+
if model_settings.use_vegetation_drag_2d:
|
|
176
168
|
vegetation_drag = _object_as_dict(
|
|
177
|
-
session.query(models.VegetationDrag)
|
|
178
|
-
.filter_by(id=global_.vegetation_drag_settings_id)
|
|
179
|
-
.one(),
|
|
169
|
+
session.query(models.VegetationDrag).one()
|
|
180
170
|
)
|
|
181
171
|
else:
|
|
182
172
|
vegetation_drag = {}
|
|
183
|
-
|
|
173
|
+
if model_settings.use_interception:
|
|
174
|
+
interception = _object_as_dict(session.query(models.Interception).one())
|
|
175
|
+
else:
|
|
176
|
+
interception = {}
|
|
177
|
+
model_settings = _object_as_dict(model_settings)
|
|
184
178
|
|
|
185
179
|
# record if there is a DEM file to be expected
|
|
186
180
|
# Note: use_2d_flow only determines whether there are flow lines
|
|
187
|
-
|
|
181
|
+
model_settings["use_2d"] = bool(model_settings["dem_file"])
|
|
188
182
|
|
|
189
183
|
# set/adapt initialization types to include information about file presence
|
|
190
184
|
NO_AGG = InitializationType.NO_AGG
|
|
191
185
|
AVERAGE = InitializationType.AVERAGE
|
|
192
186
|
_set_initialization_type(
|
|
193
|
-
|
|
187
|
+
model_settings,
|
|
188
|
+
"friction_coefficient",
|
|
189
|
+
default=AVERAGE if model_settings["friction_averaging"] else NO_AGG,
|
|
194
190
|
)
|
|
195
191
|
_set_initialization_type(
|
|
196
|
-
|
|
197
|
-
"
|
|
192
|
+
interception,
|
|
193
|
+
"interception",
|
|
198
194
|
file_field="interception_file",
|
|
199
195
|
type_field="interception_type",
|
|
200
196
|
default=NO_AGG,
|
|
@@ -207,17 +203,37 @@ class SQLite:
|
|
|
207
203
|
if infiltration:
|
|
208
204
|
_set_initialization_type(infiltration, "infiltration_rate", default=NO_AGG)
|
|
209
205
|
_set_initialization_type(
|
|
210
|
-
infiltration, "
|
|
206
|
+
infiltration, "max_infiltration_volume", default=NO_AGG
|
|
211
207
|
)
|
|
212
|
-
|
|
213
208
|
if groundwater:
|
|
214
209
|
# default is what the user supplied (MIN/MAX/AVERAGE)
|
|
215
|
-
|
|
216
|
-
_set_initialization_type(
|
|
210
|
+
|
|
211
|
+
_set_initialization_type(
|
|
212
|
+
groundwater,
|
|
213
|
+
"groundwater_impervious_layer_level",
|
|
214
|
+
type_field="groundwater_impervious_layer_level_aggregation",
|
|
215
|
+
)
|
|
216
|
+
_set_initialization_type(
|
|
217
|
+
groundwater,
|
|
218
|
+
"phreatic_storage_capacity",
|
|
219
|
+
type_field="phreatic_storage_capacity_aggregation",
|
|
220
|
+
)
|
|
217
221
|
_set_initialization_type(groundwater, "equilibrium_infiltration_rate")
|
|
218
|
-
_set_initialization_type(
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
_set_initialization_type(
|
|
223
|
+
groundwater,
|
|
224
|
+
"initial_infiltration_rate",
|
|
225
|
+
type_field="initial_infiltration_rate_aggregation",
|
|
226
|
+
)
|
|
227
|
+
_set_initialization_type(
|
|
228
|
+
groundwater,
|
|
229
|
+
"infiltration_decay_period",
|
|
230
|
+
type_field="infiltration_decay_period_aggregation",
|
|
231
|
+
)
|
|
232
|
+
_set_initialization_type(
|
|
233
|
+
groundwater,
|
|
234
|
+
"groundwater_hydraulic_conductivity",
|
|
235
|
+
type_field="groundwater_hydraulic_conductivity_aggregation",
|
|
236
|
+
)
|
|
221
237
|
|
|
222
238
|
if vegetation_drag:
|
|
223
239
|
_set_initialization_type(
|
|
@@ -232,14 +248,27 @@ class SQLite:
|
|
|
232
248
|
_set_initialization_type(
|
|
233
249
|
vegetation_drag, "vegetation_drag_coefficient", default=NO_AGG
|
|
234
250
|
)
|
|
251
|
+
# Copy Simulation Template Settings to model_settings dict
|
|
252
|
+
template_settings = _object_as_dict(
|
|
253
|
+
session.query(models.SimulationTemplateSettings).order_by("id").first()
|
|
254
|
+
)
|
|
255
|
+
model_settings["name"] = template_settings["name"]
|
|
256
|
+
model_settings["use_0d_inflow"] = template_settings["use_0d_inflow"]
|
|
235
257
|
|
|
236
|
-
grid_settings = GridSettings.from_dict(
|
|
258
|
+
grid_settings = GridSettings.from_dict(model_settings)
|
|
237
259
|
tables_settings = TablesSettings.from_dict(
|
|
238
|
-
{
|
|
260
|
+
{
|
|
261
|
+
**groundwater,
|
|
262
|
+
**interflow,
|
|
263
|
+
**infiltration,
|
|
264
|
+
**vegetation_drag,
|
|
265
|
+
**model_settings,
|
|
266
|
+
**interception,
|
|
267
|
+
}
|
|
239
268
|
)
|
|
240
269
|
return {
|
|
241
|
-
"epsg_code":
|
|
242
|
-
"model_name":
|
|
270
|
+
"epsg_code": model_settings["epsg_code"],
|
|
271
|
+
"model_name": model_settings["name"],
|
|
243
272
|
"grid_settings": grid_settings,
|
|
244
273
|
"tables_settings": tables_settings,
|
|
245
274
|
}
|
|
@@ -37,7 +37,7 @@ def test_init(tmp_path):
|
|
|
37
37
|
with mock.patch(
|
|
38
38
|
"threedigrid_builder.interface.db.ThreediDatabase"
|
|
39
39
|
) as db, mock.patch.object(SQLite, "get_version") as get_version:
|
|
40
|
-
get_version.return_value =
|
|
40
|
+
get_version.return_value = 222
|
|
41
41
|
sqlite = SQLite(path)
|
|
42
42
|
|
|
43
43
|
db.assert_called_with(path)
|
|
@@ -65,7 +65,7 @@ def test_init_bad_version(tmp_path):
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
def test_get_version(db):
|
|
68
|
-
assert db.get_version() ==
|
|
68
|
+
assert db.get_version() == 222
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
def test_get_boundary_conditions_1d(db):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: threedigrid-builder
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.14.1.dev0
|
|
4
4
|
Summary: Generate a 3Di simulation grid from a model schematisation.
|
|
5
5
|
Home-page: https://docs.3di.lizard.net/
|
|
6
6
|
Author: Martijn Siemerink
|
|
@@ -19,7 +19,7 @@ Classifier: License :: Other/Proprietary License
|
|
|
19
19
|
Requires-Python: >=3.8
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: numpy>=1.15
|
|
22
|
-
Requires-Dist: threedi-schema==0.
|
|
22
|
+
Requires-Dist: threedi-schema==0.222.dev0
|
|
23
23
|
Requires-Dist: shapely>=2
|
|
24
24
|
Requires-Dist: pyproj>=3
|
|
25
25
|
Requires-Dist: condenser[geo]>=0.1.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/array_utils.f90
RENAMED
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/cells.f90
RENAMED
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/geo_utils.f90
RENAMED
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/parameters.f90
RENAMED
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/libthreedigrid/quadtree.f90
RENAMED
|
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
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/cli.py
RENAMED
|
File without changes
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/constants.py
RENAMED
|
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
|
{threedigrid-builder-1.13.2.dev2 → threedigrid-builder-1.14.1.dev0}/threedigrid_builder/grid/grid.py
RENAMED
|
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
|
|
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
|