Skip to main content

laterite-quarry

quarry pulls public AGS4 geotechnical datasets into a local mirror, keeps their licence with them, and stays out of the way of the sites it reads.

laterite-forge makes synthetic AGS4 data. Quarry digs up the real thing. Both feed laterite, which reads and validates it.

Status: early release. Commands may still change between 0.x versions.

Install with uv

Run it once, with nothing installed:

uvx --from "laterite-quarry[rvo]" quarry rvo list

Install the quarry command for good:

uv tool install "laterite-quarry[rvo]"
quarry doctor

Or add it to a uv project, to use the mirror from Python:

uv add "laterite-quarry[rvo]"

The [rvo] extra adds .7z support, which the RVO archives need. Leave it off if you only want BGS data. With pip: pip install "laterite-quarry[rvo]".

Sources

Source What How it is reached
bgs British Geological Survey AGS exports, by area The BGS AGS export API
rvo Dutch offshore wind site investigations (Fugro) A hand-curated list of direct file links

Use

Run any command once, with nothing installed, by putting uvx --from "laterite-quarry[rvo]" in front of it:

uvx --from "laterite-quarry[rvo]" quarry bgs count --bbox -0.133,51.514,-0.127,51.518

The rest are written as you would type them after uv tool install:

quarry bgs count --bbox -0.133,51.514,-0.127,51.518
quarry bgs pull tcr --bbox -0.133,51.514,-0.127,51.518 --dry-run
quarry bgs pull tcr --bbox -0.133,51.514,-0.127,51.518
quarry rvo list
quarry rvo pull hkz-wfs3-bh        # needs the [rvo] extra for .7z
quarry list
quarry holes bgs/tcr               # one row per borehole: ID, type, depth, groups, project
quarry check bgs/tcr               # validate with laterite
quarry cite bgs/tcr                # licence and attribution line

--bbox is west,south,east,north in decimal degrees. Add --json for a provenance envelope (meta.source is live or local), or --agent for the same in compact form.

How the files are laid out

--files on a pull chooses what lands in the mirror:

--files What you get
as-sent (default) Every file exactly as the source supplied it. BGS: a file per project per cell. RVO: a file per borehole.
per-project One AGS4 file per project in projects/, merged with laterite. Rows are matched by their KEY headings, so a borehole supplied twice lands once.
archives (BGS only) The downloaded zips, unopened.

A merged file is written by laterite, so it is not byte-for-byte what the source sent, though no value is changed. A project that will not merge cleanly is kept as sent and named in the pull's output.

From Python

import laterite
from laterite_quarry import cli, store

cli.main(["rvo", "pull", "hkz-wfs3-bh"])  # one download, then cached
folder = store.dataset_dir("rvo", "hkz-wfs3-bh")
for path in sorted(folder.glob("*.AGS")):
    print(path.name, laterite.read(path).groups)

Save that as holes.py and run it without setting anything up:

uv run --with "laterite-quarry[rvo]" holes.py

Being a good citizen

Neither site publishes a rate limit. BGS's service code has no rate limiter, only its cap of 50 boreholes per export; neither site sends rate-limit headers, and neither robots.txt sets a crawl delay. BGS's terms forbid anything resembling a denial-of-service attack. So this tool sets its own limit, and enforces it in one place (http.py):

  • One request at a time, at least 2 seconds apart per host. --interval can raise the gap; it cannot go below 1 second.
  • The gap holds between runs too: the time of the last request to each host is kept in the mirror, so a script calling quarry in a loop is still spaced.
  • A server's Retry-After is honoured, and failures back off: 4, 8, then 16 seconds, then a clean failure.
  • A request budget per run (--budget, 40 by default); exceeding it stops the run.
  • Nothing is fetched twice: a mirrored dataset is reused unless --refresh.
  • A pull counts first and refuses an area over --max-holes.
  • A User-Agent naming this tool and this repository.
  • Only https requests to the two known hosts are made; anything else is refused, including a redirect that leads elsewhere.
  • Responses and unpacked archives are size-capped, and a pull replaces the mirror only once it has finished.
  • RVO's robots.txt disallows /search, so the tool never searches or crawls that site. It fetches only links in rvo_catalogue.json.
  • Whatever a run drops (cells it could not split, archive members it refused, files it did not check) is reported in its output.

Licences

This code is MIT. The data is not ours: each mirrored dataset records its own licence and attribution, and quarry cite prints them. No data files are distributed in this repository.

  • BGS exports state the Open Government Licence v3.0 in the metadata file inside each download.
  • RVO states CC0 1.0 for its site content unless a document says otherwise.

Exit codes

0 ok · 1 findings (check) · 2 usage error · 3 not found, or a file could not be read or written · 4 check met a file it could not read as AGS4 · 5 pull refused by its size cap, or a missing optional dependency · 7 upstream failure, request budget spent, or a request or archive this tool refused.

Known limits

  • A dataset name is 1-64 characters of a-z, 0-9, - and _.
  • A BGS area over the export limit is fetched as several cells, so one project can arrive as a file per cell. quarry holes is the joined-up view: it lists each borehole once, by BGS's own identifier (BGS_LOCA_ID). A borehole that comes back in two cells is marked as a second copy, and a file holding nothing but second copies is removed. Files are otherwise kept exactly as BGS sent them.

Developing

uv sync
uv run ruff check . && uv run ruff format --check . && uv run ty check && uv run pytest -q

The tests never touch the network.

To release: bump version in pyproject.toml, date the changelog entry, merge to main, then run the Release workflow from the Actions tab. It publishes to PyPI and then tags the commit.

Metadata

Release files for laterite-quarry 0.1.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 laterite-quarry 0.1.1
File Size Uploaded Provenance Actions
laterite_quarry-0.1.1.tar.gz 72.7 kB With provenance Details for laterite_quarry-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for laterite-quarry 0.1.1
File Interpreter ABI Platform Actions
laterite_quarry-0.1.1-py3-none-any.whl Python 3 none any Details for laterite_quarry-0.1.1-py3-none-any.whl

Total release size: 97.3 kB

Release files / laterite_quarry-0.1.1.tar.gz

Download URL laterite_quarry-0.1.1.tar.gz
Size 72.7 kB
Tags Source
SHA-256 checksum
How to use checksums
335407ad7d016dd4bcf39df08abf7d9cec07bbc430965e65a3fc6cd07924cfd2
BLAKE2b-256 checksum
How to use checksums
8ec351d1da959feb833033a0addc166fa4181bfbc16435c5001de65261577e4f
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 29, 2026.

Transparency log

Release files / laterite_quarry-0.1.1-py3-none-any.whl

Download URL laterite_quarry-0.1.1-py3-none-any.whl
Size 24.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8fcb90453f688120530783b14c0e6930e46e3885d2cfa712eb26fcd7fff83b49
BLAKE2b-256 checksum
How to use checksums
4177f5c9ca18b28670204c034f5a22e305711b7dacdc8182b2d0363ae02f7c0f
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 29, 2026.

Transparency log

Security for laterite-quarry 0.1.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 laterite_quarry-0.1.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 Nov 29, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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