sondera.clients.smhi package

Submodules

sondera.clients.smhi.common module

sondera.clients.smhi.hydroobs module

Client for SMHI hydroobs open-data api Inherits from metobs

class sondera.clients.smhi.hydroobs.HydroObsClient[source]

Bases: MetObsClient

sondera.clients.smhi.metobs module

Client for SMHI metobs open-data api

class sondera.clients.smhi.metobs.MetObsClient[source]

Bases: object

get_all_stations()[source]
get_api_parameters(print_params=True)[source]

Return parameter information from API

get_observations(parameter: ParametersMetObs | int, station: int, period: str) DataSeries[source]

Get observations for a given parameter, station and period

Parameters:
  • parameter (Enum or int) – Description

  • station (int) – Description

  • period (str) – latest-hour, latest-day, latest-months or corrected-archive as supported directly by the SMHI api. In addition, ‘corrected-archive-latest-months’ can be passed, which is a combination of the two api calls. Note that all periods are not available for all stations/parameters.

Return type:

DataSeries object

get_parameters(parameter_ids: List[int] | None = None)[source]
get_parameters_station(station)[source]
get_periods()[source]
get_stations_parameter(parameter)[source]

sondera.clients.smhi.radar module

sondera.clients.smhi.smhistrang module

Client for SMHI Strång API https://opendata.smhi.se/apidocs/strang/

model data and not observation, so will not use the station and dataclasses simply return the data as either pd.Series or xarray https://opendata.smhi.se/apidocs/strang/get_points.html <– pandas.Series https://opendata.smhi.se/apidocs/strang/get_multipoint.html <– xarray (api returns the full field)

Todo: Multipoint

class sondera.clients.smhi.smhistrang.StrangClient[source]

Bases: object

get_data_multipoint()[source]
get_data_multipoint_period()[source]
get_data_point(parameter: ParametersStrang | int, lon: float, lat: float, date_from: Timestamp | datetime | str, date_to: Timestamp | datetime | str, agg_interval: str) Series[source]

Get Strång data for a single latitude-longitude coordinate.

Parameters:
  • parameter (int or ParametersStrang enum) – The parameter for the radiation data type.

  • lon (float) – Longitude in decimal degrees.

  • lat (float) – Latitude in decimal degrees.

  • date_from (str, datetime or pandas.Timestamp) – Retrieve data starting from this datetime.

  • date_to (str, datetime or pandas.Timestamp) – Retrieve data up to this datetime.

  • agg_interval (str) – Aggregation interval. Valid values are ‘hourly’, ‘daily’ and ‘monthly’.

Return type:

A pandas Series of values returned by Strång API

Notes

https://strang.smhi.se/

https://opendata.smhi.se/apidocs/strang/

Module contents