Skip to content

Modular pipeline for monitoring agricultural productivity using MODIS EVI and Google Earth Engine, with support for cropland masking, zonal statistics, anomaly detection, and automated export.

License

Notifications You must be signed in to change notification settings

datapartnership/crop_productivity_package

Repository files navigation

Crop Productivity Monitoring with MODIS and Google Earth Engine

This Python module provides a modular and scalable pipeline to assess agricultural productivity trends using MODIS EVI data and Google Earth Engine (GEE).


🚀 Features

  • Load and clean MODIS Terra and Aqua EVI time series
  • Apply cropland masks using DEA Crop Mask
  • Compute seasonal composites (mean EVI)
  • Derive z-scores against 10-year and 5-year baselines
  • Export geospatial rasters to Google Cloud Storage
  • Generate plots and statistical summaries
  • Compute zonal statistics by administrative regions

📁 Project Structure

crop_productivity_package/
├── crop_productivity/            # Main module
│   ├── __init__.py
│   ├── analyzer.py               # Class-based pipeline
│   └── utils.py                  # Preprocessing, plotting, helpers
├── main.py                       # CLI entry point
├── cropProductivity.par          # Parameter configuration file
├── requirements.txt              # Python dependencies
├── setup.py                      # Installation script
├── README.md                     # This file
└── docs/                         # Documentation and images

🛠️ Installation

  1. Clone or download the repository:
cd crop_productivity_package
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows use: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Install the module:
pip install -e .

📌 Configuration

Edit the cropProductivity.par file to specify:

  • Date ranges (overall and per year)
  • Growing season months
  • ADM boundary paths
  • Google Cloud bucket name
  • Input/output directories

🧪 Usage

Run the CLI pipeline using:

python main.py --params cropProductivity.par --output GEE

Or after pip install:

cropproductivity --params cropProductivity.par --output GEE

📊 Output

  • CSV: zonal statistics by ADM regions
  • GeoTIFFs: EVI z-score rasters by year
  • Plots: seasonal trends, histograms, anomaly summaries

🧩 Dependencies

  • Google Earth Engine Python API
  • pandas, geopandas, numpy
  • rasterio, branca, folium
  • matplotlib, seaborn
  • gee-zonal, google-cloud-storage

📧 Contact

Created by Pietro Milillo. Contributions, issues, and feature requests welcome.

Data Availability Statement

Restrictions may apply to the data that support the findings of this study. Data received from the private sector through the Development Data Partnership are subject to the terms and conditions of the data license agreement and the “Official Use Only” data classification. These data are available upon request through the Development Data Partnership. Licensing and access information for all other datasets are included in the documentation.

License

This projects is licensed under the Mozilla Public License - see the LICENSE file for details.

Code of Conduct

The World Bank Data Lab template used to create this project maintains a Code of Conduct to ensure an inclusive and respectful environment for everyone. Please adhere to it in all interactions within our community.

About

Modular pipeline for monitoring agricultural productivity using MODIS EVI and Google Earth Engine, with support for cropland masking, zonal statistics, anomaly detection, and automated export.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published