Skip to content

Devgambo/Shoreline_Analysis

Repository files navigation

Shoreline Analysis

This project analyzes shoreline changes over time using satellite images and machine learning techniques.

Overview

The application processes a time series of satellite images (1984-2022) to:

  • Apply image processing techniques (Gaussian blur, Canny edge detection)
  • Extract shoreline edge points from each year
  • Combine and clean the temporal data
  • Train multiple regression models (Linear Regression, SVR, XGBoost)
  • Generate visualizations and performance metrics

Docker Setup

Prerequisites

  • Docker and Docker Compose installed on your system
  • The satellite images should be in the SatImages/ directory

Building and Running

Option 1: Run as Python Script

# Build the Docker image
docker-compose build

# Run the analysis script
docker-compose up shoreline-analysis

# Or run with custom output location
docker-compose run --rm shoreline-analysis python main.py

Option 2: Run as Jupyter Notebook

# Start Jupyter notebook server
docker-compose --profile notebook up shoreline-notebook

# Access notebook at http://localhost:8888
# The original ShorelineCode.ipynb will be available in the workspace

Directory Structure

ShorelineAnalysis/
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
├── main.py                    # Converted Python script
├── ShorelineCode.ipynb       # Original Jupyter notebook
├── SatImages/                # Satellite images directory
│   ├── 1984.png
│   ├── 1985.png
│   └── ...
└── output/                   # Generated results (created automatically)
    ├── processed_shoreline_data.csv
    ├── model_results.csv
    ├── shoreline_scatter_all_years.png
    └── model_predictions_comparison.png

Output Files

The analysis generates several output files in the output/ directory:

  1. processed_shoreline_data.csv: Combined edge data from all years
  2. model_results.csv: Model performance metrics (MAE, MSE, R²)
  3. shoreline_scatter_all_years.png: Scatter plot of shoreline points over time
  4. model_predictions_comparison.png: Model prediction accuracy comparison

Environment

The Docker container includes all necessary dependencies:

  • Python 3.11
  • OpenCV for image processing
  • NumPy, Pandas for data manipulation
  • Scikit-learn for machine learning
  • XGBoost for gradient boosting
  • Matplotlib for visualizations
  • GDAL for geospatial processing
  • Jupyter notebook for interactive analysis

Customization

To modify the analysis parameters, edit main.py:

  • Change Canny edge detection thresholds
  • Adjust machine learning model parameters
  • Modify visualization settings
  • Add new regression models

Troubleshooting

  1. No images found: Ensure PNG files are in the SatImages/ directory
  2. Permission errors: Make sure Docker has access to the project directory
  3. Memory issues: For large datasets, consider processing images in batches

Development

To make changes and rebuild:

# Rebuild after code changes
docker-compose build --no-cache

# Run with development volume mounts
docker-compose run --rm -v $(pwd):/app/workspace shoreline-analysis python main.py

Notes

  • The container runs as root by default for simplicity
  • All output files are saved to the mounted output/ directory
  • The analysis uses forward-fill for missing temporal data points
  • Edge detection parameters may need adjustment based on image quality and resolution

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages