mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 12:08:47 +00:00
Adding Probability of Precipitation to one-line output
This commit is contained in:
parent
af97d9672e
commit
a368b622c5
2 changed files with 12 additions and 0 deletions
|
@ -202,6 +202,7 @@ To specify your own custom output format, use the special `%`-notation:
|
|||
m Moonphase 🌑🌒🌓🌔🌕🌖🌗🌘,
|
||||
M Moonday,
|
||||
p precipitation (mm),
|
||||
o Probability of Precipitation,
|
||||
P pressure (hPa),
|
||||
```
|
||||
|
||||
|
|
|
@ -101,6 +101,16 @@ def render_precipitation(data, query):
|
|||
answer += 'mm'
|
||||
return answer
|
||||
|
||||
def render_precipitation_chance(data, query):
|
||||
"""
|
||||
precipitation chance (o)
|
||||
"""
|
||||
|
||||
answer = data.get('chanceofrain', '')
|
||||
if answer:
|
||||
answer += '%'
|
||||
return answer
|
||||
|
||||
def render_pressure(data, query):
|
||||
"""
|
||||
pressure (P)
|
||||
|
@ -189,6 +199,7 @@ FORMAT_SYMBOL = {
|
|||
'M': render_moonday,
|
||||
's': render_sunset,
|
||||
'p': render_precipitation,
|
||||
'o': render_precipitation_chance,
|
||||
'P': render_pressure,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue