Skip to content

thapawan/DeepMeander

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Integrated Flood Risk Assessment and Automated Meander Classification in the Southeastern United States (FloodMMAT)


Your Logo This repository provides an R package and source code for integrated flood risk assessment, incorporating automated meander classification using deep learning and hydraulic modeling, specifically tailored for the Southeastern United States. It is developed by [Pawan Thapa/University of Alabama], [Department of Geography and the Environment], United States.

Background

Accurate flood risk assessment in complex fluvial environments like the Southeastern United States requires integrated approaches that capture the interplay between meander morphology and hydrological processes. Traditional methods often lack the automation and precision needed to effectively analyze these dynamic systems.

To address these challenges, we developed the FloodMMAT R package. This package combines deep learning-based automated meander classification with hydraulic modeling to enhance flood risk analysis. It leverages geometric properties and integrates various geospatial datasets to provide a comprehensive assessment framework.

Repository Structure

The architecture of FloodMMAT integrates key functions for deep learning-based meander classification, hydraulic modeling, and flood risk assessment. All function codes are in the R folder.

FloodMMAT/
├── R/
│   ├── meander_classification.R
│   ├── hydraulic_modeling.R
│   ├── flood_risk_assessment.R
├── man/
│   ├── meander_classification.Rd
│   ├── hydraulic_modeling.Rd
│   ├── flood_risk_assessment.Rd
├── data/
│   ├── meander_images/  # Meander image dataset
│   ├── geospatial_data/ # SRTM DEM, JRC Water, CHIRPS, NLCD, OpenLandMap
├── inst/
│   └── doc/
│       └── FloodMMAT_usage.Rmd
├── DESCRIPTION
├── NAMESPACE
├── README.md
└── LICENSE
The workflow of the FloodMMAT package can be summarized as follows:

Meander Classification: Use meander_classification() to classify meanders based on geometric properties using deep learning models.
Hydraulic Modeling: Use hydraulic_modeling() to estimate stream flow characteristics using Manning's equation, incorporating meander classifications.
Flood Risk Assessment: Use flood_risk_assessment() to assess flood risk by integrating meander morphology, flow dynamics, and geospatial data.
Output: Obtain flood risk assessments, meander classifications, and hydraulic modeling results as spatial data frames or data frames.
Package Installation and Usage
This package can be installed directly from GitHub.

Code snippet

# Install from GitHub
if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}
remotes::install_github("yourusername/FloodMMAT")

# Load the package
library(FloodMMAT)
Note: Detailed usage instructions and examples are provided in the package documentation and vignettes (accessible with vignette("FloodMMAT_usage")).

Data Input
The package requires:

A dataset of meander images for deep learning-based classification.
Geospatial data from SRTM DEM, JRC Global Surface Water, CHIRPS rainfall, NLCD land cover, and OpenLandMap soil data.
Executing the FloodMMAT Functions
The FloodMMAT package provides functions for meander classification, hydraulic modeling, and flood risk assessment.

Code snippet

# Example usage:
meander_classifications <- meander_classification(meander_images_path, model = "ResNet152") # Example path and model choice
hydraulic_results <- hydraulic_modeling(meander_classifications, dem_path, water_surface_path) # Example paths
flood_risk_results <- flood_risk_assessment(hydraulic_results, land_cover_path, soil_data_path, rainfall_path) #Example paths
Functions in FloodMMAT
| Function Name           | Objective                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               3.  # Include the necessary libraries.
4  import os
5  import rasterio
6  from rasterio.mask import mask
7  from shapely.geometry import mapping
8  import geopandas as gpd
9  import numpy as np
10  import matplotlib.pyplot as plt
11  import contextily as ctx
12

13  # Function to extract river centerline and estimate width
14  def extract_river_data(raster_path, output_dir, spatial_resolution=10):
15      """
16      Extracts river centerline and estimates width from a raster image.
17

18      Args:
19          raster_path (str): Path to the raster image.
20          output_dir (str): Directory to save the output shapefiles.
21          spatial_resolution (int): Spatial resolution of the raster.
22

23      Returns:
24          tuple: Paths to the centerline and width shapefiles.
25      """
26      # Placeholder for centerline extraction and width estimation functions
27      # Replace with your actual functions or library calls
28      print(f"Extracting centerline and estimating width from {raster_path}")
29      centerline_gdf = gpd.GeoDataFrame()  # Replace with actual centerline GeoDataFrame
30      width_df = pd.DataFrame()  # Replace with actual width DataFrame
31

32      # Save centerline and width to shapefiles
33      centerline_path = os.path.join(output_dir, "centerline.shp")
34      width_path = os.path.join(output_dir, "width.shp")
35      centerline_gdf.to_file(centerline_path)
36      width_df.to_file(width_path)
37

38      return centerline_path, width_path
39

40  # Function to perform flood risk assessment
41  def flood_risk_assessment(centerline_path, width_path, dem_path, water_surface_path, land_cover_path, soil_data_path, rainfall_path, output_dir):
42      """
43      Performs flood risk assessment by integrating meander morphology, flow dynamics, and geospatial data.
44

45      Args:
46          centerline_path (str): Path to the centerline shapefile.
47          width_path (str): Path to the width shapefile.
48          dem_path (str): Path to the DEM raster.
49          water_surface_path (str): Path to the water surface raster.
50          land_cover_path (str): Path to the land cover raster.
51          soil_data_path (str): Path to the soil data raster.
52          rainfall_path (str): Path to the rainfall raster.
53          output_dir (str): Directory to save the flood risk assessment results.
54

55      Returns:
56          str: Path to the flood risk assessment shapefile.
57      """
58      # Placeholder for flood risk assessment function
59      # Replace with your actual flood risk assessment function or library calls
60      print("Performing flood risk assessment...")
61      flood_risk_gdf = gpd.GeoDataFrame()  # Replace with actual flood risk GeoDataFrame
62

63      # Save flood risk assessment results to shapefile
64      flood_risk_path = os.path.join(output_dir, "flood_risk.shp")
65      flood_risk_gdf.to_file(flood_risk_path)
66

67      return flood_risk_path
68

69  # Function to visualize flood risk results
70  def visualize_flood_risk(flood_risk_path):
71      """
72      Visualizes the flood risk assessment results.
73

74      Args:
75          flood_risk_path (str): Path to the flood risk assessment shapefile.
76      """
77      # Placeholder for flood risk visualization function
78      # Replace with your actual visualization function or library calls
79      print("Visualizing flood risk results...")
80      flood_risk_gdf = gpd.read_file(flood_risk_path)
81

82      fig, ax = plt.subplots(figsize=(12, 10))
83      flood_risk_gdf.plot(ax=ax, column='flood_risk', legend=True)  # Assuming 'flood_risk' column contains risk values
84      ctx.add_basemap(ax, crs=flood_risk_gdf.crs, source=ctx.providers.CartoDB.Positron)
85      plt.title("Flood Risk Assessment")
86      plt.show()
87

88  # Main script
89  if name == "main":
90      # Example usage:
91      raster_path = "/path/to/your/raster.tif"  # Replace with your raster path
92      output_dir = "/path/to/output/directory"  # Replace with your output directory
93      dem_path = "/path/to/your/dem.tif"  # Replace with your DEM path
94      water_surface_path = "/path/to/your/water_surface.tif"  # Replace with your water surface path
95      land_cover_path = "/path/to/your/land_cover.tif"  # Replace with your land cover path
96      soil_data_path = "/path/to/your/soil_data.tif"  # Replace with your soil data path
97      rainfall_path = "/path/to/your/rainfall.tif"  # Replace with your rainfall path
98

99      # Extract river data
100      centerline_path, width_path = extract_river_data(raster_path, output_dir)
101

102      # Perform flood risk assessment
103      flood_risk_path = flood_risk_assessment(centerline_path, width_path, dem_path, water_surface_path, land_cover_path, soil_data_path, rainfall_path, output_dir)
104

105      # Visualize flood risk results
106      visualize_flood_risk(flood_risk_path)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors