pyslga
Cached SLGA soil-property windows for Australia — download once per chunk, never twice. The Soil and Landscape Grid of Australia provides national ~90 m grids of soil properties (clay, sand, silt, pH, bulk density, AWC, …) at six standard depths, served as one COG per attribute × depth on the TERN datastore. Every pixel this machine ever downloads lands in one sparse, chunk-indexed store, so repeat requests, overlapping AOIs and new depth slices reuse everything already fetched. Part of the Borevitz Lab ecosystem.
How it works
{data_root}/slga_store/
├── index.db # SQLite: layer metadata + populated chunks
└── slga.zarr/
├── CLY_005_015 # one sparse national array per attribute × depth
└── SND_005_015 ...
- At a layer's first contact, its COG filename is resolved from the datastore listing (each attribute has its own release date, so names can't be hardcoded) and its grid — transform, shape, nodata — is read from the COG and recorded. Everything after that is offline arithmetic.
- Any bbox maps deterministically to a set of 1200 × 1200-px chunks on
the layer's native grid.
Store.get_ds(bbox)diffs them against the ledger and downloads only the missing chunks, each as one integer-aligned windowed read — no resampling, ever. - Soil properties are time-invariant: no time axis, no dates.
- Pixel reads require a TERN API key (listings are public) — set
tern_api_keyin~/.config/Troi.json,TROI_TERN_KEY, or passapi_key=per call. Keys are free from https://account.tern.org.au/.
Usage
The core API is troi-agnostic — just a bbox:
from pyslga.store import Store
store = Store()
bbox = [148.36265, -33.52606, 148.38265, -33.50606] # [W, S, E, N]
ds = store.get_ds(bbox) # texture triple Clay/Sand/Silt at 5-15cm
ds = store.get_ds(bbox, attributes=('Clay', 'pH_Water', 'Bulk_Density'),
depths=('0-5cm', '5-15cm', '15-30cm'))
ds['Clay_5-15cm'] # (lat, lon) DataArray
store.fill(bbox) # → 0: already local
16 attributes × 6 depths are available — see pyslga.slga.SLGA for
the catalog.
Pipelines that speak the shared troi.troi.Troi use the
adapters (dates on the troi are ignored):
ds = store.get_ds_troi(troi)
download_slga_soils(troi) remains as a thin wrapper.
Performance
Live measurements against TERN — a ~2 × 2 km AOI (one chunk = 1200 × 1200 px ≈ 100 × 100 km at 90 m):
| Scenario | Downloaded | Time |
|---|---|---|
| Cold fill — Clay/Sand/Silt at 5–15 cm | 3 chunks | 3.8 s |
| Same request again | nothing | 0.0 s |
| AOI shifted ~2 km (inside cached chunks) | nothing | 0.0 s |
| New depth slice (0–5 cm), same attributes | 3 chunks — the new layers only | 3.6 s |
| Read cached window (1200² × 3 layers) | — | 0.4 s |
Store footprint: ~5 MB for six layer-chunks (~10 000 km² each of Clay/Sand/Silt at two depths). Absolute times vary with network and TERN load; the zeros are the point — they are ledger lookups, no network involved.
Install
pip
pip install git+https://github.com/thestochasticman/pyslga.git
Dependencies (the troi core included, pulled from GitHub) are
declared in pyproject.toml and installed automatically.
From source
git clone https://github.com/thestochasticman/pyslga.git
cd pyslga
pip install -e .
Package design (shared across the lab's packages — no inheritance, composition only):
Troi(fromtroi) — identity: what region.SLGA(pyslga.slga) — config: endpoint, attribute/depth catalogs.Paths(pyslga.paths) — derived locations of the store for a givenConfig.grid— chunk math parameterised by each layer's native grid (pure, offline-testable).Store(pyslga.store) — ties them together.
Test
# offline (pure math + synthetic store):
python pyslga/grid.py # True
python pyslga/paths.py # True
python pyslga/store.py # True
# live (small real reads from TERN — needs tern_api_key):
python pyslga/download_slga.py # True
Metadata
Release files for pyslga 0.1.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 |
|---|---|---|---|---|
| pyslga-0.1.0.tar.gz | 14.2 kB | Without provenance | Details for pyslga-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyslga-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyslga-0.1.0-py3-none-any.whl |
Total release size: 29.0 kB
Release files / pyslga-0.1.0.tar.gz
| Download URL | pyslga-0.1.0.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db360aac4867c55490c9e4a86e1633196397ef5f82b8463a204055da96efe8da
|
|
BLAKE2b-256 checksum How to use checksums |
23ed5415ce1f6182a86c768d207f7f9fb46e47325d69bbbea0e2ff3a81dfad83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / pyslga-0.1.0-py3-none-any.whl
| Download URL | pyslga-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b61e150de7542c9240a5d668a26714e2951dd81a6a9e2fc2ff64e80f806b1aed
|
|
BLAKE2b-256 checksum How to use checksums |
d0abf949257f46d1550aec3f2dcdb9965ad75f0d89e59c27ebce1939e383014e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for pyslga 0.1.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.