calicropyield
Python client library for downloading and preparing county-level data used in the California Crop Yield Benchmark.
What this package does
calicropyield provides a single client to retrieve benchmark-ready files from a versioned Google Drive dataset release:
- ET (OpenET monthly GeoTIFF)
- Landsat monthly GeoTIFF
- DayMet climate annual NetCDF
- Soil NetCDF
- CDL annual GeoTIFF
- USDA crop yield CSV
The package supports optional geometry-based cropping and lightweight filtering for CDL/USDA outputs.
Installation
From source (this repository)
git clone https://github.com/plant-ai-biophysics-lab/calicropyield-dev.git
cd calicropyield-dev
pip install .
Development install (recommended)
uv sync --extra dev --extra test
Authentication setup
This package accesses protected Google Drive data via a service account key.
Credential resolution order:
CALICROPYIELD_CREDENTIALSenvironment variable~/.calicropyield/service_account.json
Example:
export CALICROPYIELD_CREDENTIALS=/absolute/path/to/service_account.json
If no credential file is found, the client raises FileNotFoundError with setup instructions.
Quickstart
from calicropyield import CalCropYieldClient
client = CalCropYieldClient(
cache_dir="~/data/calicropyield",
dataset_version="v1", # optional; defaults to latest
overwrite=False,
)
print(client.list_datasets())
print(client.list_years())
# Download 2021 Landsat files for two counties
paths = client.download_landsat(["Yolo", "Fresno"], years=[2021])
print(f"Downloaded {len(paths)} files")
Public API
Main exports:
CalCropYieldClientDatasetCatalogDataDownloader(backward-compatible alias ofCalCropYieldClient)
Download methods
All download methods return List[pathlib.Path]:
download_et(county_names, years=None, geometry=None)download_landsat(county_names, years=None, geometry=None)download_climate(county_names, years=None, geometry=None, variables=None)download_soil(county_names, geometry=None, variables=None)download_cdl(county_names, years=None, geometry=None, crop_types=None)download_yield(county_names, years=None, crop_types=None)
Introspection helpers
list_datasets()list_years(dataset="landsat")list_counties()
Dataset catalog and versioning
Dataset layout is defined in a versioned manifest file: calicropyield/catalog.json.
- Current latest dataset version:
v1 - Years in
v1: 2008, 2009, 2010, 2011, 2013-2022 - Available dataset keys:
et,landsat,climate,soil,cdl,usda
You can inspect catalog metadata via:
from calicropyield import DatasetCatalog
catalog = DatasetCatalog() # latest
print(catalog.version)
print(catalog.available_datasets)
print(catalog.available_years)
Output structure
Downloaded files are stored under:
<cache_dir>/counties/<County>/data/<dataset_type>/<year>/...
For non-yearly datasets (for example soil), year subfolders are omitted.
Development workflow
This project uses:
uvfor environment and lockfile managementrufffor lintingpytestfor testssetuptools-scmfor dynamic package versioning from git tags
Common commands:
uv sync --extra dev --extra test
uv run ruff check calicropyield/
uv run pytest
uv lock
Releases
Package version is derived from git tags (for example v0.2.0).
Typical release flow:
git tag vX.Y.Z
git push origin vX.Y.Z
On tag push, GitHub Actions builds wheel and sdist artifacts and validates them with twine check.
Repository layout
calicropyield/: installable Python packagedataset/: internal dataset generation scripts/notebooks.github/workflows/ci.yml: lint/test/build CI
Related project
End-user tutorial notebooks and benchmark usage examples live in the companion repository:
License
BSD 3-Clause License. See LICENSE.
Metadata
Release files for calicropyield 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| calicropyield-0.3.0.tar.gz | 7.5 MB | Without provenance | Details for calicropyield-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| calicropyield-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for calicropyield-0.3.0-py3-none-any.whl |
Total release size: 7.5 MB
Release files / calicropyield-0.3.0.tar.gz
| Download URL | calicropyield-0.3.0.tar.gz |
|---|---|
| Size | 7.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
44e89605296a887cf1918f5863fbfdc8cb9d6f4030383ce949129a1f47ab92a0
|
|
BLAKE2b-256 checksum How to use checksums |
d7a47876b85760465f254cf168b5cec383151d1d27e9fc00f148ad9b9932d3de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / calicropyield-0.3.0-py3-none-any.whl
| Download URL | calicropyield-0.3.0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
26d77e390c5f42245b4dfe1186e26fb6f70351b99f91210aa6e8a296dee5d7a3
|
|
BLAKE2b-256 checksum How to use checksums |
668dcedc5e8f3507d3de0b74eee35dcee7cde6cba39d4b96ba976f8979e80afb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for calicropyield 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.