Skip to content

Commit

Permalink
Finish manhole_freeboard and manhole_max_water level presets
Browse files Browse the repository at this point in the history
  • Loading branch information
leendertvanwolfswinkel committed Feb 20, 2024
1 parent ead911c commit 05ec26c
Show file tree
Hide file tree
Showing 4 changed files with 217 additions and 85 deletions.
80 changes: 67 additions & 13 deletions tool_statistics/presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
STYLE_TIMESTEP_REDUCTION_ANALYSIS,
STYLE_BALANCE,
STYLE_WATER_ON_STREET_DURATION_NODE,
STYLE_MANHOLE_WATER_DEPTH_NODE,
STYLE_MANHOLE_MIN_FREEBOARD,
STYLE_MANHOLE_WATER_DEPTH_0D1D_NODE,
STYLE_MANHOLE_WATER_DEPTH_1D2D_NODE,
STYLE_MANHOLE_MIN_FREEBOARD_0D1D,
STYLE_MANHOLE_MIN_FREEBOARD_1D2D,
)


Expand Down Expand Up @@ -312,11 +314,35 @@ def aggregations(self):
),
]

MAX_DEPTH_ON_STREET_PRESETS = Preset(
name="Manhole: Max water depth on street",
description="Maximum water depth on manholes, calculated as maximum water level - drain level",
MAX_DEPTH_ON_STREET_0D1D_PRESETS = Preset(
name="Manhole: Max water depth on street (0D1D)",
description="Maximum water depth on manholes, calculated as maximum water level - drain level\n\n"
"In 3Di models without 2D, this is the level at which water flows onto the street (i.e., where the "
"storage area changes from what is specified at the connection node to what is specified as manhole "
"storage area in the global settings).\n\n"
"⚠ Do not use this preset for 3Di models with 2D. In such models, the drain level defined at the "
"manhole is not always the level at which water flows onto the street. If the drain level is lower "
"than the bottom level (lowest pixel) of the 2D cell the manhole is in, the water must rise to the "
"2D cell's bottom level before it can flow onto the street.",
aggregations=max_depth_on_street_aggregations,
nodes_style=STYLE_MANHOLE_WATER_DEPTH_0D1D_NODE,
nodes_style_param_values={"value": "s1_max"},
nodes_layer_name="Manhole: Max water depth on street",
only_manholes=True
)

MAX_DEPTH_ON_STREET_1D2D_PRESETS = Preset(
name="Manhole: Max water depth on street (0D1D)",
description="Maximum water depth on manholes, calculated as maximum water level - 1D2D exchange level. \n\n"
"In 3Di models with 2D, this is the level at which water flows onto the street. The exchange level is "
"the maximum of two values: the drain level specified for the manhole, or the bottom level (lowest "
"pixel) of the 2D cell the manhole is in.\n\n"
"⚠ Manholes that have no connection to the 2D domain do not have an exchange level. The 'water depth "
"on street' is NULL for these manholes.\n\n"
"⚠ Do not use this preset for 3Di models without 2D. In such models, none of the manholes have a "
"connection to the 2D domain, so the 'water depth on street' will be NULL for all manholes.",
aggregations=max_depth_on_street_aggregations,
nodes_style=STYLE_MANHOLE_WATER_DEPTH_NODE,
nodes_style=STYLE_MANHOLE_WATER_DEPTH_1D2D_NODE,
nodes_style_param_values={"value": "s1_max"},
nodes_layer_name="Manhole: Max water depth on street",
only_manholes=True
Expand All @@ -331,13 +357,39 @@ def aggregations(self):
),
]

MIN_FREEBOARD_PRESETS = Preset(
name="Manhole: Minimum freeboard",
description="Minimum freeboard for manholes, i.e. how far below the drain level the maximum water level is",
MIN_FREEBOARD_0D1D_PRESETS = Preset(
name="Manhole: Minimum freeboard (0D1D)",
description="Minimum freeboard for manholes, "
"i.e. the difference between the maximum water level and the manhole drain level.\n\n"
"In 3Di models without 2D, this is the level at which water flows onto the street (i.e., where the "
"storage area changes from what is specified at the connection node to what is specified as manhole "
"storage area in the global settings).\n\n"
"⚠ Do not use this preset for 3Di models with 2D. In such models, the drain level defined at the "
"manhole is not always the level at which water flows onto the street. If the drain level is lower "
"than the bottom level (lowest pixel) of the 2D cell the manhole is in, the water must rise to the "
"2D cell's bottom level before it can flow onto the street.",
aggregations=max_depth_on_street_aggregations,
nodes_style=STYLE_MANHOLE_MIN_FREEBOARD_0D1D,
nodes_style_param_values={"value": "s1_max"},
nodes_layer_name="Manhole: Minimum freeboard (0D1D)",
only_manholes=True
)

MIN_FREEBOARD_1D2D_PRESETS = Preset(
name="Manhole: Minimum freeboard (1D2D)",
description="Minimum freeboard for manholes, "
"i.e. the difference between the maximum water level and the 1D2D exchange level.\n\n"
"In 3Di models with 2D, this is the level at which water flows onto the street. The exchange level is "
"the maximum of two values: the drain level specified for the manhole, or the bottom level (lowest "
"pixel) of the 2D cell the manhole is in.\n\n"
"⚠ Manholes that have no connection to the 2D domain do not have an exchange level. The 'minimum "
"freeboard' is always NULL for these manholes.\n\n"
"⚠ Do not use this preset for 3Di models without 2D. In such models, none of the manholes have a "
"connection to the 2D domain, so the 'minimum freeboard' will be NULL for all manholes.",
aggregations=max_depth_on_street_aggregations,
nodes_style=STYLE_MANHOLE_MIN_FREEBOARD,
nodes_style=STYLE_MANHOLE_MIN_FREEBOARD_1D2D,
nodes_style_param_values={"value": "s1_max"},
nodes_layer_name="Manhole: Minimum freeboard",
nodes_layer_name="Manhole: Minimum freeboard (1D2D)",
only_manholes=True
)

Expand All @@ -349,8 +401,10 @@ def aggregations(self):
SOURCE_SINK_MM_PRESETS,
FLOW_PATTERN_PRESETS,
TS_REDUCTION_ANALYSIS_PRESETS,
MAX_DEPTH_ON_STREET_PRESETS,
MIN_FREEBOARD_PRESETS,
MAX_DEPTH_ON_STREET_0D1D_PRESETS,
MAX_DEPTH_ON_STREET_1D2D_PRESETS,
MIN_FREEBOARD_0D1D_PRESETS,
MIN_FREEBOARD_1D2D_PRESETS,
WATER_ON_STREET_DURATION_0D1D_PRESET,
WATER_ON_STREET_DURATION_1D2D_PRESET,
]
44 changes: 35 additions & 9 deletions tool_statistics/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,11 @@ def style_ts_reduction_analysis(
),
)


STYLE_MANHOLE_WATER_DEPTH_NODE = Style(
name="Manhole water depth",
STYLE_MANHOLE_WATER_DEPTH_0D1D_NODE = Style(
name="Manhole water depth (0D1D)",
output_type="node",
params={"value": "column"},
qml="manhole_water_depth.qml",
# TODO: make "reference" user definable
styling_method=lambda layer, qml, value, reference="drain_level", update_classes=False: style_difference(
layer,
qml,
Expand All @@ -328,13 +326,25 @@ def style_ts_reduction_analysis(
),
)

STYLE_MANHOLE_WATER_DEPTH_1D2D_NODE = Style(
name="Manhole water depth (1D2D)",
output_type="node",
params={"value": "column"},
qml="manhole_water_depth.qml",
styling_method=lambda layer, qml, value, reference="exchange_level_1d2d", update_classes=False: style_difference(
layer,
qml,
value,
reference,
update_classes
),
)

STYLE_MANHOLE_MIN_FREEBOARD = Style(
name="Manhole freeboard",
STYLE_MANHOLE_MIN_FREEBOARD_0D1D = Style(
name="Manhole freeboard (0D1D)",
output_type="node",
params={"value": "column"},
qml="manhole_freeboard.qml",
# TODO: make "reference" user definable
styling_method=lambda layer, qml, value, reference="drain_level", update_classes=False: style_difference(
layer,
qml,
Expand All @@ -344,6 +354,20 @@ def style_ts_reduction_analysis(
),
)

STYLE_MANHOLE_MIN_FREEBOARD_1D2D = Style(
name="Manhole freeboard (1D2D)",
output_type="node",
params={"value": "column"},
qml="manhole_freeboard.qml",
styling_method=lambda layer, qml, value, reference="exchange_level_1d2d", update_classes=False: style_difference(
layer,
qml,
value,
reference,
update_classes
),
)

STYLE_CHANGE_WL = Style(
name="Change in water level",
output_type="cell",
Expand Down Expand Up @@ -394,8 +418,10 @@ def style_ts_reduction_analysis(
STYLE_CHANGE_WL,
STYLE_BALANCE,
STYLE_WATER_ON_STREET_DURATION_NODE,
STYLE_MANHOLE_WATER_DEPTH_NODE,
STYLE_MANHOLE_MIN_FREEBOARD,
STYLE_MANHOLE_WATER_DEPTH_0D1D_NODE,
STYLE_MANHOLE_WATER_DEPTH_1D2D_NODE,
STYLE_MANHOLE_MIN_FREEBOARD_0D1D,
STYLE_MANHOLE_MIN_FREEBOARD_1D2D
]

DEFAULT_STYLES = {
Expand Down
Loading

0 comments on commit 05ec26c

Please sign in to comment.