Weather Plugin¶
The tangram_weather plugin provides API endpoints to serve meteorological data, enabling features like wind field visualization on the map.
Overview¶
This plugin fetches weather prediction data from Meteo-France's ARPEGE model, processes it, and exposes it via a REST API. The data is provided as GRIB files, which are downloaded and parsed on the backend.
How It Works¶
-
The plugin downloads GRIB files containing ARPEGE weather model predictions from the public data.gouv.fr repository. These files are cached locally in a temporary directory.
-
It registers a
/weatherrouter with the main FastAPI application. The key endpoint is/weather/wind. -
When a request is made to
/weather/wind?isobaric=<level>, the plugin:- Determines the latest available GRIB file for the current time.
- Uses
xarrayandcfgribto open the GRIB file. - Selects the U and V wind components for the specified isobaric pressure level (e.g., 300 hPa).
- Returns the data as a JSON response.
-
The frontend
WindField.vuecomponent calls this endpoint.