mostlyright.weather.climate
mostlyright.weather.climate
Section titled “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.
Nonemeans best-available (=="iem")."acis"raisesValueError— there is no ACIS leg in this code path. - backend ( {“pandas” , “polars”} , keyword-only , default “pandas”) – Output frame type.
"polars"requiresreturn_type="wrapper"(polars frames carry nodf.attrsfor provenance). - return_type ( {“dataframe” , “wrapper” , “list”} , keyword-only , default “dataframe”) –
"dataframe"(default): apandas.DataFramewith provenance ondf.attrs."list": a plainlist[dict]of rows."wrapper": aMostlyRightResult.
- station (str) – ICAO code (e.g.
- Returns:
One row per CLI settlement day with the public column contract:
date, station, cli_high_f, cli_low_f, cli_report_typeplus provenancesource(per-row endpoint tag"iem") andissued_at. Frame identitydf.attrs["source"] == "cli.archive". - Return type: pd.DataFrame | list[dict]
- Raises:
ValueError – If
sourceis not in{None, "iem", "cli", "cli.archive"}, ifstart/endare not ISO dates, or if thebackend/return_typepair 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.
Examples
Section titled “Examples”>>> from mostlyright.weather import climate>>> df = climate("KNYC", "2026-01-01", "2026-01-03")>>> df.attrs["source"]'cli.archive'