Skip to content

mostlyright.weather.climate

mostlyright.weather.climate(station, start, end, , source=None, backend=‘pandas’, return_type=‘dataframe’)

Section titled “mostlyright.weather.climate(station, start, end, , source=None, backend=‘pandas’, return_type=‘dataframe’)”

Return NWS CLI daily settlement labels for station over [start, end].

The settlement source for Kalshi NHIGH/NLOW markets: the official NWS CLI daily high/low, merged via the frozen dedup policy (highest report_type_priority with STRICT > — overnight final wins).

  • Parameters:
    • station (str) – ICAO code (e.g. "KNYC") or 3-letter NWS code.
    • start (str) – ISO date strings (YYYY-MM-DD), inclusive bounds.
    • end (str) – ISO date strings (YYYY-MM-DD), inclusive bounds.
    • source ( {None , “iem” , “cli” , “cli.archive”} , keyword-only , default None) – Provenance selector. A degenerate single-authority axis (D-08): IEM CLI is the sole live provider, so every accepted value resolves to the same fetch. None means best-available (== "iem"). "acis" raises ValueError — there is no ACIS leg in this code path.
    • backend ( {“pandas” , “polars”} , keyword-only , default “pandas”) – Output frame type. "polars" requires return_type="wrapper" (polars frames carry no df.attrs for provenance).
    • return_type ( {“dataframe” , “wrapper” , “list”} , keyword-only , default “dataframe”) –
      • "dataframe" (default): a pandas.DataFrame with provenance on df.attrs.
      • "list": a plain list[dict] of rows.
      • "wrapper": a MostlyRightResult.
  • Returns: One row per CLI settlement day with the public column contract: date, station, cli_high_f, cli_low_f, cli_report_type plus provenance source (per-row endpoint tag "iem") and issued_at. Frame identity df.attrs["source"] == "cli.archive".
  • Return type: pd.DataFrame | list[dict]
  • Raises: ValueError – If source is not in {None, "iem", "cli", "cli.archive"}, if start/end are not ISO dates, or if the backend/return_type pair is incoherent (e.g. backend="polars", return_type="dataframe").
  • CLI is a daily batch product — climate() has NO grain axis and NO live surface (D-09/D-10 class 1: re-fetchable upstream).
  • This wraps the LOCAL CLI fetcher only; it makes NO hosted call.
>>> from mostlyright.weather import climate
>>> df = climate("KNYC", "2026-01-01", "2026-01-03")
>>> df.attrs["source"]
'cli.archive'