Replace default leaves with precipitation and procedural snowdrifts

This commit is contained in:
nyan404 committed 2026-11-24 16:50:24 +03:00
1 parent 2c17a52b5e
commit c85876f1db
13 files changed
+329 -83

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ from urllib.request import Request, urlopen
METAR_URL = "https://weather.nyan404.ru/api/v1/metar/raw/ulli"
FALLBACK = {"mode": "leaves", "intensity": 1, "wind_mps": 0.0}
FALLBACK = {"mode": "none", "intensity": 1, "wind_mps": 0.0}
_WIND = re.compile(r"(?:\d{3}|VRB)(\d{2,3})(?:G(\d{2,3}))?(MPS|KT|KMH)")
_WEATHER = re.compile(r"([+-]?)(?:MI|PR|BC|DR|BL|SH|TS|FZ)?(?:DZ|RA|SN|SG|IC|PL|GR|GS|UP|BR|FG|FU|VA|DU|SA|HZ|PY)+")
@@ -41,7 +41,7 @@ def parse_metar(raw: str) -> dict:
if weather[1] != "-" and any(code in token for code in ("SH", "TS", "BL")):
level = 3
result["intensity"] = max(result["intensity"], level)
result["mode"] = "mixed" if rain and snow else "snow" if snow else "rain" if rain else "leaves"
result["mode"] = "mixed" if rain and snow else "snow" if snow else "rain" if rain else "none"
return result