Weather

Implementations used for weather conditions and forecast.

searx.weather.symbol_url(condition: Literal['clear sky', 'cloudy', 'fair', 'fog', 'heavy rain and thunder', 'heavy rain showers and thunder', 'heavy rain showers', 'heavy rain', 'heavy sleet and thunder', 'heavy sleet showers and thunder', 'heavy sleet showers', 'heavy sleet', 'heavy snow and thunder', 'heavy snow showers and thunder', 'heavy snow showers', 'heavy snow', 'light rain and thunder', 'light rain showers and thunder', 'light rain showers', 'light rain', 'light sleet and thunder', 'light sleet showers and thunder', 'light sleet showers', 'light sleet', 'light snow and thunder', 'light snow showers and thunder', 'light snow showers', 'light snow', 'partly cloudy', 'rain and thunder', 'rain showers and thunder', 'rain showers', 'rain', 'sleet and thunder', 'sleet showers and thunder', 'sleet showers', 'sleet', 'snow and thunder', 'snow showers and thunder', 'snow showers', 'snow']) str | None[source]

Returns data: URL for the weather condition symbol or None if the condition is not of type WeatherConditionType.

If symbol (SVG) is not already in the WEATHER_DATA_CACHE its fetched from https://github.com/nrkno/yr-weather-symbols

class searx.weather.Temperature(value: float, unit: Units)[source]

Class for converting temperature units and for string representation of measured values.

Units

Supported temperature units.

alias of Literal[’°C’, ‘°F’, ‘K’]

l10n(unit: Units | None = None, locale: babel.Locale | GeoLocation | None = None, template: str = '{value} {unit}', num_pattern: str = '#,##0') str[source]

Localized representation of a measured value.

If the unit is not set, an attempt is made to determine a unit matching the territory of the locale. If the locale is not set, an attempt is made to determine it from the HTTP request.

The value is converted into the respective unit before formatting.

The argument num_pattern is used to determine the string formatting of the numerical value:

The argument template specifies how the string formatted value and unit are to be arranged.

  • Format Specification Mini-Language <https://docs.python.org/3/library/string.html#format-specification-mini-language>.

class searx.weather.Pressure(value: float, unit: Units)[source]

Class for converting pressure units and for string representation of measured values.

Units

Supported units.

alias of Literal[‘Pa’, ‘hPa’, ‘cm Hg’, ‘bar’]

class searx.weather.WindSpeed(value: float, unit: Units)[source]

Class for converting speed or velocity units and for string representation of measured values.

Hint

Working with unit Bft (searx.wikidata_units.Beaufort) will throw a ValueError for egative values or values greater 16 Bft (55.6 m/s)

Units

Supported units.

alias of Literal[‘m/s’, ‘km/h’, ‘kn’, ‘mph’, ‘mi/h’, ‘Bft’]

class searx.weather.RelativeHumidity(humidity: float)[source]

Amount of relative humidity in the air. The unit is %

Units

Supported unit.

alias of Literal[‘%’]

class searx.weather.Compass(azimuth: float | int | Point)[source]

Class for converting compass points and azimuth values (360°)

Point

Compass point type definition

alias of Literal[‘N’, ‘NNE’, ‘NE’, ‘ENE’, ‘E’, ‘ESE’, ‘SE’, ‘SSE’, ‘S’, ‘SSW’, ‘SW’, ‘WSW’, ‘W’, ‘WNW’, ‘NW’, ‘NNW’]

TURN = 360.0

Full turn (360°)

POINTS = ['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']

Compass points.

RANGE = 22.5

Angle sector of a compass point

classmethod point(azimuth: float | int) Point[source]

Returns the compass point to an azimuth value.

searx.weather.WeatherConditionType

Standardized designations for weather conditions. The designators were taken from a collaboration between NRK and Norwegian Meteorological Institute (yr.no). Weather symbols can be assigned to the identifiers (weathericons) and they are included in the translation (i18n/l10n git://searx/searxng.msg).

alias of Literal[‘clear sky’, ‘cloudy’, ‘fair’, ‘fog’, ‘heavy rain and thunder’, ‘heavy rain showers and thunder’, ‘heavy rain showers’, ‘heavy rain’, ‘heavy sleet and thunder’, ‘heavy sleet showers and thunder’, ‘heavy sleet showers’, ‘heavy sleet’, ‘heavy snow and thunder’, ‘heavy snow showers and thunder’, ‘heavy snow showers’, ‘heavy snow’, ‘light rain and thunder’, ‘light rain showers and thunder’, ‘light rain showers’, ‘light rain’, ‘light sleet and thunder’, ‘light sleet showers and thunder’, ‘light sleet showers’, ‘light sleet’, ‘light snow and thunder’, ‘light snow showers and thunder’, ‘light snow showers’, ‘light snow’, ‘partly cloudy’, ‘rain and thunder’, ‘rain showers and thunder’, ‘rain showers’, ‘rain’, ‘sleet and thunder’, ‘sleet showers and thunder’, ‘sleet showers’, ‘sleet’, ‘snow and thunder’, ‘snow showers and thunder’, ‘snow showers’, ‘snow’]

class searx.weather.DateTime(time: datetime)[source]

Class to represent date & time. Essentially, it is a wrapper that conveniently combines datetime.datetime and babel.dates.format_datetime. A conversion of time zones is not provided (in the current version).

l10n(fmt: Literal['full', 'long', 'medium', 'short'] | str = 'medium', locale: Locale | GeoLocation | None = None) str[source]

Localized representation of date & time.

class searx.weather.GeoLocation(name: str, latitude: float, longitude: float, elevation: float, country_code: str, timezone: str)[source]

Minimal implementation of Geocoding.

classmethod by_query(search_term: str) GeoLocation[source]

Factory method to get a GeoLocation object by a search term. If no location can be determined for the search term, a ValueError is thrown.