Weather
Implementations used for weather conditions and forecast.
searx.weather.symbol_url(condition: Literal['clear sky', 'partly cloudy', 'cloudy', 'fair', 'fog', 'light rain and thunder', 'light rain showers and thunder', 'light rain showers', 'light rain', 'rain and thunder', 'rain showers and thunder', 'rain showers', 'rain', 'heavy rain and thunder', 'heavy rain showers and thunder', 'heavy rain showers', 'heavy rain', 'light sleet and thunder', 'light sleet showers and thunder', 'light sleet showers', 'light sleet', 'sleet and thunder', 'sleet showers and thunder', 'sleet showers', 'sleet', 'heavy sleet and thunder', 'heavy sleet showers and thunder', 'heavy sleet showers', 'heavy sleet', 'light snow and thunder', 'light snow showers and thunder', 'light snow showers', 'light snow', 'snow and thunder', 'snow showers and thunder', 'snow showers', 'snow', 'heavy snow and thunder', 'heavy snow showers and thunder', 'heavy snow showers', 'heavy 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(*, val: float, unit: Literal['°C', '°F', 'K'])[source] : Class for converting temperature units and for string representation of measured values.
l10n(*unit: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['°C', '°F', 'K'] | [None](https://docs.python.org/3/builtins/constants.html#None) = None*, *locale: [Locale](https://babel.readthedocs.io/en/latest/api/core.html#babel.core.Locale) | [GeoLocation](#searx.weather.GeoLocation) | [None](https://docs.python.org/3/builtins/constants.html#None) = None*, *template: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = '{value} {unit}'*, *num\_pattern: [str](https://docs.python.org/3/builtins/stdtypes.html#str) = '#,##0'*) → [str](https://docs.python.org/3/builtins/stdtypes.html#str)[[source]](https://docs.searxng.org/_modules/searx/weather.html#Temperature.l10n)
: 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:
- <https://babel.pocoo.org/en/latest/numbers.html#pattern-syntax>
- <https://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns>
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(*, val: float, unit: Literal['Pa', 'hPa', 'cm Hg', 'bar'])[source] : Class for converting pressure units and for string representation of measured values.
class searx.weather.WindSpeed(*, val: float, unit: Literal['m/s', 'km/h', 'kn', 'mph', 'mi/h', 'Bft'])[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`](https://docs.python.org/3/builtins/exceptions.html#ValueError) for egative values or values greater 16 Bft
(55.6 m/s)
class searx.weather.RelativeHumidity(val: float)[source]
: Amount of relative humidity in the air. The unit is %
class searx.weather.Compass(val: float | int | Literal['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'], unit: Literal['°', 'Point'] = '°')[source] : Class for converting compass points and azimuth values (360°)
TURN: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[[float](https://docs.python.org/3/builtins/functions.html#float)] = 360.0
: Full turn (360°)
POINTS: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[[tuple](https://docs.python.org/3/builtins/stdtypes.html#tuple)[[Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW']]] = ('N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW')
: Compass points.
RANGE: [ClassVar](https://docs.python.org/3/library/typing.html#typing.ClassVar)[[float](https://docs.python.org/3/builtins/functions.html#float)] = 22.5
: Angle sector of a compass point
classmethod point(*azimuth: [float](https://docs.python.org/3/builtins/functions.html#float) | [int](https://docs.python.org/3/builtins/functions.html#int)*) → [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW'][[source]](https://docs.searxng.org/_modules/searx/weather.html#Compass.point)
: 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 ).
alias of [`Literal`](https://docs.python.org/3/library/typing.html#typing.Literal)[‘clear sky’, ‘partly cloudy’, ‘cloudy’, ‘fair’, ‘fog’, ‘light rain and thunder’, ‘light rain showers and thunder’, ‘light rain showers’, ‘light rain’, ‘rain and thunder’, ‘rain showers and thunder’, ‘rain showers’, ‘rain’, ‘heavy rain and thunder’, ‘heavy rain showers and thunder’, ‘heavy rain showers’, ‘heavy rain’, ‘light sleet and thunder’, ‘light sleet showers and thunder’, ‘light sleet showers’, ‘light sleet’, ‘sleet and thunder’, ‘sleet showers and thunder’, ‘sleet showers’, ‘sleet’, ‘heavy sleet and thunder’, ‘heavy sleet showers and thunder’, ‘heavy sleet showers’, ‘heavy sleet’, ‘light snow and thunder’, ‘light snow showers and thunder’, ‘light snow showers’, ‘light snow’, ‘snow and thunder’, ‘snow showers and thunder’, ‘snow showers’, ‘snow’, ‘heavy snow and thunder’, ‘heavy snow showers and thunder’, ‘heavy snow showers’, ‘heavy snow’]
class searx.weather.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).
The localized string representation can be obtained via the
[`DateTime.l10n`](#searx.weather.DateTime.l10n) and [`DateTime.l10n_date`](#searx.weather.DateTime.l10n_date) methods, where the
`locale` parameter defaults to the search language. Alternatively, a
[`GeoLocation`](#searx.weather.GeoLocation) or a `babel.Locale` instance can be passed
directly. If the UI language is to be used, the string `UI` can be passed
as the value for the `locale`.
l10n(*fmt: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['full', 'long', 'medium', 'short'] | [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'medium'*, *locale: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['UI'] | [Locale](https://babel.readthedocs.io/en/latest/api/core.html#babel.core.Locale) | [GeoLocation](#searx.weather.GeoLocation) | [None](https://docs.python.org/3/builtins/constants.html#None) = None*) → [str](https://docs.python.org/3/builtins/stdtypes.html#str)[[source]](https://docs.searxng.org/_modules/searx/weather.html#DateTime.l10n)
: Localized representation of date & time.
l10n\_date(*fmt: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['full', 'long', 'medium', 'short'] | [str](https://docs.python.org/3/builtins/stdtypes.html#str) = 'medium'*, *locale: [Literal](https://docs.python.org/3/library/typing.html#typing.Literal)['UI'] | [Locale](https://babel.readthedocs.io/en/latest/api/core.html#babel.core.Locale) | [GeoLocation](#searx.weather.GeoLocation) | [None](https://docs.python.org/3/builtins/constants.html#None) = None*) → [str](https://docs.python.org/3/builtins/stdtypes.html#str)[[source]](https://docs.searxng.org/_modules/searx/weather.html#DateTime.l10n_date)
: Localized representation of date.
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](https://docs.python.org/3/builtins/stdtypes.html#str)*) → [GeoLocation](#searx.weather.GeoLocation)[[source]](https://docs.searxng.org/_modules/searx/weather.html#GeoLocation.by_query)
: Factory method to get a GeoLocation object by a search term. If no
location can be determined for the search term, a [`ValueError`](https://docs.python.org/3/builtins/exceptions.html#ValueError)
is thrown.
Copyright © SearXNG team
Made with Furo
