Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions ryan-scripts/TUFLOW-python/TUFLOW_Culvert-mean-max-aep-dur.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# ryan-scripts\TUFLOW-python\TUFLOW_Culvert-mean-max-aep-dur.py

from pathlib import Path
import os

from ryan_library.scripts.tuflow.tuflow_culverts_mean import run_culvert_mean_report
from ryan_library.scripts.wrapper_utils import change_working_directory, print_library_version

# Toggle the specific culvert data types to collect. Leave empty to accept the library defaults.
INCLUDED_DATA_TYPES: tuple[str, ...] = ("Nmx", "Cmx", "Chan", "ccA", "RLL_Qmx")

# Toggle the export of the raw culvert-maximums sheet (may be extremely large).
EXPORT_RAW_MAXIMUMS: bool = True


def main() -> None:
"""Wrapper script to create culvert mean peak reports."""

print_library_version()
console_log_level = "INFO" # or "DEBUG"
script_directory: Path = Path(__file__).absolute().parent

if not change_working_directory(target_dir=script_directory):
return

include_data_types: tuple[str, ...] | None = INCLUDED_DATA_TYPES or None

run_culvert_mean_report(
script_directory=script_directory,
log_level=console_log_level,
include_data_types=include_data_types,
export_raw=EXPORT_RAW_MAXIMUMS,
)

print()
print_library_version()


if __name__ == "__main__":
main()
os.system("PAUSE")
88 changes: 88 additions & 0 deletions ryan_library/classes/column_definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,26 @@ def default(cls) -> "ColumnMetadataRegistry":
description=("Temporal pattern taken from the same nearest-to-mean event used for mean_PeakFlow."),
value_type="string",
),
"mean_Q": ColumnDefinition(
name="mean_Q",
description="Arithmetic mean discharge for the grouped culvert results.",
value_type="float",
),
"mean_V": ColumnDefinition(
name="mean_V",
description="Arithmetic mean velocity for the grouped culvert results.",
value_type="float",
),
"mean_DS_h": ColumnDefinition(
name="mean_DS_h",
description="Arithmetic mean downstream water level for the grouped culvert results.",
value_type="float",
),
"mean_US_h": ColumnDefinition(
name="mean_US_h",
description="Arithmetic mean upstream water level for the grouped culvert results.",
value_type="float",
),
"low": ColumnDefinition(
name="low",
description="Minimum statistic encountered across all temporal patterns in the group.",
Expand All @@ -438,6 +458,11 @@ def default(cls) -> "ColumnMetadataRegistry":
description="Deprecated. Don't use. Indicates whether the mean storm matches the median storm selection.",
value_type="boolean",
),
"mean_bin": ColumnDefinition(
name="mean_bin",
description="Number of events contributing non-null mean metrics within the group.",
value_type="int",
),
"aep_dur_bin": ColumnDefinition(
name="aep_dur_bin",
description="Count of records in the original AEP/Duration/Location/Type/run combination.",
Expand All @@ -448,6 +473,69 @@ def default(cls) -> "ColumnMetadataRegistry":
description="Count of records in the original AEP/Location/Type/run combination.",
value_type="int",
),
"min_Q": ColumnDefinition(
name="min_Q",
description="Minimum discharge observed across the grouped culvert events.",
value_type="float",
),
"min_V": ColumnDefinition(
name="min_V",
description="Minimum velocity observed across the grouped culvert events.",
value_type="float",
),
"min_DS_h": ColumnDefinition(
name="min_DS_h",
description="Minimum downstream water level observed across the grouped culvert events.",
value_type="float",
),
"min_US_h": ColumnDefinition(
name="min_US_h",
description="Minimum upstream water level observed across the grouped culvert events.",
value_type="float",
),
"max_Q": ColumnDefinition(
name="max_Q",
description="Maximum discharge observed across the grouped culvert events.",
value_type="float",
),
"max_V": ColumnDefinition(
name="max_V",
description="Maximum velocity observed across the grouped culvert events.",
value_type="float",
),
"max_DS_h": ColumnDefinition(
name="max_DS_h",
description="Maximum downstream water level observed across the grouped culvert events.",
value_type="float",
),
"max_US_h": ColumnDefinition(
name="max_US_h",
description="Maximum upstream water level observed across the grouped culvert events.",
value_type="float",
),
"adopted_Q": ColumnDefinition(
name="adopted_Q",
description=(
"Discharge from the event whose Q value is closest to the sample mean for the group; used as the adopted"
" representative flow."
),
value_type="float",
),
"adopted_V": ColumnDefinition(
name="adopted_V",
description="Velocity from the adopted event associated with the adopted_Q selection.",
value_type="float",
),
"adopted_DS_h": ColumnDefinition(
name="adopted_DS_h",
description="Downstream water level from the adopted event associated with the adopted_Q selection.",
value_type="float",
),
"adopted_US_h": ColumnDefinition(
name="adopted_US_h",
description="Upstream water level from the adopted event associated with the adopted_Q selection.",
value_type="float",
),
}

sheet_specific: dict[str, dict[str, ColumnDefinition]] = {
Expand Down
Loading