Skip to main content

EarthSciIO

Cross-language (Python / Julia / Rust) data-provider library that fulfills the EarthSci data-loader contract: it resolves a loader's URL at a time, downloads and caches the file in a shared content-addressed cache, and reads it into native-grid arrays the simulation consumes at its cadence.

EarthSciIO is the sanctioned impure I/O boundary of the EarthSci stack — it provides data, never a solver. Variable-remap stays in EarthSciAST (ESS); regrid stays in EarthSciDiscretizations (ESD). See the boundary writeup in spec/README.md.

Status

Greenfield. The language-neutral provider spec lands first and gates the per-language implementations:

  • spec/ — the contract: shared cache + manifest format (key = sha256(resolved_url)), the three extensibility registries (transport / format / store), the offline-mode contract, and the conformance corpus format. JSON Schemas in spec/schemas/.
  • conformance/ — offline golden fixtures + expected native arrays + a reference runner. python3 conformance/verify.py validates the corpus offline; ./conformance/run_conformance.sh runs all three providers over it and asserts the decoded native arrays are equal across Python, Julia, and Rust (cross-language harness, CI-gated).

Architecture is idiomatic-per-language against the shared spec (not a Rust+FFI core), extensible by construction so an S3 transport / object-store backend / Zarr reader slot in without touching the Provider API.

Python (earthsciio/)

The Python track ships the URL download + content-addressed cache behind the ESS opener/fetcher seam (esio-9nb.2). It registers the active http/file transports and the local store into the three registries, alongside the s3/zarr cloud stubs.

from earthsciio import Cache

cache = Cache()                                   # root = $EARTHSCIDATADIR
entry = cache.fetch(
    "https://data.earthsci.dev/era5/2018/11/20181108.nc",
    source_loader="era5",
    mirrors=["https://mirror.example/era5/20181108.nc"],   # tried in order
)
entry.path        # local blob (fetched once, shared across processes + languages)
entry.status      # "downloaded" | "hit" | "not_modified"

# Offline (cache-only, hermetic) — never touches the network:
hit = Cache(offline=True).fetch(...)              # raises CacheMiss on a miss

fetch is content-addressed by sha256(resolved_url), validates via checksum / conditional-GET / TTL, writes atomically under a per-blob flock (safe for many processes on one /scratch.local cache), and records a sidecar manifest. Auth is a pluggable realm → resolver seam (StaticHeaderAuth.bearer(...) / .header(...)); credentials never reach the manifest. Run the suite with pytest (fully offline/hermetic).

CDS / ERA5 (cds transport)

The active cds transport speaks the Copernicus Climate Data Store API v1 — submit → poll → download — behind the same fetch seam (plain requests, no cdsapi SDK). A cds:// URL encodes the dataset + request Dict as canonical JSON, so an identical request shares a cache key and a repeat is a hit, not a second CDS job. earthsciio.era5 builds that request from ERA5 loader fields (variable list, pressure levels, area from the domain bbox, the month/day/hour span), ported from EarthSciData.jl.

from earthsciio import Cache, cds_auth, era5

url = era5.era5_cds_url(
    2018, 11, [8], ["temperature", "u_component_of_wind"], [1000, 850, 500],
    era5.era5_area_from_bbox(-100.5, 39.0, -80.2, 45.7),   # [N, W, S, E]
)
cache = Cache(auth={"cds": cds_auth()})                    # key from ~/.cdsapirc / $CDSAPI_KEY
entry = cache.fetch(url, source_loader="era5", auth_realm="cds")

Auth is the PRIVATE-TOKEN header carried by the cds realm; the key is read from $CDSAPI_KEY or ~/.cdsapirc and only the realm name reaches the manifest. CI is fully offline against a mock CDS server. The live pull is a manual smoke test (needs a real key + one-time ERA5 licence acceptance on the CDS portal):

EARTHSCI_LIVE=1 CDSAPI_KEY=<key> pytest -q -k live_cds

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earthsciio-0.1.3.tar.gz (166.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earthsciio-0.1.3-py3-none-any.whl (118.6 kB view details)

Uploaded Python 3

File details

Details for the file earthsciio-0.1.3.tar.gz.

File metadata

  • Download URL: earthsciio-0.1.3.tar.gz
  • Upload date:
  • Size: 166.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for earthsciio-0.1.3.tar.gz
Algorithm Hash digest
SHA256 136a6bdc746347ebdc30122a71a9013acddcfcad965e78c5f6c5ec57ea646db9
MD5 544064d51de56dbac9e18070fd90cc9d
BLAKE2b-256 d346b7281df4b20f23df79c7e21041bfbff6d07a79f1f2b16228f7bbd4b6f2b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for earthsciio-0.1.3.tar.gz:

Publisher: release.yml on EarthSciML/EarthSciIO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file earthsciio-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: earthsciio-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 118.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for earthsciio-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbb20c09b1c024f5d2688b03c5887f525b67c2fe4979e3f3a057c410a69354a0
MD5 94a1821669786cabe3e24a4be36b7e69
BLAKE2b-256 20519286c5b86304d5b7cb2d843cfcdd0b2633dc1a06f48877be3b49ee4895ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for earthsciio-0.1.3-py3-none-any.whl:

Publisher: release.yml on EarthSciML/EarthSciIO

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 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