grat
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
Load the sites layer from a shapefile, file geodatabase, geopackage, geojson or csv. ArcGIS is not needed; only the attribute table is read.
from grat.loaders.get_sites import load_sites
rows = load_sites("OakValley/oakvalley.shp")
rows = load_sites("project.gdb", layer="sites", where="R_TYPE = 'OFR'")
rows = load_sites("sites.csv", attribute_renamer={"GRATID": "grat_id", "R_TYPE": "recharge_type"})
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
Full docs, including an API reference generated from the docstrings, are published at https://blueraster.github.io/earth-genome-grat/. To preview them locally:
uv sync --group docs
uv run mkdocs serve
- 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.3.2
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 |
|---|---|---|---|---|
| grat-0.3.2.tar.gz | 824.6 kB | With provenance | Details for grat-0.3.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| grat-0.3.2-py3-none-any.whl | Python 3 | none | any | Details for grat-0.3.2-py3-none-any.whl |
Total release size: 1.6 MB
Release files / grat-0.3.2.tar.gz
| Download URL | grat-0.3.2.tar.gz |
|---|---|
| Size | 824.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0a019f63cc529a327e9d9ee6bc373203f0b11648dcd66eb43ef327ac5063dc8
|
|
BLAKE2b-256 checksum How to use checksums |
fc454eeb6ddc5dc7e4c5eeaa4655b2531b7f46342341ce68e745f19346f0ee9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logRelease files / grat-0.3.2-py3-none-any.whl
| Download URL | grat-0.3.2-py3-none-any.whl |
|---|---|
| Size | 748.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e7eefcdb6b0a7f83534a6e4c483357cc3313668711844bae302f685b7bb88fe5
|
|
BLAKE2b-256 checksum How to use checksums |
89e65b66f03163faa065442316557f009429c542501091b70fc773d231c5584c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 10, 2026.
Transparency logSecurity for grat 0.3.2
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.
Attestation for grat-0.3.2.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 Nov 10, 2026.
Transparency logA 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.