simple-dwd-weatherforecast 2.1.11__py3-none-any.whl → 2.1.14__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.
- simple_dwd_weatherforecast/dwdforecast.py +6 -2
- simple_dwd_weatherforecast/dwdmap.py +28 -1
- {simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/METADATA +17 -9
- {simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/RECORD +7 -7
- {simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/WHEEL +1 -1
- {simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/LICENCE +0 -0
- {simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/top_level.txt +0 -0
@@ -757,9 +757,13 @@ class Weather:
|
|
757
757
|
return issue_time_new
|
758
758
|
|
759
759
|
def parse_station_name(self, tree):
|
760
|
-
|
760
|
+
parsed_name = tree.xpath(
|
761
761
|
"./kml:Document/kml:Placemark/kml:description", namespaces=self.namespaces
|
762
|
-
)
|
762
|
+
)
|
763
|
+
if len(parsed_name) == 0:
|
764
|
+
return None
|
765
|
+
else:
|
766
|
+
return parsed_name[0].text
|
763
767
|
|
764
768
|
def parse_timesteps(self, tree):
|
765
769
|
return [
|
@@ -89,6 +89,7 @@ def get_from_location(
|
|
89
89
|
image_width=520,
|
90
90
|
image_height=580,
|
91
91
|
markers: list[Marker] = [],
|
92
|
+
dark_mode: bool = False,
|
92
93
|
):
|
93
94
|
if radius_km <= 0:
|
94
95
|
raise ValueError("Radius must be greater than 0")
|
@@ -107,6 +108,7 @@ def get_from_location(
|
|
107
108
|
image_width,
|
108
109
|
image_height,
|
109
110
|
markers,
|
111
|
+
dark_mode,
|
110
112
|
)
|
111
113
|
|
112
114
|
|
@@ -116,6 +118,7 @@ def get_germany(
|
|
116
118
|
image_width=520,
|
117
119
|
image_height=580,
|
118
120
|
markers: list[Marker] = [],
|
121
|
+
dark_mode: bool = False,
|
119
122
|
):
|
120
123
|
return get_map(
|
121
124
|
germany_boundaries.minx,
|
@@ -127,6 +130,7 @@ def get_germany(
|
|
127
130
|
image_width,
|
128
131
|
image_height,
|
129
132
|
markers,
|
133
|
+
dark_mode,
|
130
134
|
)
|
131
135
|
|
132
136
|
|
@@ -140,6 +144,7 @@ def get_map(
|
|
140
144
|
image_width=520,
|
141
145
|
image_height=580,
|
142
146
|
markers: list[Marker] = [],
|
147
|
+
dark_mode: bool = False,
|
143
148
|
):
|
144
149
|
if image_width > 1200 or image_height > 1400:
|
145
150
|
raise ValueError(
|
@@ -157,6 +162,16 @@ def get_map(
|
|
157
162
|
request = requests.get(url, stream=True)
|
158
163
|
if request.status_code == 200:
|
159
164
|
image = Image.open(BytesIO(request.content))
|
165
|
+
if dark_mode:
|
166
|
+
new_image_data = []
|
167
|
+
for item in image.getdata(): # type: ignore
|
168
|
+
if item[0] == 255 and item[1] == 255 and item[2] == 255:
|
169
|
+
new_image_data.append((0, 0, 0))
|
170
|
+
else:
|
171
|
+
new_image_data.append(item)
|
172
|
+
|
173
|
+
# update image data
|
174
|
+
image.putdata(new_image_data)
|
160
175
|
image = draw_marker(image, ImageBoundaries(minx, maxx, miny, maxy), markers)
|
161
176
|
return image
|
162
177
|
|
@@ -186,6 +201,7 @@ class ImageLoop:
|
|
186
201
|
image_width: int = 520,
|
187
202
|
image_height: int = 580,
|
188
203
|
markers: list[Marker] = [],
|
204
|
+
dark_mode: bool = False,
|
189
205
|
):
|
190
206
|
if image_width > 1200 or image_height > 1400:
|
191
207
|
raise ValueError(
|
@@ -203,6 +219,7 @@ class ImageLoop:
|
|
203
219
|
self._image_width = image_width
|
204
220
|
self._image_height = image_height
|
205
221
|
self.markers = markers
|
222
|
+
self.dark_mode = dark_mode
|
206
223
|
self._images = deque([], steps)
|
207
224
|
|
208
225
|
self._full_reload()
|
@@ -246,11 +263,21 @@ class ImageLoop:
|
|
246
263
|
layers = f"{self._background_type.value}, {self._map_type.value}"
|
247
264
|
else:
|
248
265
|
layers = f"{self._map_type.value}, {self._background_type.value}"
|
249
|
-
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(
|
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')}"
|
250
267
|
request = requests.get(url, stream=True)
|
251
268
|
if request.status_code != 200:
|
252
269
|
raise ConnectionError("Error during image request from DWD servers")
|
253
270
|
image = Image.open(BytesIO(request.content))
|
271
|
+
if self.dark_mode:
|
272
|
+
new_image_data = []
|
273
|
+
for item in image.getdata(): # type: ignore
|
274
|
+
if item[0] == 255 and item[1] == 255 and item[2] == 255:
|
275
|
+
new_image_data.append((0, 0, 0))
|
276
|
+
else:
|
277
|
+
new_image_data.append(item)
|
278
|
+
|
279
|
+
# update image data
|
280
|
+
image.putdata(new_image_data)
|
254
281
|
image = draw_marker(
|
255
282
|
image,
|
256
283
|
ImageBoundaries(self._minx, self._maxx, self._miny, self._maxy),
|
{simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: simple_dwd_weatherforecast
|
3
|
-
Version: 2.1.
|
3
|
+
Version: 2.1.14
|
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
|
@@ -14,9 +14,17 @@ Requires-Dist: lxml
|
|
14
14
|
Requires-Dist: requests
|
15
15
|
Requires-Dist: Pillow
|
16
16
|
Requires-Dist: arrow
|
17
|
-
Requires-Dist: stream-inflate==0.0.
|
18
|
-
Requires-Dist: stream-unzip
|
17
|
+
Requires-Dist: stream-inflate==0.0.41
|
18
|
+
Requires-Dist: stream-unzip==0.0.98
|
19
19
|
Requires-Dist: httpx
|
20
|
+
Dynamic: author
|
21
|
+
Dynamic: classifier
|
22
|
+
Dynamic: description
|
23
|
+
Dynamic: description-content-type
|
24
|
+
Dynamic: home-page
|
25
|
+
Dynamic: requires-dist
|
26
|
+
Dynamic: requires-python
|
27
|
+
Dynamic: summary
|
20
28
|
|
21
29
|
# Simple DWD weather forecast
|
22
30
|
|
@@ -208,7 +216,7 @@ class MarkerShape(Enum):
|
|
208
216
|
CIRCLE = "circle"
|
209
217
|
SQUARE = "square"
|
210
218
|
CROSS = "cross"
|
211
|
-
|
219
|
+
|
212
220
|
class Marker(
|
213
221
|
latitude: float,
|
214
222
|
longitude: float,
|
@@ -218,11 +226,11 @@ class Marker(
|
|
218
226
|
width: int = 0,
|
219
227
|
)
|
220
228
|
|
221
|
-
get_from_location(longitude, latitude, radius_km, map_type: WeatherMapType, background_type: WeatherBackgroundMapType, optional integer image_width, optional integer image_height, optional markers: list[Marker]) #Returns map as pillow image with given radius from coordinates
|
229
|
+
get_from_location(longitude, latitude, radius_km, map_type: WeatherMapType, background_type: WeatherBackgroundMapType, optional integer image_width, optional integer image_height, optional markers: list[Marker], optional bool dark_mode) #Returns map as pillow image with given radius from coordinates
|
222
230
|
|
223
|
-
get_germany(map_type: WeatherMapType, optional WeatherBackgroundMapType background_type, optional integer image_width, optional integer image_height, optional markers: list[Marker]) #Returns map as pillow image of whole germany
|
231
|
+
get_germany(map_type: WeatherMapType, optional WeatherBackgroundMapType background_type, optional integer image_width, optional integer image_height, optional markers: list[Marker], optional bool dark_mode) #Returns map as pillow image of whole germany
|
224
232
|
|
225
|
-
get_map(minx,miny,maxx,maxy, map_type: WeatherMapType, background_type: WeatherBackgroundMapType, optional integer image_width, optional integer image_height, optional markers: list[Marker]) #Returns map as pillow image
|
233
|
+
get_map(minx,miny,maxx,maxy, map_type: WeatherMapType, background_type: WeatherBackgroundMapType, optional integer image_width, optional integer image_height, optional markers: list[Marker], optional bool dark_mode) #Returns map as pillow image
|
226
234
|
```
|
227
235
|
|
228
236
|
|
@@ -254,7 +262,7 @@ for image in enumerate(maploop._images):
|
|
254
262
|
|
255
263
|
```python
|
256
264
|
ImageLoop(minx: float, miny: float, maxx: float, maxy: float, map_type: WeatherMapType, background_type: WeatherBackgroundMapType,
|
257
|
-
steps: int = 6, image_width: int = 520,image_height: int = 580, markers: list[Marker] = []) -> ImageLoop
|
265
|
+
steps: int = 6, image_width: int = 520,image_height: int = 580, markers: list[Marker] = [], optional bool dark_mode) -> ImageLoop
|
258
266
|
|
259
267
|
get_images() -> Iterable[ImageFile.ImageFile] # Returns the image loop
|
260
268
|
|
{simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/RECORD
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
simple_dwd_weatherforecast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
simple_dwd_weatherforecast/dwdforecast.py,sha256=
|
3
|
-
simple_dwd_weatherforecast/dwdmap.py,sha256=
|
2
|
+
simple_dwd_weatherforecast/dwdforecast.py,sha256=emM_zYQ0fOZhDIDz60yCXN8vCI3Nsp9VKq8tcOn3TZQ,38973
|
3
|
+
simple_dwd_weatherforecast/dwdmap.py,sha256=Ktokd5Yyj7FJKKlbJrqX8mj24v7IN_pLdY4rk6FbNUY,11894
|
4
4
|
simple_dwd_weatherforecast/stations.json,sha256=1u8qc2CT_rVy49SAlOicGixzHln6Y0FXevuFAz2maBw,838948
|
5
5
|
simple_dwd_weatherforecast/uv_stations.json,sha256=ADenYo-aR6qbf0UFkfYr72kkFzL9HyUKe4VQ23POGF8,2292
|
6
6
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -35,8 +35,8 @@ tests/test_update.py,sha256=AIzzHMxcjwQjeTB0l3YFgB7HkGDbuqiHofwy41mS0m4,7440
|
|
35
35
|
tests/test_update_hourly.py,sha256=7Zl8ml3FTdqw3_Qwr_Tz-sWTzypvrBWmxeig2Vwp_ZQ,1781
|
36
36
|
tests/test_uv_index.py,sha256=tr6wnOyHlXT1S3yp1oeHc4-Brmc-EMEdM4mtyrdpcHg,579
|
37
37
|
tests/test_weather.py,sha256=ZyX4ldUoJpJp7YpiNQwU6Od-nYRay-3qcaDJdNq8fhY,780
|
38
|
-
simple_dwd_weatherforecast-2.1.
|
39
|
-
simple_dwd_weatherforecast-2.1.
|
40
|
-
simple_dwd_weatherforecast-2.1.
|
41
|
-
simple_dwd_weatherforecast-2.1.
|
42
|
-
simple_dwd_weatherforecast-2.1.
|
38
|
+
simple_dwd_weatherforecast-2.1.14.dist-info/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
|
39
|
+
simple_dwd_weatherforecast-2.1.14.dist-info/METADATA,sha256=yOmvr1psI8zmU1eZstNMmOeEoc8w66wpig4Ljiv2nlY,12828
|
40
|
+
simple_dwd_weatherforecast-2.1.14.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
41
|
+
simple_dwd_weatherforecast-2.1.14.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
|
42
|
+
simple_dwd_weatherforecast-2.1.14.dist-info/RECORD,,
|
{simple_dwd_weatherforecast-2.1.11.dist-info → simple_dwd_weatherforecast-2.1.14.dist-info}/LICENCE
RENAMED
File without changes
|
File without changes
|