Sample dataset¶
The synthetic sample that ships with the package: what the tutorial notebook runs on. Its numbers are not stable, its API is.
load_sample
¶
load_sample() -> SampleDataset
Load the bundled sample, verifying it against its checksum first.
Raises:
| Type | Description |
|---|---|
SampleDataError
|
the file is missing, does not match its checksum, or is not the schema this version reads. |
SampleDataError
¶
Bases: RuntimeError
The bundled sample is missing, corrupt, or not the shape this version expects.
SampleDataset
¶
SampleDataset(payload: Mapping[str, Any])
The parsed sample. Build it with load_sample.
days
instance-attribute
¶
days: list[str] = [
(date.fromisoformat(t) - timedelta(days=1)).isoformat()
for t in targets
]
city_timezones
property
¶
city_timezones: dict[str, str]
city -> IANA zone, for PaperBroker.record(city_timezones=...).
from_payload
classmethod
¶
from_payload(payload: Mapping[str, Any]) -> SampleDataset
Validate a decoded payload and build the dataset; SampleDataError if it is off.
winning_index
¶
winning_index(market: Mapping[str, Any]) -> int
Index (0-8) of the bin the day's maximum fell in.
plugin
¶
plugin(day: str | None = None) -> WeatherTmaxPlugin
The real WeatherTmaxPlugin, reading this file instead of the APIs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
day
|
str | None
|
|
None
|
SampleForecastClient
¶
SampleForecastClient(dataset: SampleDataset)
Stands in for the forecast client: the features of a market at previous_evening.
SampleGammaClient
¶
SampleGammaClient(dataset: SampleDataset, day: str)
Stands in for the Gamma client: serves the markets listed on one morning.
fetch_markets_all
¶
fetch_markets_all(
page_size: int = 100,
max_results: int = 1000,
**kwargs: Any,
) -> list[dict[str, Any]]
Gamma-shaped payloads of the markets open for tomorrow (page_size is moot).
SampleTruthClient
¶
SampleTruthClient(
dataset: SampleDataset, day: str | None = None
)
Stands in for the observation client: the day's maximum, once the day has ended.
get_daily_max
¶
get_daily_max(city: str, date: str) -> float | None
The official maximum (C), or None if unknown or not final yet.
With a morning day, an observation is only known for days before it.