Skip to content

mostlyright.core.schemas.observation_merged

Merged observation-grain schema (schema.observation.merged.v1).

The frame-level identity contract for obs(granularity="observation") when the query is not pinned to a single source: the merged per-report rows produced by _dispatch_strategy and merge_observations, trimmed to the queried UTC window and passed through with observation_type distinguishing METAR from SPECI. No bucketing or resampling is applied.

A merged frame needs its own schema because its df.attrs["source"] is the merge-policy tag "merged.live_v1" rather than a single upstream source, while its per-row source column carries the bare parser tag (awc/iem/ghcnh). The single-source schema.observation.v1 requires per-row source == df.attrs["source"], so it rejects a merged frame; observation.py is left unchanged, keeping the CWOP parity firewall intact. This schema declares instead:

  • _registered_sources = {"merged.live_v1"} — the only frame-level identity it accepts. Declared as the set form (with no singular _registered_source) so the validator’s source_drift_allowed audit entry never fires on a clean merged read.
  • _registered_row_sources = {"awc","iem","ghcnh"} — read by the validator to check the per-row source column by membership in this set instead of equality with df.attrs["source"]. It is None on every other schema, so satellite, forecast.station, and cwop keep the equality check.

Columns are declared over the observation-grain row keys that obs(granularity="observation") emits (the merged parser row dicts built in weather/_iem.py), so a merged frame passes all four validator checks — source, column presence, dtype, and enum — not just the source check.

AttributeDescription
MERGED_LIVE_V1Frame-level merge-policy identity tag stamped on unpinned obs(granularity="observation") frames.
ClassDescription
MergedObservationSchema()schema.observation.merged.v1 — merged per-report observation rows.

mostlyright.core.schemas.observation_merged.MERGED_LIVE_V1 : str

Section titled “mostlyright.core.schemas.observation_merged.MERGED_LIVE_V1 : str”

Frame-level merge-policy identity tag stamped on unpinned obs(granularity="observation") frames. Distinct from any single upstream source; a single-source pinned schema rejects it.

class mostlyright.core.schemas.observation_merged.MergedObservationSchema

Section titled “class mostlyright.core.schemas.observation_merged.MergedObservationSchema”

Bases: Schema

schema.observation.merged.v1 — merged per-report observation rows.

Accepts the merge-policy frame identity merged.live_v1 while allowing the per-row source column to carry any of the bare parser tags {awc, iem, ghcnh} (membership, not equality — checked by the validator via _registered_row_sources).