Skip to content

Commit

Permalink
Determine current and advance warnings based on urgency attribute (#1)
Browse files Browse the repository at this point in the history
According to their documentation [1], DWD sets the urgency to
"Immediate" for current warnings and to "Future" for advance warnings.
We should use this attribute to distinguish between current and advance
warnings.

[1] https://www.dwd.de/DE/leistungen/gds/help/warnungen/cap_dwd_profile_de_pdf.pdf?__blob=publicationFile&v=1
  • Loading branch information
Tho85 authored Sep 26, 2020
1 parent d7917d4 commit 8b29dae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dwdwfsapi/weatherwarnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def convert_warning_data(data_in):
data_out["description"] = data_in["description"]
if "instruction" in data_in:
data_out["instruction"] = data_in["instruction"]
if "urgency" in data_in:
data_out["urgency"] = data_in["urgency"]
if "severity" in data_in:
try:
if data_in["severity"].lower() in weather_severity_mapping:
Expand Down Expand Up @@ -292,8 +294,7 @@ def __parse_result(self, json_obj):
continue

if (
warning["start_time"] is not None
and warning["start_time"] < current_time
warning["urgency"] == "Immediate"
):
current_warnings.append(warning)
current_maxlevel = max(
Expand Down

0 comments on commit 8b29dae

Please sign in to comment.