src.dynamic_boundary_conditions.river.main_river
Main river script used to read and store REC data in the database, fetch OSM waterways data, create a river network and its associated data, and generate the requested river model input for BG-Flood etc.
Attributes
Functions
|
Retrieves the Hydrologically Conditioned DEM (Hydro DEM) data, along with its spatial extent and resolution, |
|
Get the boundary lines of the Hydrologically Conditioned DEM. |
|
Remove existing river input files from the specified directory. |
|
Read and store REC data in the database, fetch OSM waterways data, create a river network and its associated data, |
Module Contents
- src.dynamic_boundary_conditions.river.main_river.log
- src.dynamic_boundary_conditions.river.main_river.retrieve_hydro_dem_info(engine: sqlalchemy.engine.Engine, catchment_area: geopandas.GeoDataFrame) Tuple[xarray.Dataset, shapely.geometry.LineString, int | float]
Retrieves the Hydrologically Conditioned DEM (Hydro DEM) data, along with its spatial extent and resolution, for the specified catchment area.
- Parameters:
engine (Engine) – The engine used to connect to the database.
catchment_area (gpd.GeoDataFrame) – A GeoDataFrame representing the catchment area.
- Returns:
A tuple containing the Hydro DEM data as a xarray Dataset, the spatial extent of the Hydro DEM as a LineString, and the resolution of the Hydro DEM as either an integer or a float.
- Return type:
Tuple[xr.Dataset, LineString, Union[int, float]]
- src.dynamic_boundary_conditions.river.main_river.get_hydro_dem_boundary_lines(engine: sqlalchemy.engine.Engine, catchment_area: geopandas.GeoDataFrame) geopandas.GeoDataFrame
Get the boundary lines of the Hydrologically Conditioned DEM.
- Parameters:
engine (Engine) – The engine used to connect to the database.
catchment_area (gpd.GeoDataFrame) – A GeoDataFrame representing the catchment area.
- Returns:
A GeoDataFrame containing the boundary lines of the Hydrologically Conditioned DEM.
- Return type:
gpd.GeoDataFrame
- src.dynamic_boundary_conditions.river.main_river.remove_existing_river_inputs(bg_flood_dir: pathlib.Path) None
Remove existing river input files from the specified directory.
- Parameters:
bg_flood_dir (pathlib.Path) – The BG-Flood model directory containing the river input files.
- Returns:
This function does not return any value.
- Return type:
None
- src.dynamic_boundary_conditions.river.main_river.main(selected_polygon_gdf: geopandas.GeoDataFrame, flow_length_mins: int, time_to_peak_mins: int | float, maf: bool = True, ari: int | None = None, bound: src.dynamic_boundary_conditions.river.river_enum.BoundType = BoundType.MIDDLE, log_level: src.digitaltwin.utils.LogLevel = LogLevel.DEBUG) None
Read and store REC data in the database, fetch OSM waterways data, create a river network and its associated data, and generate the requested river model input for BG-Flood.
- Parameters:
selected_polygon_gdf (gpd.GeoDataFrame) – A GeoDataFrame representing the selected polygon, i.e., the catchment area.
flow_length_mins (int) – Duration of the river flow in minutes.
time_to_peak_mins (Union[int, float]) – The time in minutes when flow is at its greatest (reaches maximum).
maf (bool = True) – Set to True to obtain MAF-based scenario data or False to obtain ARI-based scenario data.
ari (Optional[int] = None) – The Average Recurrence Interval (ARI) value. Valid options are 5, 10, 20, 50, 100, or 1000. Mandatory when ‘maf’ is set to False, and should be set to None when ‘maf’ is set to True.
bound (BoundType = BoundType.MIDDLE) – Set the type of bound (estimate) for the REC river inflow scenario data. Valid options include: ‘BoundType.LOWER’, ‘BoundType.MIDDLE’, or ‘BoundType.UPPER’.
log_level (LogLevel = LogLevel.DEBUG) – The log level to set for the root logger. Defaults to LogLevel.DEBUG. The available logging levels and their corresponding numeric values are: - LogLevel.CRITICAL (50) - LogLevel.ERROR (40) - LogLevel.WARNING (30) - LogLevel.INFO (20) - LogLevel.DEBUG (10) - LogLevel.NOTSET (0)
- Returns:
This function does not return any value.
- Return type:
None
- src.dynamic_boundary_conditions.river.main_river.sample_polygon