Stormlore¶
Stormlore is the Python SDK for wxchange: forecasts at a place, along a route or over an area, returned as results that turn themselves into pandas DataFrames and xarray Datasets.
pip install stormlore # client + pandas
pip install 'stormlore[xarray]' # + AreaResult.to_xarray()
pip install 'stormlore[viz]' # + charts and maps (.plot())
pip install 'stormlore[all]' # everything
Python 3.10 or newer.
Five lines¶
from stormlore import Client
client = Client() # reads WXCHANGE_API_KEY
now = client.forecast.point("gfs", (41.26, -95.94), ["temperature_2m"])
now.to_dataframe()
With no time given, the query asks for the forecast valid nearest to now, from the newest run. Values come back as the API serves them (here kelvin); see units.
Sync or async¶
Client blocks; AsyncClient is the same client with await:
from stormlore import AsyncClient
async with AsyncClient() as client:
now = await client.forecast.point("gfs", (41.26, -95.94), ["temperature_2m"])
Both are built from one implementation, so they take the same arguments and return the same results.
Where next¶
- Authentication: the API key and where the client sends it.
- Forecasts: places, times, routes, areas, units, xarray.
- Observations, storm reports and radar: paged listings, stations, county rollups, MRMS frames.
- Scores: the Shyft Score, its history, regions, rankings, badges, scorecards.
- Advisories and ZIP codes: active alerts by ZIP or point, and what a ZIP covers.
- Charts and maps:
.plot()on results, andstormlore.viz. - Errors and retries: what is retried and what is raised.
- Reference: every method and result.