Skip to main content

grat

CI PyPI License: MIT

GRAT is a groundwater recharge assessment tool. It models how water available for recharge is allocated, day by day across a span of water years, to canals, basins and farm fields, and reports the resulting groundwater recharge.

Installation

pip install grat

Usage

Run the model and produce reports:

from grat import read_report, run_grat

result = run_grat(sites, wafr, bottlenecks, crop_calendar, precip)

result["zip_path"]  # the results archive
result["reports"]  # the report names that were produced
result["series"]["unused_wafr"]  # the frontend visualisation data

run_grat returns a plain dict. To look at any report it produced, read it back by name as a pandas dataframe:

df = read_report(result["output_folder"], "annual_summary_recharge")
df = read_report(result["output_folder"], "daily_recharge_by_site", year=2001)

Reports are asked for by name, and a run only builds what those reports need:

result = run_grat(..., reports=["annual_summary_recharge", "acres_available_and_used"])

grat.reports.catalog.ALL_REPORTS lists everything available.

To drive the year loop yourself and work with the dataframes directly, without writing any csv files, pass None as the output folder:

from grat.model.engine import process_year
from grat.reports import report_picker

year = process_year(sites, bottlenecks, wafr, crop_calendar, precip)
reports = report_picker(
    ["annual_summary_recharge"], None, 2001, year["sites"], raw_wafr, year["wafr"], year["bottlenecks"]
)
reports["annual_summary_recharge"]

Documentation

  • docs/model.md — grat.model: sites, allocation order, bottlenecks, transfers, and running the year loop yourself.
  • docs/reports.md — grat.reports: the report catalog, what each report contains, and how to read one back.

Development

This project uses uv for dependency management.

uv sync                  # install dependencies (incl. dev group) into .venv
uv run pytest            # run tests
uv run ruff check .      # lint
uv run ruff format .     # format

License

MIT — see LICENSE.

Metadata

Release files for grat 0.2.1

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

Source distribution (sdist)

Source distribution for grat 0.2.1
File Size Uploaded Provenance Actions
grat-0.2.1.tar.gz 104.1 kB With provenance Details for grat-0.2.1.tar.gz

Built distribution (wheel)

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

Total release size: 150.1 kB

Release files / grat-0.2.1.tar.gz

Download URL grat-0.2.1.tar.gz
Size 104.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9681ec35b7493600988a6e0c01470219bbb5e338d21db5cd5db8bb45c63e2dff
BLAKE2b-256 checksum
How to use checksums
483a7a42f78b6a0b8b9513b39b127e9e664912b31cea12f320bb7bbde6e6c55f
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 5, 2026.

Transparency log

Release files / grat-0.2.1-py3-none-any.whl

Download URL grat-0.2.1-py3-none-any.whl
Size 46.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eb084664ba45ea87587bb269dc17b3deaa8cf26c40da5b56c7b94765c3b1bd54
BLAKE2b-256 checksum
How to use checksums
a7fd5bfbce26e23799fdbc9201dcbb43b26af64e6e177c23e085b1d224d22912
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 5, 2026.

Transparency log

Security for grat 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for grat-0.2.1.tar.gz

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 5, 2026.

Transparency log

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.

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