A Python pipeline for analyzing remote sensing data using Google Earth Engine, focusing on vegetation and moisture indices.
- Satellite Data Extraction: Seamless integration with Google Earth Engine for acquiring Sentinel data
- Vegetation Indices: Implementation of multiple vegetation indices (EVI, LAI)
- Moisture Analysis: Calculation of Moisture Stress Index (MSI) for water stress assessment
- Statistical Analysis: Distribution analysis and comparison between different indices
- Modular CLI: Command-line interface for running separate pipeline steps
- Resource Optimization: Run specific pipeline stages independently to save computational resources
- Geospatial Processing: GeoTIFF output with proper coordinate systems and metadata
- Visualization: Generate plots and maps for data interpretation
Remote Sensing Analysis provides tools for analyzing satellite imagery to derive vegetation and moisture indices. The primary objectives are to:
- Extract and process Sentinel satellite data using Google Earth Engine
- Calculate vegetation indices (EVI, LAI) and moisture stress index (MSI)
- Generate statistical analysis of these indices for environmental assessment
- Provide both a command-line interface and notebooks for interactive analysis
The pipeline works with the following data sources:
- Used for calculating vegetation and moisture indices
- Accessed through Google Earth Engine
- 10-20m resolution (depending on bands)
- Can be integrated for comparison with pre-calculated indices
- Available through their respective APIs
- Python 3.12+
- UV package manager (recommended) or pip
# Clone the repository
git clone https://github.com/yourusername/remote-sensing-analysis.git
cd remote-sensing-analysis
# Set up environment
uv venv
# Activate the environment Mac/Linux
source .venv/bin/activate
# Activate the environment Windows
.venv\Scripts\activate
# Install dependencies
uv sync
# Set up Earth Engine authentication
earthengine authenticate
The remote sensing analysis pipeline supports modular execution, allowing you to run specific parts of the pipeline independently.
The project includes Jupyter notebooks for interactive analysis and visualization:
# Start JupyterLab
uv run jupyter lab
This will open JupyterLab in your browser, where you can access:
notebooks/lai_finland.ipynb
: Example notebook for analyzing LAI and MSI for Finland- Create new notebooks to explore other regions or indices
# Show help and available commands
python scripts/run_pipeline.py --help
# Run the full pipeline
python scripts/run_pipeline.py full --config config/pipeline.yaml
# Only extract and process data (skip statistics)
python scripts/run_pipeline.py extract --area finland --start-date 2024-04-01
# Generate statistics from existing GeoTIFF files
python scripts/run_pipeline.py statistics --input-dir data/output --output-dir data/output/statistics
All commands support the following options:
--config
,-c
: Path to the configuration file (default:config/pipeline.yaml
)--log-level
,-l
: Log level (DEBUG, INFO, WARNING, ERROR)
python scripts/run_pipeline.py full [OPTIONS]
Options:
--area
,-a
: Area of interest (overrides config)--start-date
,-s
: Start date (YYYY-MM-DD, overrides config)
python scripts/run_pipeline.py extract [OPTIONS]
Options:
--area
,-a
: Area of interest (overrides config)--start-date
,-s
: Start date (YYYY-MM-DD, overrides config)
python scripts/run_pipeline.py statistics [OPTIONS]
Options:
--input-dir
,-i
: Directory containing GeoTIFF files--output-dir
,-o
: Directory to save statistics--pattern
,-p
: Glob pattern to match GeoTIFF files (default:*.tif
)
The pipeline is configured through a YAML file. Example configuration:
# Area of interest
area: "finland"
# Time range for data extraction
start_date: "2024-04-01"
end_date: "2024-04-30"
# Metrics to calculate
metrics:
- "EVI"
- "LAI"
- "MSI"
# Output settings
output:
directory: "data/output"
prefix: "rs_metrics_"
# Statistics settings
statistics:
enabled: true
output_directory: "data/output/statistics"
The project includes comprehensive unit tests for all modules. Run tests using pytest:
# Run all tests
uv run pytest
# Run tests with verbose output
uv run pytest -v
# Run tests for a specific module
uv run pytest tests/processors/
# Run a specific test file
uv run pytest tests/processors/test_preprocessing.py
You can check test coverage using pytest-cov:
# Run tests with coverage report
uv run pytest --cov=src
# Generate HTML coverage report
uv run pytest --cov=src --cov-report=html
# View coverage for specific modules
uv run pytest --cov=src.processors --cov=src.statistics
After generating the HTML report, open htmlcov/index.html
in your browser to view detailed coverage information.
The pipeline generates the following outputs:
-
GeoTIFF Files: Raster files for each calculated index
- Example:
data/output/rs_metrics_finland_20240401_EVI.tif
- Example:
-
Statistical Analysis: CSV files with summary statistics and distribution plots
- Example:
data/output/statistics/rs_metrics_finland_20240401_EVI_statistics.csv
- Example:
-
Comparison Plots: Visualizations comparing different indices
- Example:
data/output/statistics/index_comparison.png
- Example:
- Improved vegetation index with soil and atmospheric corrections
- Formula:
EVI = 2.5 * ((NIR - RED) / (NIR + 6 * RED - 7.5 * BLUE + 1))
- Quantifies leaf material in an ecosystem
- Formula:
LAI = 3.618 * EVI - 0.118
- Assessment of water stress in vegetation
- Formula:
MSI = SWIR / NIR
For information on contributing to this project, please see CONTRIBUTING.md.
This project is licensed under the Apache License Version 2.0.
Thanks goes to these wonderful people (emoji key):
Brylie Christopher Oxley π» π π€ |
This project follows the all-contributors specification. Contributions of any kind are welcome!
We are committed to fostering an open and welcoming environment. By participating in this project, you agree to abide by our Code of Conduct.
- Issues: Please use GitHub Issues for bug reports, feature requests, and discussions.
- Discussions: For questions and general discussions, use GitHub Discussions.
We welcome contributions from developers of all skill levels. If you're new to the project or to remote sensing in general, look for issues labeled good first issue
to get started.