floodresilience.flood_model.process_hydro_dem

This script fetches LiDAR terrain data for a region of interest and creates a hydrologically-conditioned DEM. It provides functions to retrieve information about the hydrologically-conditioned DEM and extract its boundary lines.

Attributes

log

Functions

retrieve_hydro_dem_info(→ Tuple[xarray.Dataset, ...)

Retrieve the Hydrologically Conditioned DEM (Hydro DEM) data, along with its spatial extent and resolution,

get_hydro_dem_boundary_lines(→ geopandas.GeoDataFrame)

Get the boundary lines of the Hydrologically Conditioned DEM.

ensure_lidar_datasets_initialised(→ None)

Check if LiDAR datasets table is initialised.

process_dem(→ None)

Ensure hydrologically-conditioned DEM is processed for the given area and added to the database.

refresh_lidar_datasets(→ None)

Web-scrapes OpenTopography metadata to create the datasets table containing links to LiDAR data sources.

main(→ None)

Retrieve LiDAR data for the selected polygon and processes it into a hydrologically-conditioned DEM.

Module Contents

floodresilience.flood_model.process_hydro_dem.log
floodresilience.flood_model.process_hydro_dem.retrieve_hydro_dem_info(engine: sqlalchemy.engine.Engine, catchment_area: geopandas.GeoDataFrame) Tuple[xarray.Dataset, shapely.LineString, int | float]

Retrieve 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]]

floodresilience.flood_model.process_hydro_dem.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

floodresilience.flood_model.process_hydro_dem.ensure_lidar_datasets_initialised() None

Check if LiDAR datasets table is initialised. This table holds URLs to data sources for LiDAR. If it is not initialised, then it initialises it by web-scraping OpenTopography which takes a long time.

floodresilience.flood_model.process_hydro_dem.process_dem(selected_polygon_gdf: geopandas.GeoDataFrame) None

Ensure hydrologically-conditioned DEM is processed for the given area and added to the database.

Parameters:

selected_polygon_gdf (gpd.GeoDataFrame) – The polygon defining the selected area to process the DEM for.

floodresilience.flood_model.process_hydro_dem.refresh_lidar_datasets() None

Web-scrapes OpenTopography metadata to create the datasets table containing links to LiDAR data sources. Takes a long time to run but needs to be run periodically so that the datasets are up to date.

floodresilience.flood_model.process_hydro_dem.main(selected_polygon_gdf: geopandas.GeoDataFrame, log_level: src.digitaltwin.utils.LogLevel = LogLevel.DEBUG) None

Retrieve LiDAR data for the selected polygon and processes it into a hydrologically-conditioned DEM.

Parameters:
  • selected_polygon_gdf (gpd.GeoDataFrame) – A GeoDataFrame representing the selected polygon, i.e., the catchment area.

  • 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)