This Python module provides a modular and scalable pipeline to assess agricultural productivity trends using MODIS EVI data and Google Earth Engine (GEE).
- 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
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
- Clone or download the repository:
cd crop_productivity_package- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Install the module:
pip install -e .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
Run the CLI pipeline using:
python main.py --params cropProductivity.par --output GEEOr after pip install:
cropproductivity --params cropProductivity.par --output GEE- CSV: zonal statistics by ADM regions
- GeoTIFFs: EVI z-score rasters by year
- Plots: seasonal trends, histograms, anomaly summaries
- Google Earth Engine Python API
- pandas, geopandas, numpy
- rasterio, branca, folium
- matplotlib, seaborn
- gee-zonal, google-cloud-storage
Created by Pietro Milillo. Contributions, issues, and feature requests welcome.
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.
This projects is licensed under the Mozilla Public License - see the LICENSE file for details.
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.