.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.wikidata_units.Beaufort Class Reference

Public Member Functions

float from_si (cls, value)
 
float to_si (cls, value)
 

Static Public Attributes

list scale
 

Detailed Description

The mapping of the Beaufort_ contains values from 0 to 16 (55.6 m/s),
wind speeds greater than 200km/h (55.6 m/s) are given as 17 Bft. Thats why
a value of 17 Bft cannot be converted to SI.

.. hint::

   Negative values or values greater 16 Bft (55.6 m/s) will throw a
   :py:obj:`ValueError`.

_Beaufort: https://en.wikipedia.org/wiki/Beaufort_scale

Definition at line 18 of file wikidata_units.py.

Member Function Documentation

◆ from_si()

float searx.wikidata_units.Beaufort.from_si ( cls,
value )

Definition at line 41 of file wikidata_units.py.

41 def from_si(cls, value) -> float:
42 if value < 0 or value > 55.6:
43 raise ValueError(f"invalid value {value} / the Beaufort scales from 0 to 16 (55.6 m/s)")
44 bft = 0
45 for bft, mps in enumerate(cls.scale):
46 if mps >= value:
47 break
48 return bft
49

References scale.

◆ to_si()

float searx.wikidata_units.Beaufort.to_si ( cls,
value )

Definition at line 51 of file wikidata_units.py.

51 def to_si(cls, value) -> float:
52 idx = round(value)
53 if idx < 0 or idx > 16:
54 raise ValueError(f"invalid value {value} / the Beaufort scales from 0 to 16 (55.6 m/s)")
55 return cls.scale[idx]
56
57

References scale.

Member Data Documentation

◆ scale

searx.wikidata_units.Beaufort.scale
static
Initial value:
= [
0.2, 1.5, 3.3, 5.4, 7.9,
10.7, 13.8, 17.1, 20.7, 24.4,
28.4, 32.6, 32.7, 41.1, 45.8,
50.8, 55.6
]

Definition at line 32 of file wikidata_units.py.

Referenced by from_si(), and to_si().


The documentation for this class was generated from the following file: