mostlyright.forecasts
mostlyright.forecasts
Section titled “mostlyright.forecasts”Phase 3.2 — Multi-forecast live path (HRRR + GFS + NBM via NOAA BDP).
Public dispatch surface for mostlyright NWP forecasts. The real fetch
- decode + station-extraction pipeline lives in
mostlyright.weather.forecast_nwp(shipped by the siblingmostlyrightmd-weatherdistribution) so this module stays importable without the[nwp]optional extra installed.
Live-path only in v0.1.0 — historical NWP backfill + ECMWF Tier-2
defer to v0.2 (both require hosted infrastructure local-first cannot
host). ECMWF Tier-2 model ids are reserved in
schema.forecast_nwp.v1 and raise
mostlyright.core.exceptions.NwpModelNotAvailableError when
called.
Surface:
forecast_nwp(station, model, ...)()— dispatch entry point.SUPPORTED_NWP_MODELS— frozen set of model ids we ship.
The [nwp] optional extra
(pip install mostlyrightmd-weather[nwp]) adds cfgrib, xarray,
and scikit-learn. Calling forecast_nwp() without it raises
mostlyright.core.exceptions.SourceUnavailableError carrying the
install hint.
Module Attributes
Section titled “Module Attributes”SUPPORTED_NWP_MODELS | NWP models that the public mostlyright.forecast_nwp surface actually wires end-to-end. |
|---|
Functions
Section titled “Functions”forecast_nwp(station, model, *[, cycle, …]) | Fetch an NWP forecast from NOAA Big Data Program direct-fetch. |
|---|
mostlyright.forecasts.SUPPORTED_NWP_MODELS : frozenset[str] = frozenset({‘cfs’, ‘ecmwf_aifs_ens’, ‘ecmwf_aifs_single’, ‘ecmwf_ifs_ens’, ‘ecmwf_ifs_hres’, ‘gdas’, ‘gdps’, ‘gefs’, ‘geps’, ‘gfs’, ‘hafs’, ‘hiresw’, ‘hrdps’, ‘href’, ‘hrrr’, ‘hrrrak’, ‘nam’, ‘nbm’, ‘rap’, ‘rdps’, ‘reps’, ‘rrfs’, ‘rtma’, ‘urma’})
Section titled “mostlyright.forecasts.SUPPORTED_NWP_MODELS : frozenset[str] = frozenset({‘cfs’, ‘ecmwf_aifs_ens’, ‘ecmwf_aifs_single’, ‘ecmwf_ifs_ens’, ‘ecmwf_ifs_hres’, ‘gdas’, ‘gdps’, ‘gefs’, ‘geps’, ‘gfs’, ‘hafs’, ‘hiresw’, ‘hrdps’, ‘href’, ‘hrrr’, ‘hrrrak’, ‘nam’, ‘nbm’, ‘rap’, ‘rdps’, ‘reps’, ‘rrfs’, ‘rtma’, ‘urma’})”NWP models that the public mostlyright.forecast_nwp surface
actually wires end-to-end. Phase 17 PLAN-03 expanded this from
{hrrr, gfs, nbm} to the full NCEP family (HRRRAK + GEFS + GDAS +
RAP + RRFS + RTMA + URMA + CFS) — 11 total.
ECMWF Tier-2 (4 models), MSC Canadian family (5), and HAFS / legacy
NAM / HREF / HiResW (4) are predeclared in
mostlyright.core.schemas.forecast_nwp.NWP_MODEL_VALUES and
raise NwpModelNotAvailableError until their Wave-2 plans
(PLAN-04 / -05 / -06) land their fetch + decode wiring. The
internal SSRF allow-list mostlyright.weather._fetchers._nwp_archive.SUPPORTED_NWP_MODELS
covers the full 24-name predeclared enum so URL construction is safe
when those plans flip the public-surface bit one model at a time.
mostlyright.forecasts.forecast_nwp(station, model, , cycle=None, cycle_range_start=None, cycle_range_end=None, fxx=None, mirror=None, member=None, client=None)
Section titled “mostlyright.forecasts.forecast_nwp(station, model, , cycle=None, cycle_range_start=None, cycle_range_end=None, fxx=None, mirror=None, member=None, client=None)”Fetch an NWP forecast from NOAA Big Data Program direct-fetch.
Thin re-export of mostlyright.weather.forecast_nwp.forecast_nwp()
so the canonical user-facing import path stays mostlyright.forecasts
(matching mostlyright.research()).
- Parameters:
- station (
str|list[str]) – Single ICAO/NWS code or a list of them. - model (
str) – One ofSUPPORTED_NWP_MODELS("hrrr","gfs","nbm"). ECMWF Tier-2 values raiseNwpModelNotAvailableError. - cycle (
datetime|None) – Model run cycle (UTC, tz-aware). Default: latest cycle whose run +fxxis at least 90 minutes in the past. - fxx (
int|None) – Forecast hour ahead ofcycle. Default1. - mirror (
str|None) – Force a specific NOAA BDP mirror ("aws_bdp"or"nomads"). Default: try AWS then NOMADS. - member (
str|None) – Ensemble member id — only valid for the member-capable models GEFS ("c00"/"p01"..“”p30”/”avg”/”spr”, default ``"c00") and CFS ("01"..“”04”, default ``"01").None(default) is byte-identical to today. Validation + the valid-member enums live in the weather impl; this wrapper passesmemberstraight through (issue #74). - client (
Client|None) – Reuse anhttpx.Clientfor connection pooling. - cycle_range_start (datetime | None)
- cycle_range_end (datetime | None)
- station (
- Return type:
DataFrame - Returns:
DataFrame matching
schema.forecast_nwp.v1. - Raises:
- ValueError –
modelnot inSUPPORTED_NWP_MODELSand not a reserved ECMWF id;fxxis negative;cycleis naive;mirroroutside the supported set;memberset for a non-member model or not a valid member of the model’s ensemble (validated in the weather impl). - NwpModelNotAvailableError –
modelis a reserved ECMWF id. - SourceUnavailableError –
[nwp]optional extra not installed. - NoLiveForNwpError – every wired NOAA BDP mirror failed.
- GribIntegrityError – a fetched record decoded with structural failures.
- ValueError –