Radar: API Reference#
- class yr_weather.Radar(headers=None, use_cache=True)#
Bases:
APIClientA client for interacting with the MET Radar API.
- get_all_statuses() RadarGlobalStatus#
Get the operational status of all radars.
- Returns:
A dataclass with statuses of radars.
- Return type:
- get_available_radars() RadarOptions#
Get available types of radars.
This function retrieves all types of radars, as well as which areas they are available in. The dataclass returned also includes available types of content (image or animation).
- Returns:
A dataclass with available radars and additional info.
- Return type:
- get_radar(area: str, radar_type: str, content: Literal['image', 'animation'] = 'image', time: str | None = None) Response#
Get a radar image (png) or animation (gif).
For examples of usage, please see the docs: https://yr-weather.readthedocs.io/
For more information about what arguments are valid, please see: https://api.met.no/weatherapi/radar/2.0/documentation
- Parameters:
area (
RadarArea) – A string of one the of the possible values for area, based on valid MET Radar API literals.radar_type (
RadarType) – A string of one of the possible values for type, based on valid MET Radar API literals.content (
RadarContentType) – Optional: Either the string “image” or “animation”, based on the desired result from the API. Default is"image".time (Optional[
str]) – An optional string containing the time when the image was taken, provided in ISO 8601 format. Default is None.
- Returns:
A Response class, enabling for further saving or managing of the data received from the open stream.
- Return type:
- get_status(area: str | None = None, sitename: str | None = None) RadarStatus | None#
Get the operational status of a single radar.
Either
areaorsitenamemust be used to find a radar.- Parameters:
- Returns:
A dataclass with radar status. Can be None if no radar is found.
- Return type:
Optional[
RadarStatus]
Dataclasses#
- class yr_weather.data.radar.RadarContentAvailable(areas: List[Literal['central_norway', 'eastern_norway', 'finnmark', 'nordic', 'nordland', 'northern_nordland', 'northwestern_norway', 'norway', 'southeastern_norway', 'southern_nordland', 'southern_norway', 'southwestern_norway', 'troms', 'western_norway', 'xband']], content: Literal['image', 'animation'])#
A dataclass storing available areas and content types for a radar type.
- class yr_weather.data.radar.RadarOptions(five_level_reflectivity: RadarContentAvailable, accumulated_01h: RadarContentAvailable, accumulated_02h: RadarContentAvailable, accumulated_03h: RadarContentAvailable, accumulated_04h: RadarContentAvailable, accumulated_05h: RadarContentAvailable, accumulated_06h: RadarContentAvailable, accumulated_07h: RadarContentAvailable, accumulated_08h: RadarContentAvailable, accumulated_09h: RadarContentAvailable, accumulated_10h: RadarContentAvailable, accumulated_11h: RadarContentAvailable, accumulated_12h: RadarContentAvailable, accumulated_13h: RadarContentAvailable, accumulated_14h: RadarContentAvailable, accumulated_15h: RadarContentAvailable, accumulated_16h: RadarContentAvailable, accumulated_17h: RadarContentAvailable, accumulated_18h: RadarContentAvailable, accumulated_19h: RadarContentAvailable, accumulated_20h: RadarContentAvailable, accumulated_21h: RadarContentAvailable, accumulated_22h: RadarContentAvailable, accumulated_23h: RadarContentAvailable, accumulated_24h: RadarContentAvailable, fir_preciptype: RadarContentAvailable, lx_reflectivity: RadarContentAvailable, preciptype: RadarContentAvailable, reflectivity: RadarContentAvailable)#
A dataclass storing available options for various radar types.
- accumulated_01h: RadarContentAvailable#
- accumulated_02h: RadarContentAvailable#
- accumulated_03h: RadarContentAvailable#
- accumulated_04h: RadarContentAvailable#
- accumulated_05h: RadarContentAvailable#
- accumulated_06h: RadarContentAvailable#
- accumulated_07h: RadarContentAvailable#
- accumulated_08h: RadarContentAvailable#
- accumulated_09h: RadarContentAvailable#
- accumulated_10h: RadarContentAvailable#
- accumulated_11h: RadarContentAvailable#
- accumulated_12h: RadarContentAvailable#
- accumulated_13h: RadarContentAvailable#
- accumulated_14h: RadarContentAvailable#
- accumulated_15h: RadarContentAvailable#
- accumulated_16h: RadarContentAvailable#
- accumulated_17h: RadarContentAvailable#
- accumulated_18h: RadarContentAvailable#
- accumulated_19h: RadarContentAvailable#
- accumulated_20h: RadarContentAvailable#
- accumulated_21h: RadarContentAvailable#
- accumulated_22h: RadarContentAvailable#
- accumulated_23h: RadarContentAvailable#
- accumulated_24h: RadarContentAvailable#
- fir_preciptype: RadarContentAvailable#
- five_level_reflectivity: RadarContentAvailable#
- lx_reflectivity: RadarContentAvailable#
- preciptype: RadarContentAvailable#
- reflectivity: RadarContentAvailable#
- class yr_weather.data.radar.RadarStatus(area: str, due_date: str | None, fault_code: Literal['PS', 'VP', 'CO', 'TE'] | None, last: str, products: List[Literal['central_norway', 'eastern_norway', 'finnmark', 'nordic', 'nordland', 'northern_nordland', 'northwestern_norway', 'norway', 'southeastern_norway', 'southern_nordland', 'southern_norway', 'southwestern_norway', 'troms', 'western_norway', 'xband']], sitename: str, stability: str)#
A dataclass storing a radar status.
- class yr_weather.data.radar.RadarGlobalStatus(last_update: str, radars: List[RadarStatus])#
A dataclass storing statuses for all radars.
- radars: List[RadarStatus]#