Skip to content

pishapis/chlorophyll-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ฐ๏ธ PlanetScope Chlorophyll Content Converter

Python Streamlit License

Automatic chlorophyll content estimation for sugarcane monitoring using PlanetScope satellite imagery. This tool converts multispectral satellite images into detailed chlorophyll maps with health status classification and area analysis.

Demo Screenshot

๐ŸŒŸ Features

Core Capabilities

  • ๐Ÿš€ Automatic Processing: Upload TIFF โ†’ Get instant chlorophyll maps
  • ๐ŸŽฏ Multi-band Support: Compatible with 4-band PlanetScope and 8-band SuperDove imagery
  • ๐ŸŒฟ Vegetation Detection: Intelligent masking to analyze only vegetated areas
  • ๐Ÿงฌ Scientific Calibration: NDVI-based chlorophyll estimation validated against GIS data
  • ๐Ÿฅ Health Classification: 5-level health status classification system
  • ๐ŸŒ Area Analysis: Automatic calculation of areas in hectares for each health category

Advanced Features

  • ๐Ÿ“Š Interactive Visualizations: Dynamic chlorophyll maps and health status overlays
  • ๐Ÿ“ˆ Statistical Analysis: Comprehensive vegetation indices and correlation plots
  • ๐Ÿ’พ Export Options: Download chlorophyll data and area reports in CSV format
  • ๐Ÿ”ฌ Quality Control: Built-in NDVI-Chlorophyll correlation validation
  • ๐ŸŽจ Multi-view Display: RGB composite, false color, and chlorophyll maps

๐Ÿ“‹ Table of Contents

๐Ÿš€ Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Step 1: Clone the Repository

git clone https://github.com/pishapis/chlorophyll-converter.git
cd chlorophyll-converter

Step 2: Create Virtual Environment (Recommended)

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On Linux/Mac:
source venv/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

โšก Quick Start

  1. Run the Application
streamlit run app.py
  1. Open Browser The app will automatically open at http://localhost:8501

  2. Upload Image

  • Click "Browse files" or drag-and-drop your PlanetScope TIFF file
  • Supported formats: .tif, .tiff
  1. Process
  • Click "๐Ÿงฎ Calculate Chlorophyll Content"
  • Wait for processing to complete
  1. View Results
  • Explore chlorophyll maps, health status, and area analysis
  • Download reports and data as needed

๐Ÿ“– Usage Guide

Supported Image Types

Satellite Bands Resolution Supported
PlanetScope 4-band Blue, Green, Red, NIR 3m โœ…
SuperDove 8-band Coastal Blue to NIR + Red Edge 3m โœ…

Input Requirements

  • Format: GeoTIFF (.tif, .tiff)
  • Bands: 4 or 8 bands
  • Projection: Any projected CRS (UTM recommended)
  • Data Type: Surface reflectance (0-1 or 0-10000)

Output Products

  1. Chlorophyll Map

    • Spatial distribution of chlorophyll content (ยตg/cmยฒ)
    • Color-coded visualization
    • Vegetation-masked output
  2. Health Status Map

    • 5-level classification (Severely Stressed to Very Healthy)
    • Color-coded categories
    • Legend with thresholds
  3. Area Analysis

    • Total image area (ha)
    • Vegetation coverage area (ha)
    • Health status area breakdown (ha)
    • Percentage distribution
  4. Statistical Reports

    • Chlorophyll statistics (mean, std, min, max)
    • NDVI-Chlorophyll correlation
    • Vegetation indices summary
    • Downloadable CSV reports

๐Ÿ”ฌ Scientific Methodology

Chlorophyll Estimation Model

The tool uses a scientifically calibrated NDVI-Chlorophyll relationship based on field validation and GIS analysis:

# NDVI Range โ†’ Chlorophyll Content (ยตg/cmยฒ)
NDVI 0.15-0.25 โ†’ 8-20 ยตg/cmยฒ   # Stressed vegetation
NDVI 0.25-0.35 โ†’ 20-35 ยตg/cmยฒ  # Moderate health
NDVI 0.35-0.45 โ†’ 35-50 ยตg/cmยฒ  # Healthy vegetation
NDVI >0.45     โ†’ 50+ ยตg/cmยฒ    # Very healthy vegetation

Vegetation Indices Used

  • NDVI (Normalized Difference Vegetation Index)
  • GNDVI (Green NDVI)
  • RVI (Ratio Vegetation Index)
  • DVI (Difference Vegetation Index)
  • NDRE (Normalized Difference Red Edge) - for 8-band imagery
  • CI Red Edge (Chlorophyll Index Red Edge)

Validation Approach

  1. GIS Cross-Validation: Results validated against QGIS raster calculations
  2. NDVI Correlation: Built-in correlation analysis (target: >0.7)
  3. Conservative Thresholds: Prevents overestimation of chlorophyll content
  4. Vegetation Masking: NDVI-based filtering (threshold: 0.15)

๐Ÿฅ Health Status Classification

Status Chlorophyll Range NDVI Range Color Interpretation
Severely Stressed 5-15 ยตg/cmยฒ 0.15-0.20 ๐Ÿ”ด Dark Red Critical condition - Immediate intervention needed
Stressed 15-25 ยตg/cmยฒ 0.20-0.28 ๐ŸŸ  Red Orange Plant stress detected - Monitor closely
Moderate 25-35 ยตg/cmยฒ 0.28-0.35 ๐ŸŸก Gold Average health - Normal conditions
Healthy 35-45 ยตg/cmยฒ 0.35-0.42 ๐ŸŸข Yellow Green Good plant health - Optimal growth
Very Healthy 45-60 ยตg/cmยฒ >0.42 ๐Ÿ’š Forest Green Excellent condition - Peak performance

๐ŸŒ Area Calculation

Methodology

  1. Pixel Size Extraction

    • Automatically extracted from GeoTIFF metadata
    • Uses rasterio transform parameters
    • Handles any projected CRS
  2. Area Conversion

    pixel_width = abs(transform[0])   # meters
    pixel_height = abs(transform[4])  # meters
    pixel_area_m2 = pixel_width ร— pixel_height
    pixel_area_ha = pixel_area_m2 / 10000
  3. Health Status Areas

    • Counts pixels for each health category
    • Multiplies by pixel area
    • Calculates percentage distribution

Output Metrics

  • Total Image Area: Complete image coverage in hectares
  • Vegetation Area: Only vegetated pixels in hectares
  • Health Status Areas: Area for each of 5 health categories
  • Coverage Percentage: Vegetation coverage ratio

๐Ÿ“ฆ Requirements

Core Dependencies

streamlit>=1.28.0
pandas>=2.0.0
numpy>=1.24.0
rasterio>=1.3.0
matplotlib>=3.7.0
seaborn>=0.12.0
scikit-learn>=1.3.0
xgboost>=2.0.0
plotly>=5.17.0

See requirements.txt for complete list.

๐Ÿ“ Project Structure

chlorophyll-converter/
โ”‚
โ”œโ”€โ”€ app.py                          # Main Streamlit application
โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ”œโ”€โ”€ README.md                       # This file
โ”œโ”€โ”€ LICENSE                         # MIT License
โ”‚
โ”œโ”€โ”€ docs/                          # Documentation
โ”‚   โ”œโ”€โ”€ screenshot.png             # Demo screenshot
โ”‚   โ”œโ”€โ”€ methodology.md             # Detailed methodology
โ”‚   โ””โ”€โ”€ user_guide.md              # User guide
โ”‚
โ”œโ”€โ”€ examples/                      # Example files
โ”‚   โ”œโ”€โ”€ sample_input.tif           # Sample PlanetScope image
โ”‚   โ””โ”€โ”€ sample_output.csv          # Sample output report
โ”‚
โ””โ”€โ”€ tests/                         # Unit tests (optional)
    โ””โ”€โ”€ test_converter.py

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/your-feature-name
  3. Commit your changes
    git commit -m "Add your feature description"
  4. Push to the branch
    git push origin feature/your-feature-name
  5. Open a Pull Request

Development Guidelines

  • Follow PEP 8 style guide
  • Add docstrings to new functions
  • Update README if adding new features
  • Test with both 4-band and 8-band imagery

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“š Citation

If you use this tool in your research, please cite:

@software{planetscope_chlorophyll_converter,
  title = {PlanetScope Chlorophyll Content Converter},
  author = {pishapis},
  year = {2024},
  url = {https://github.com/pishapis/chlorophyll-converter}
}

๐Ÿ™ Acknowledgments

  • PlanetScope/Planet Labs for satellite imagery
  • Rasterio for geospatial data handling
  • Streamlit for the web framework
  • Scientific Community for NDVI-Chlorophyll research

๐Ÿ“ง Contact

๐Ÿ”„ Updates & Changelog

Version 1.0.0 (Current)

  • โœ… Initial release
  • โœ… Support for 4-band and 8-band PlanetScope imagery
  • โœ… Automatic chlorophyll estimation
  • โœ… Health status classification
  • โœ… Area analysis in hectares
  • โœ… Interactive visualizations
  • โœ… CSV export functionality

Planned Features

  • ๐Ÿ”œ Batch processing for multiple images
  • ๐Ÿ”œ Time-series analysis
  • ๐Ÿ”œ Machine learning model integration
  • ๐Ÿ”œ Additional crop type support
  • ๐Ÿ”œ API endpoint for automation

โญ If you find this project useful, please consider giving it a star on GitHub!

Made with โค๏ธ pishapis

About

Automatic chlorophyll content estimation for sugarcane monitoring

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages