simple-dwd-weatherforecast 2.1.14__tar.gz → 2.1.15__tar.gz

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.
Files changed (47) hide show
  1. {simple_dwd_weatherforecast-2.1.14/simple_dwd_weatherforecast.egg-info → simple_dwd_weatherforecast-2.1.15}/PKG-INFO +1 -1
  2. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/setup.py +1 -1
  3. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast/dwdmap.py +23 -8
  4. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15/simple_dwd_weatherforecast.egg-info}/PKG-INFO +1 -1
  5. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/LICENCE +0 -0
  6. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/README.md +0 -0
  7. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/setup.cfg +0 -0
  8. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast/__init__.py +0 -0
  9. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast/dwdforecast.py +0 -0
  10. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast/stations.json +0 -0
  11. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast/uv_stations.json +0 -0
  12. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast.egg-info/SOURCES.txt +0 -0
  13. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast.egg-info/dependency_links.txt +0 -0
  14. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast.egg-info/requires.txt +0 -0
  15. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/simple_dwd_weatherforecast.egg-info/top_level.txt +0 -0
  16. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/__init__.py +0 -0
  17. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/dummy_data.py +0 -0
  18. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/dummy_data_full.py +0 -0
  19. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/dummy_uv.py +0 -0
  20. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_daily_avg.py +0 -0
  21. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_daily_condition.py +0 -0
  22. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_daily_max.py +0 -0
  23. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_daily_min.py +0 -0
  24. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_daily_sum.py +0 -0
  25. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_day_values.py +0 -0
  26. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_forecast_condition.py +0 -0
  27. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_forecast_data.py +0 -0
  28. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_station_name.py +0 -0
  29. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_avg.py +0 -0
  30. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_condition.py +0 -0
  31. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_max.py +0 -0
  32. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_min.py +0 -0
  33. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_sum.py +0 -0
  34. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_get_timeframe_values.py +0 -0
  35. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_is_in_timerange.py +0 -0
  36. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_is_valid_timeframe.py +0 -0
  37. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_location_tools.py +0 -0
  38. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_map.py +0 -0
  39. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_parsekml.py +0 -0
  40. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_region.py +0 -0
  41. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_reported_weather.py +0 -0
  42. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_station.py +0 -0
  43. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_stationsfile.py +0 -0
  44. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_update.py +0 -0
  45. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_update_hourly.py +0 -0
  46. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_uv_index.py +0 -0
  47. {simple_dwd_weatherforecast-2.1.14 → simple_dwd_weatherforecast-2.1.15}/tests/test_weather.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simple_dwd_weatherforecast
3
- Version: 2.1.14
3
+ Version: 2.1.15
4
4
  Summary: A simple tool to retrieve a weather forecast from DWD OpenData
5
5
  Home-page: https://github.com/FL550/simple_dwd_weatherforecast.git
6
6
  Author: Max Fermor
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="simple_dwd_weatherforecast",
8
- version="v2.1.14",
8
+ version="v2.1.15",
9
9
  author="Max Fermor",
10
10
  description="A simple tool to retrieve a weather forecast from DWD OpenData",
11
11
  long_description=long_description,
@@ -9,7 +9,8 @@ from datetime import datetime, timedelta, timezone
9
9
 
10
10
 
11
11
  class WeatherMapType(Enum):
12
- NIEDERSCHLAGSRADAR = "dwd:Niederschlagsradar,dwd:NCEW_EU"
12
+ NIEDERSCHLAGSRADAR = "dwd:Niederschlagsradar"
13
+ BLITZSCHLAG = "dwd:NCEW_EU"
13
14
  MAXTEMP = "dwd:GefuehlteTempMax"
14
15
  UVINDEX = "dwd:UVI_CS"
15
16
  POLLENFLUG = "dwd:Pollenflug"
@@ -158,7 +159,7 @@ def get_map(
158
159
  layers = f"{background_type.value}, {map_type.value}"
159
160
  else:
160
161
  layers = f"{map_type.value}, {background_type.value}"
161
- url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.1.0&request=GetMap&layers={layers}&bbox={minx},{miny},{maxx},{maxy}&width={image_width}&height={image_height}&srs=EPSG:4326&styles=&format=image/png"
162
+ url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.1.1&request=GetMap&layers={layers}&bbox={minx},{miny},{maxx},{maxy}&width={image_width}&height={image_height}&srs=EPSG:4326&styles=&format=image/png"
162
163
  request = requests.get(url, stream=True)
163
164
  if request.status_code == 200:
164
165
  image = Image.open(BytesIO(request.content))
@@ -237,7 +238,13 @@ class ImageLoop:
237
238
 
238
239
  while now > self._last_update:
239
240
  self._last_update += timedelta(minutes=5)
240
- self._images.append(self._get_image(self._last_update))
241
+ # Lightning in the NCEW_EU layer is only available in the last 5 minutes
242
+ self._images.append(
243
+ self._get_image(
244
+ self._last_update,
245
+ with_lightning=(now - self._last_update) < timedelta(minutes=5),
246
+ )
247
+ )
241
248
 
242
249
  def update(self):
243
250
  now = get_time_last_5_min(datetime.now(timezone.utc))
@@ -249,23 +256,31 @@ class ImageLoop:
249
256
  else:
250
257
  while now > self._last_update:
251
258
  self._last_update += timedelta(minutes=5)
252
- self._images.append(self._get_image(self._last_update))
259
+ self._images.append(
260
+ self._get_image(self._last_update, with_lightning=True)
261
+ )
253
262
 
254
263
  def _get_image(
255
264
  self,
256
265
  date: datetime,
266
+ with_lightning: bool = False,
257
267
  ) -> ImageFile.ImageFile:
268
+ # Lightning in the NCEW_EU layer is only available in the last 5 minutes
269
+ layer = self._map_type.value
270
+ if with_lightning:
271
+ layer += ",dwd:NCEW_EU"
258
272
  if self._background_type in [
259
273
  WeatherBackgroundMapType.SATELLIT,
260
274
  WeatherBackgroundMapType.KREISE,
261
275
  WeatherBackgroundMapType.GEMEINDEN,
262
276
  ]:
263
- layers = f"{self._background_type.value}, {self._map_type.value}"
277
+ layers = f"{self._background_type.value}, {layer}"
264
278
  else:
265
- layers = f"{self._map_type.value}, {self._background_type.value}"
266
- url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.1.0&request=GetMap&layers={layers}&bbox={self._minx},{self._miny},{self._maxx},{self._maxy}&width={self._image_width}&height={self._image_height}&srs=EPSG:4326&styles=&format=image/png&TIME={date.strftime('%Y-%m-%dT%H:%M:00.0Z')}"
279
+ layers = f"{layer}, {self._background_type.value}"
280
+
281
+ url = f"https://maps.dwd.de/geoserver/dwd/wms?service=WMS&version=1.1.1&request=GetMap&layers={layers}&bbox={self._minx},{self._miny},{self._maxx},{self._maxy}&width={self._image_width}&height={self._image_height}&srs=EPSG:4326&styles=&format=image/png&TIME={date.strftime('%Y-%m-%dT%H:%M:00.0Z')}"
267
282
  request = requests.get(url, stream=True)
268
- if request.status_code != 200:
283
+ if request.status_code != 200 or request.headers["content-type"] != "image/png":
269
284
  raise ConnectionError("Error during image request from DWD servers")
270
285
  image = Image.open(BytesIO(request.content))
271
286
  if self.dark_mode:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: simple_dwd_weatherforecast
3
- Version: 2.1.14
3
+ Version: 2.1.15
4
4
  Summary: A simple tool to retrieve a weather forecast from DWD OpenData
5
5
  Home-page: https://github.com/FL550/simple_dwd_weatherforecast.git
6
6
  Author: Max Fermor