meteo-lt-pkg 0.5.2__py3-none-any.whl → 0.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meteo_lt/models.py +2 -1
- meteo_lt/warnings.py +6 -9
- {meteo_lt_pkg-0.5.2.dist-info → meteo_lt_pkg-0.5.3.dist-info}/METADATA +11 -1
- meteo_lt_pkg-0.5.3.dist-info/RECORD +12 -0
- meteo_lt_pkg-0.5.2.dist-info/RECORD +0 -12
- {meteo_lt_pkg-0.5.2.dist-info → meteo_lt_pkg-0.5.3.dist-info}/WHEEL +0 -0
- {meteo_lt_pkg-0.5.2.dist-info → meteo_lt_pkg-0.5.3.dist-info}/licenses/LICENSE +0 -0
- {meteo_lt_pkg-0.5.2.dist-info → meteo_lt_pkg-0.5.3.dist-info}/top_level.txt +0 -0
meteo_lt/models.py
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field, fields
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any, Dict, List, Optional, Type
|
|
6
6
|
|
|
7
7
|
from .const import COUNTY_MUNICIPALITIES
|
|
8
8
|
|
|
@@ -60,6 +60,7 @@ class MeteoWarning:
|
|
|
60
60
|
category: str = "weather" # "weather" or "hydro"
|
|
61
61
|
start_time: Optional[str] = None
|
|
62
62
|
end_time: Optional[str] = None
|
|
63
|
+
instruction: Optional[str] = None
|
|
63
64
|
|
|
64
65
|
|
|
65
66
|
@dataclass
|
meteo_lt/warnings.py
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from datetime import datetime, timezone
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any, Dict, List, Literal, Optional
|
|
6
6
|
|
|
7
|
-
from .models import Forecast, MeteoWarning
|
|
8
|
-
from .const import COUNTY_MUNICIPALITIES, WARNINGS_URL, HYDRO_WARNINGS_URL
|
|
9
7
|
from .client import MeteoLtClient
|
|
8
|
+
from .const import COUNTY_MUNICIPALITIES, HYDRO_WARNINGS_URL, WARNINGS_URL
|
|
9
|
+
from .models import Forecast, MeteoWarning
|
|
10
10
|
|
|
11
11
|
WarningCategory = Literal["weather", "hydro"]
|
|
12
12
|
|
|
@@ -77,20 +77,17 @@ class WarningsProcessor:
|
|
|
77
77
|
inst_dict = alert.get("instruction", {})
|
|
78
78
|
|
|
79
79
|
description = desc_dict.get("en") or desc_dict.get("lt", "")
|
|
80
|
-
instruction = inst_dict.get("en") or inst_dict.get("lt", "")
|
|
81
|
-
|
|
82
|
-
full_description = description
|
|
83
|
-
if instruction:
|
|
84
|
-
full_description += f"\n\nRecommendations: {instruction}"
|
|
80
|
+
instruction = inst_dict.get("en") or inst_dict.get("lt", "") or None
|
|
85
81
|
|
|
86
82
|
return MeteoWarning(
|
|
87
83
|
county=county,
|
|
88
84
|
warning_type=warning_type,
|
|
89
85
|
severity=severity,
|
|
90
|
-
description=
|
|
86
|
+
description=description,
|
|
91
87
|
category=self.category,
|
|
92
88
|
start_time=alert.get("t_from"),
|
|
93
89
|
end_time=alert.get("t_to"),
|
|
90
|
+
instruction=instruction,
|
|
94
91
|
)
|
|
95
92
|
|
|
96
93
|
def _warning_affects_area(self, warning: MeteoWarning, administrative_division: str) -> bool:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: meteo_lt-pkg
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
4
4
|
Summary: A library to fetch weather data from api.meteo.lt
|
|
5
5
|
Author-email: Brunas <brunonas@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/Brunas/meteo_lt-pkg
|
|
@@ -212,6 +212,8 @@ async def fetch_warnings():
|
|
|
212
212
|
print(f"Warning: {warning.warning_type} in {warning.county}")
|
|
213
213
|
print(f"Severity: {warning.severity}")
|
|
214
214
|
print(f"Description: {warning.description}")
|
|
215
|
+
if warning.instruction:
|
|
216
|
+
print(f"Instruction: {warning.instruction}")
|
|
215
217
|
print(f"Active: {warning.start_time} to {warning.end_time}")
|
|
216
218
|
print("-" * 50)
|
|
217
219
|
|
|
@@ -243,6 +245,8 @@ async def fetch_hydro_warnings():
|
|
|
243
245
|
print(f"Hydro Warning: {warning.warning_type} in {warning.county}")
|
|
244
246
|
print(f"Severity: {warning.severity}")
|
|
245
247
|
print(f"Description: {warning.description}")
|
|
248
|
+
if warning.instruction:
|
|
249
|
+
print(f"Instruction: {warning.instruction}")
|
|
246
250
|
print("-" * 50)
|
|
247
251
|
|
|
248
252
|
async def fetch_hydro_warnings_for_area():
|
|
@@ -270,6 +274,8 @@ async def fetch_all_warnings():
|
|
|
270
274
|
print(f"{warning.warning_type} in {warning.county}")
|
|
271
275
|
print(f"Severity: {warning.severity}")
|
|
272
276
|
print(f"Description: {warning.description}")
|
|
277
|
+
if warning.instruction:
|
|
278
|
+
print(f"Instruction: {warning.instruction}")
|
|
273
279
|
print("-" * 50)
|
|
274
280
|
|
|
275
281
|
async def fetch_all_warnings_for_area():
|
|
@@ -379,11 +385,14 @@ weather_warning = MeteoWarning(
|
|
|
379
385
|
warning_type="frost",
|
|
380
386
|
severity="Moderate",
|
|
381
387
|
description="Ground surface frost 0-5 degrees in many places",
|
|
388
|
+
instruction="Protect sensitive plants and be cautious on roads", # Optional safety instruction
|
|
382
389
|
category="weather",
|
|
383
390
|
start_time="2024-07-23T12:00:00Z",
|
|
384
391
|
end_time="2024-07-23T18:00:00Z"
|
|
385
392
|
)
|
|
386
393
|
print(f"Warning for {weather_warning.county}: {weather_warning.description}")
|
|
394
|
+
if weather_warning.instruction:
|
|
395
|
+
print(f"Safety instruction: {weather_warning.instruction}")
|
|
387
396
|
print(f"Category: {weather_warning.category}") # "weather" or "hydro"
|
|
388
397
|
|
|
389
398
|
# Hydrological warning example
|
|
@@ -392,6 +401,7 @@ hydro_warning = MeteoWarning(
|
|
|
392
401
|
warning_type="flood",
|
|
393
402
|
severity="High",
|
|
394
403
|
description="High water levels expected",
|
|
404
|
+
instruction="Avoid low-lying areas and do not attempt to cross flooded roads", # Optional
|
|
395
405
|
category="hydro",
|
|
396
406
|
start_time="2024-07-23T12:00:00Z",
|
|
397
407
|
end_time="2024-07-24T12:00:00Z"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
meteo_lt/__init__.py,sha256=3Ef5fihtzaxsRcygINTnNdQI9W_9JULe6ycyeRw8bN8,452
|
|
2
|
+
meteo_lt/api.py,sha256=GQDhDnTj3cx1hokt5188NnGz8FVDJHJDJXGm_fXxop8,5069
|
|
3
|
+
meteo_lt/client.py,sha256=R4lfX9_m-x7Va7IcU6d3rxAE0plOg2gD4NJ9gqtIVvg,5189
|
|
4
|
+
meteo_lt/const.py,sha256=w0eEOss0YbTJzNdpfocrd5DZ7pFSwR3aQ-uMfNttvag,2791
|
|
5
|
+
meteo_lt/models.py,sha256=ENQmWFZMQmXhHIddoAuC7givYbXIlu58v_pI8iACR4o,6143
|
|
6
|
+
meteo_lt/utils.py,sha256=VhXWnqfeBdKrncrsIrSwzsiN3Sg4-kDG5v6Yz-PBOLc,1281
|
|
7
|
+
meteo_lt/warnings.py,sha256=aD28RAlD-6vQdnJHNNkDBW3QkP23Dt0mgJ97A3iWRqo,7101
|
|
8
|
+
meteo_lt_pkg-0.5.3.dist-info/licenses/LICENSE,sha256=3IGi6xn6NUdXGvcdwD0MUbhy3Yz5NRnUjJrwKanFAD4,1073
|
|
9
|
+
meteo_lt_pkg-0.5.3.dist-info/METADATA,sha256=vmWdE8zOaWpCtTWRpKOBvPojy6Ru3RThzzjTqC55ZE4,18261
|
|
10
|
+
meteo_lt_pkg-0.5.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
meteo_lt_pkg-0.5.3.dist-info/top_level.txt,sha256=-aEdc9FzHhcIH4_0TNdKNxuvDnS3chKoJy6LK9Ud-G4,9
|
|
12
|
+
meteo_lt_pkg-0.5.3.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
meteo_lt/__init__.py,sha256=3Ef5fihtzaxsRcygINTnNdQI9W_9JULe6ycyeRw8bN8,452
|
|
2
|
-
meteo_lt/api.py,sha256=GQDhDnTj3cx1hokt5188NnGz8FVDJHJDJXGm_fXxop8,5069
|
|
3
|
-
meteo_lt/client.py,sha256=R4lfX9_m-x7Va7IcU6d3rxAE0plOg2gD4NJ9gqtIVvg,5189
|
|
4
|
-
meteo_lt/const.py,sha256=w0eEOss0YbTJzNdpfocrd5DZ7pFSwR3aQ-uMfNttvag,2791
|
|
5
|
-
meteo_lt/models.py,sha256=aUF2K99bxKaLw9bRQkVkM18z44AvhmcvqmtzHXuQnkc,6105
|
|
6
|
-
meteo_lt/utils.py,sha256=VhXWnqfeBdKrncrsIrSwzsiN3Sg4-kDG5v6Yz-PBOLc,1281
|
|
7
|
-
meteo_lt/warnings.py,sha256=XKMCO45_AGjBfXD8NxyYXIel1w1Rm3OP8lkE_tnNKq0,7195
|
|
8
|
-
meteo_lt_pkg-0.5.2.dist-info/licenses/LICENSE,sha256=3IGi6xn6NUdXGvcdwD0MUbhy3Yz5NRnUjJrwKanFAD4,1073
|
|
9
|
-
meteo_lt_pkg-0.5.2.dist-info/METADATA,sha256=P6z7698ZBbUnEiUC9YZxz4mVDRmsdwdKOoc9zpjt0vw,17679
|
|
10
|
-
meteo_lt_pkg-0.5.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
-
meteo_lt_pkg-0.5.2.dist-info/top_level.txt,sha256=-aEdc9FzHhcIH4_0TNdKNxuvDnS3chKoJy6LK9Ud-G4,9
|
|
12
|
-
meteo_lt_pkg-0.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|