mirror of
https://github.com/chubin/wttr.in
synced 2024-12-25 03:13:06 +00:00
pressure (P) and precipitation (p) (fixes #293)
This commit is contained in:
parent
83b1fd45f2
commit
9a72e04ec7
2 changed files with 24 additions and 0 deletions
|
@ -149,6 +149,8 @@ To specify your own custom output format, use the special `%`-notation:
|
||||||
l Location,
|
l Location,
|
||||||
m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘,
|
m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘,
|
||||||
M Moonday,
|
M Moonday,
|
||||||
|
p precipitation (mm),
|
||||||
|
P pressure (hPa),
|
||||||
```
|
```
|
||||||
|
|
||||||
So, these two calls are the same:
|
So, these two calls are the same:
|
||||||
|
|
|
@ -89,6 +89,26 @@ def render_humidity(data, query):
|
||||||
humidity += '%'
|
humidity += '%'
|
||||||
return humidity
|
return humidity
|
||||||
|
|
||||||
|
def render_precipitation(data, query):
|
||||||
|
"""
|
||||||
|
precipitation (p)
|
||||||
|
"""
|
||||||
|
|
||||||
|
answer = data.get('precipMM', '')
|
||||||
|
if answer:
|
||||||
|
answer += 'mm'
|
||||||
|
return answer
|
||||||
|
|
||||||
|
def render_pressure(data, query):
|
||||||
|
"""
|
||||||
|
pressure (P)
|
||||||
|
"""
|
||||||
|
|
||||||
|
answer = data.get('pressure', '')
|
||||||
|
if answer:
|
||||||
|
answer += 'hPa'
|
||||||
|
return answer
|
||||||
|
|
||||||
def render_wind(data, query):
|
def render_wind(data, query):
|
||||||
"""
|
"""
|
||||||
wind (w)
|
wind (w)
|
||||||
|
@ -166,6 +186,8 @@ FORMAT_SYMBOL = {
|
||||||
'm': render_moonphase,
|
'm': render_moonphase,
|
||||||
'M': render_moonday,
|
'M': render_moonday,
|
||||||
's': render_sunset,
|
's': render_sunset,
|
||||||
|
'p': render_precipitation,
|
||||||
|
'P': render_pressure,
|
||||||
}
|
}
|
||||||
|
|
||||||
def render_line(line, data, query):
|
def render_line(line, data, query):
|
||||||
|
|
Loading…
Reference in a new issue