Skip to main content

Cosecha

Tools for harvesting earth observation data for use in flood forecasting.

Cosecha provides a flexible pipeline for collecting geospatial data from multiple sources and writing to various formats with optional transformations.

Features

  • Time-series data collection (USGS NWIS, IEM ASOS, NWS Local Storm Reports, USACE reservoirs)
  • Gridded data support (HRRR, RRFS, RTMA via herbie; MRMS via S3; WPC 6-hour QPF)
  • Multiple output formats: Parquet, NetCDF, Zarr, Iceberg, IceChunk
  • Data transformations: unit conversion, spatial subsetting, variable selection/rename
  • Cross-platform support (ecCodes C library required for GRIB2/MRMS)

Available Reapers

Reaper Type Source
USGSNWISReaper Time series USGS NWIS streamflow, stage and precipitation
ASOSReaper Time series ASOS surface observations from the Iowa Environmental Mesonet
LSRReaper Time series NWS Local Storm Reports from the Iowa Environmental Mesonet
ReservoirReaper Time series USACE CDA reservoir storage, elevation and outflow
NWPReaper Gridded HRRR, RRFS, RTMA and other NWP models via herbie ([nwp])
MRMSReaper Gridded NOAA MRMS accumulated precipitation from S3
WPCQPFReaper Gridded NOAA WPC 2.5 km CONUS 6-hour QPF forecasts

Installation

pip install cosecha

With optional dependencies for NWP (HRRR, RRFS) support:

pip install 'cosecha[nwp]'

Note: Cosecha depends on the ecCodes C library for reading GRIB2 data (used by MRMS). When installing with pip, you must have ecCodes available on your system. The easiest cross-platform approach is to install it via conda-forge:

conda install -c conda-forge eccodes
pip install cosecha

Or use pixi which handles this automatically:

pixi add cosecha

Quick Start

from cosecha import USGSNWISReaper

# Fetch USGS streamflow data
reaper = USGSNWISReaper(
    site_ids=["01650000"],
    start_date="2026-01-01",
    end_date="2026-01-31",
    parameter_code="00060",
)

# Execute
data = reaper.reap()

# Write to Parquet
path = reaper.sow_to_parquet(file_path="./data/streamflow.pq")

Gridded reapers work the same way. For example, the latest WPC 6-hour QPF for the first 72 hours over a bounding box:

from cosecha import WPCQPFReaper

reaper = WPCQPFReaper(
    init_time="latest",
    forecast_hours=range(6, 73, 6),
    transformations={
        "spatial_subset": {"lat_bounds": (29, 31), "lon_bounds": (-96, -94)},
    },
)
qpf = reaper.reap()

Documentation

Full documentation at https://dewberry.github.io/cosecha/

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

License

MIT License. See LICENSE for details.

Metadata

Release files for cosecha 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosecha 0.5.0
File Size Uploaded
cosecha-0.5.0.tar.gz 431.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cosecha 0.5.0
File Interpreter ABI Platform
cosecha-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 463.2 kB

Release files / cosecha-0.5.0.tar.gz

Download URL cosecha-0.5.0.tar.gz
Size 431.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b6496038607a7703cc8cda8d81ae7a63083fa00dbefa38a07fb9f19b0fb2ebed
BLAKE2b-256 checksum
How to use checksums
a153c30bb3aaae77eb7f9d869379215c875eb46c481b1827d0ddddc6a9665db1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / cosecha-0.5.0-py3-none-any.whl

Download URL cosecha-0.5.0-py3-none-any.whl
Size 31.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e9ca2342f593dbe90eca709c32aee7c16fd64c0575ce73127393d304f5a6206
BLAKE2b-256 checksum
How to use checksums
92b8aec86313fbe1269e971b92e4242d9394cbeac4615f38e373b9bda8d89652
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.3

2 release files

0.4.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page