Skip to content

Forecast architecture

@azohra/meteo.forecast exposes the meteo CLI (pnpm exec meteo, or node forecast/dist/cli.js from a workspace checkout) and the versioned documents it writes as its supported interface.

Publication flow from model cycle to browser A five-stage sequence from upstream forecast publication through completeness probing, model-specific building, one static publication, and a consumer consistency check.

Inside the builder stage, provider bytes move through module-owned steps:

models.json + sites.json
provider transport ──→ gridpoint sampling ──→ source-shaped hours
deriveSiteForecast
contract rounding + validation tests
│ │ │
▼ ▼ ▼
profile manifest history
AreaRepository homeResponsibility
CLI and scoped pathsforecast/src/cli.ts, forecast/src/config.tsSelect model(s), validate site/output paths, cap forecast steps (--max-steps caps every model, GOES granules included), dispatch safely — configuration is passed explicitly, never held in ambient state
Site cataloguesites.tsLoad the versioned, identity-only site envelope; reject shapes the loader does not speak
Provider transport plumbingproviders/transport.tsOne User-Agent, one request timeout, and the download telemetry manifests publish
Provider clientsproviders/datamart.ts, providers/noaa.ts, and the workspace’s @azohra/meteo.grib decoderFetch, range-read, decode, sample, and account for transport work
Published-dataset readsdataset.tsRead what is already published — public HTTPS via METEO_DATA_BASE, or the bucket directly when upload credentials are present — to gate rebuilds and seed history
Builder registrybuilders/registry.tsCatalogued model slug → options-only build entry, in exact catalogue order; each factory imports its builder module (dynamic import()) only when a build runs
Builder helpersbuilders/common.tsThe machinery every build composes identically — forecast-slot timestamps, the bounded fetch pool, source-hour and level skeletons
Buildersbuilders/*.tsVerify run completeness, request declared fields, preserve absence, assemble source hours
Shared field sciencemoisture.ts, sentinel.tsInverse-Magnus dew-point depression for models that publish only RH; masking of ECCC’s “not computed” CAPE/CIN sentinels
Derivationderive.tsProduce published profile blocks and model-dependent derived values; the usable-lift derivation is imported from @azohra/meteo.briefing/derive and stored at the 1 m/s sink
Ensemble aggregationensemble.tsAggregate member profiles, including circular wind and censored counts
Publicationpublish.tsRound contract fields, write JSON, append gzip history, build run index
Wire migrationmigrate.tsThe one executable home of the v1 → v2 vocabulary change, plus the one-time meteo forecast migrate cutover that rewrites a model’s published v1 documents in place
History mechanicshistory.tsSplit gzip members, recompute each month’s sidecar byte-offset index after every append
Terrain catalogueterrain.tsOne-shot site-context.json enrichment (elevation, slope/aspect, relief, land cover); the geospatial stack loads only when the terrain command runs
Teaching scenariosscenario/ (index.ts, json.ts, rng.ts, shadow.ts)Generate fixed inputs through the same derivation authority — split along its seams (definition validation and generation, int/float-preserving JSON, the CPython-compatible RNG, the tagged re-derivation walk)
Checkout discoveryThe caller’s, not the package’sEvery scenario entry point takes repositoryRoot as an explicit option; the repo’s own answer to “where is the checkout root?” lives with the repo tooling (internal/scenarios.mjs), never in the package

Which quantities the forecast engine owns and which belong to @azohra/meteo.briefing — including the one parameterized exception — is defined once in the project overview. The Meteogram derivations define the engine’s equations, constants, fallbacks, and renderer-only transformations.

Scenario generation starts from committed inputs with fixed identity and time, then calls the same profile derivation used by builders. Teaching figures consume the generated scenario registry.

The builder contract defines the required inputs, validation, and publication behaviour for model modules.