Skip to main content

Agricultural geospatial analysis toolkit

Project description

geopandas-agri

Agricultural geospatial analysis toolkit extending GeoPandas.

Python License: MIT


Installation

pip install geopandas-agri

# With performance extras (Dask chunking support)
pip install "geopandas-agri[performance]"

Quickstart

import geopandas as gpd
import geopandas_agri          # registers the .agri accessor

gdf = gpd.read_file("fields.geojson")

# NDVI
gdf = gdf.agri.compute_ndvi("red", "nir")

# Soil management zones
gdf = gdf.agri.soil_zones(n_clusters=4)

# Irrigation needs
gdf = gdf.agri.irrigation_needs(evapotranspiration=5.2, rainfall=2.1)

# Summary report
print(gdf.agri.summary())

CLI

# Compute NDVI
geopandas-agri compute-ndvi fields.geojson --red red --nir nir

# Soil zones
geopandas-agri soil-zones fields_ndvi.geojson --n-clusters 4

# Irrigation needs
geopandas-agri irrigation-needs fields_zones.geojson --et0 5.2 --rain 2.1

# Summary
geopandas-agri summary fields_final.geojson

# JSON output for pipeline use
geopandas-agri summary fields_final.geojson --json-output | jq .ndvi

Features

Method Description
gdf.agri.compute_ndvi(red, nir) NDVI from column names or arrays
gdf.agri.sample_raster(path, band) Sample raster at geometry locations
gdf.agri.soil_zones(method, n_clusters) KMeans / DBSCAN / Agglomerative zoning
gdf.agri.irrigation_needs(et0, rain) Water-balance irrigation recommendations
gdf.agri.compute_ndvi_chunked(...) Chunked NDVI for very large datasets
gdf.agri.summary() NDVI stats, zone distribution, irrigation counts

Project Structure

geopandas_agri/
├── __init__.py     # Package entry; registers accessor
├── accessor.py     # Thin routing layer (@pd.api.extensions accessor)
├── ndvi.py         # NDVI formula + raster sampling
├── soil.py         # Clustering-based soil zonation
├── irrigation.py   # Water-balance irrigation model
├── utils.py        # Shared validation + numeric helpers
└── cli.py          # Click CLI commands

Development

git clone https://github.com/your-org/geopandas-agri
cd geopandas-agri
pip install -e ".[dev]"
pytest

Roadmap / Future Extensions

  1. Crop classification — integrate satellite time-series (Sentinel-2 / Landsat) with a scikit-learn or LightGBM classifier to map crop types per field.

  2. Yield prediction — regression models (XGBoost / neural nets) trained on historical NDVI trajectories, soil attributes, and weather data to predict per-field yield before harvest.

  3. Climate data integrationgdf.agri.attach_era5(date_range) to automatically download ERA5 reanalysis data (via cdsapi) and join precipitation, temperature, and wind speed to field geometries.

License

MIT © 2024 Agricultural GeoData Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agriscope-0.1.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agriscope-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file agriscope-0.1.0.tar.gz.

File metadata

  • Download URL: agriscope-0.1.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for agriscope-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3c7194252346f3e1a2a7a1a1d8ed9bda9c473bc7e00ab1919bbeb33f6d45da05
MD5 327440d2d227fefba6fcdf06dd6580a9
BLAKE2b-256 3dbc305cbfb71e6fa8da078e6a4e75414d50241a0e2f38ca7a954cc005191719

See more details on using hashes here.

File details

Details for the file agriscope-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agriscope-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for agriscope-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c40835cb653e6a7aaea5b2a09bb8237a7c4159251ce031e3d9d8e19e8fb7133
MD5 06a62a6f90cd8646522db4c996db9f26
BLAKE2b-256 d5885c92cebca31daaf5ded4cda7f27cf6ce6f52abbd2140614b1a8a9c3cb77c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page