Skip to content

Commit

Permalink
Removes value replacement on hourly forecast
Browse files Browse the repository at this point in the history
  • Loading branch information
FL550 committed Oct 16, 2023
1 parent a66f98d commit 9d82988
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ There is also data available which is updated every hour by DWD. Be careful thou
- PRECIPITATION_PROBABILITY
- PRECIPITATION_DURATION

These values will be replaced by the 6 hour forecast.

You can use this data by using the optional parameter `force_hourly=True`.

```python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="simple_dwd_weatherforecast",
version="2.0.17",
version="2.0.18",
author="Max Fermor",
description="A simple tool to retrieve a weather forecast from DWD OpenData",
long_description=long_description,
Expand Down
13 changes: 0 additions & 13 deletions simple_dwd_weatherforecast/dwdforecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,7 @@ def update(
or (datetime.now(timezone.utc) - self.issue_time >= timedelta(hours=6))
or force_hourly
):
if force_hourly:
self.download_latest_kml(self.station_id)
temp_forecast_data = self.forecast_data
self.download_latest_kml(self.station_id, force_hourly)
if force_hourly:
for item in self.forecast_data:
if "wwP" in temp_forecast_data[item]:
self.forecast_data[item]["wwP"] = temp_forecast_data[item][
"wwP"
]
if "DRR1" in temp_forecast_data[item]:
self.forecast_data[item]["DRR1"] = temp_forecast_data[item][
"DRR1"
]

def get_weather_type(self, kmlTree, weatherDataType: WeatherDataType):
"""Parses the kml-File to the requested value and returns the items as array"""
Expand Down
14 changes: 0 additions & 14 deletions tests/test_update_hourly.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,3 @@ def test_issue_time_actual(self, mock_function, _):
self.dwd_weather.issue_time = datetime.now(timezone.utc)
self.dwd_weather.update()
mock_function.assert_not_called()

def test_replace_of_prec_probability_duration(self):
timestamp = datetime.now(timezone.utc) + timedelta(hours=1)
self.dwd_weather.update(force_hourly=True)
self.assertIsNotNone(
self.dwd_weather.get_forecast_data(
dwdforecast.WeatherDataType.PRECIPITATION_PROBABILITY, timestamp, shouldUpdate=False
)
)
self.assertIsNotNone(
self.dwd_weather.get_forecast_data(
dwdforecast.WeatherDataType.PRECIPITATION_DURATION, timestamp, shouldUpdate=False
)
)

0 comments on commit 9d82988

Please sign in to comment.