Skip to content

mostlyright.weather.qc_sidecar

Phase 3.4 — observation QC sidecar writer.

Writes per-(station, year, month) parquet sidecars produced by mostlyright.qc.QCEngine.build_sidecar_rows() to the canonical location $HOME/.mostlyright/cache/v1/observations_qc/{station}/{YYYY}/ {MM}.parquet. Best-effort: failures log + degrade silently so QC never breaks the research pipeline.

Sibling of mostlyright.weather.cache — uses the same atomic-write pattern + _cache_root + filelock guard so concurrent processes don’t clobber each other’s sidecar files.

qc_sidecar_path(station, year, month)Return the QC sidecar parquet path for (station, year, month).
write_qc_sidecar(sidecar_rows, *, station, …)Persist QC sidecar rows for (station, year, month).

mostlyright.weather.qc_sidecar.qc_sidecar_path(station, year, month)

Section titled “mostlyright.weather.qc_sidecar.qc_sidecar_path(station, year, month)”

Return the QC sidecar parquet path for (station, year, month).

Mirrors mostlyright.weather.cache.cache_path() layout but under the observations_qc/ namespace established by Phase 2.1 LINEAGE-05. Path validation is identical (defense-in-depth against caller-controlled station strings).

  • Return type: Path
  • Parameters:

mostlyright.weather.qc_sidecar.write_qc_sidecar(sidecar_rows, , station, year, month)

Section titled “mostlyright.weather.qc_sidecar.write_qc_sidecar(sidecar_rows, , station, year, month)”

Persist QC sidecar rows for (station, year, month).

Idempotent: writes via mostlyright.weather.cache._atomic_write() so partial writes don’t leak. Returns the written path on success or None if the row list was empty (no rule fired → no sidecar to write, no I/O at all).

Failures (filesystem errors, permissions) log at WARNING and return None rather than raising — QC is best-effort and must not break the wrapping research() call. The caller can audit by checking the returned path.