simple-dwd-weatherforecast 2.1.3__py3-none-any.whl → 2.1.5__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.
@@ -111,6 +111,7 @@ class WeatherDataType(Enum):
111
111
  SUN_IRRADIANCE = ("Rad1h", "global_radiation_last_hour") # Unit: kJ/m^2
112
112
  FOG_PROBABILITY = ("wwM", "") # Unit: % (0..100)
113
113
  HUMIDITY = ("humidity", "relative_humidity") # Unit: %
114
+ EVAPORATION = ("PEvap", "evaporation") # Unit: kg/m2
114
115
 
115
116
 
116
117
  class Weather:
@@ -725,6 +726,7 @@ class Weather:
725
726
  WeatherDataType.SUN_DURATION,
726
727
  WeatherDataType.SUN_IRRADIANCE,
727
728
  WeatherDataType.FOG_PROBABILITY,
729
+ WeatherDataType.EVAPORATION,
728
730
  )
729
731
  ]
730
732
  values.extend(
@@ -951,21 +953,31 @@ class Weather:
951
953
  except Exception as error:
952
954
  print(f"Error in download_latest_kml: {type(error)} args: {error.args}")
953
955
 
954
- def get_chunks(self):
955
- def zipped_chunks():
956
+ def get_chunks(self, url):
957
+ def zipped_chunks(url):
956
958
  # Iterable that yields the bytes of a zip file
957
959
  with httpx.stream(
958
960
  "GET",
959
- "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_S/all_stations/kml/MOSMIX_S_LATEST_240.kmz",
961
+ url,
960
962
  ) as r:
961
- yield from r.iter_bytes(chunk_size=131072)
963
+ self.etags[url] = r.headers["etag"] # type: ignore
964
+ yield from r.iter_bytes(chunk_size=171072)
962
965
 
963
- return stream_unzip(zipped_chunks())
966
+ return stream_unzip(zipped_chunks(url))
964
967
 
965
968
  def download_large_kml(self, stationid):
966
969
  placemark = b""
970
+ url = "https://opendata.dwd.de/weather/local_forecasts/mos/MOSMIX_S/all_stations/kml/MOSMIX_S_LATEST_240.kmz"
971
+ # Check if content has updated
972
+ headers = {"If-None-Match": self.etags[url] if url in self.etags else ""} # type: ignore
973
+ r = httpx.head(
974
+ url,
975
+ headers=headers,
976
+ )
977
+ if r.status_code == 304:
978
+ return
967
979
 
968
- for file_name, file_size, unzipped_chunks in self.get_chunks():
980
+ for file_name, file_size, unzipped_chunks in self.get_chunks(url):
969
981
  chunk1 = b""
970
982
  chunk2 = b""
971
983
  first_chunk = None
@@ -988,9 +1000,12 @@ class Weather:
988
1000
  save_next_next = True
989
1001
  save_next = False
990
1002
 
991
- if stationid.encode() in chunk:
1003
+ if f"<kml:name>{stationid}</kml:name>".encode() in chunk:
992
1004
  chunk1 = chunk
993
1005
  save_next = True
1006
+
1007
+ if not chunk1:
1008
+ raise BufferError("Station not found")
994
1009
  if first_chunk:
995
1010
  start = placemark.find(b"<kml:Placemark>\n")
996
1011
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: simple_dwd_weatherforecast
3
- Version: 2.1.3
3
+ Version: 2.1.5
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
@@ -110,6 +110,7 @@ class WeatherDataType(Enum):
110
110
  SUN_IRRADIANCE = "Rad1h" # Unit: W/m2
111
111
  FOG_PROBABILITY = "wwM" # Unit: % (0..100)
112
112
  HUMIDITY = "humidity" # Unit: %
113
+ EVAPORATION = ("PEvap", "evaporation") # In the last 24h Unit: kg/m2
113
114
 
114
115
  class Weather:
115
116
 
@@ -1,18 +1,18 @@
1
1
  simple_dwd_weatherforecast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- simple_dwd_weatherforecast/dwdforecast.py,sha256=te_MIe6GzZ32UWrDTpbqJdHk0hFhs9dqN4h2rS3J-yA,38247
2
+ simple_dwd_weatherforecast/dwdforecast.py,sha256=klhL-Bd8u3Ybsq5JQTifMwlV67dF3foRTMGMfwVj5oE,38828
3
3
  simple_dwd_weatherforecast/dwdmap.py,sha256=cPCcL1u5qeIEDLBcL0qOH0-7dPIi3mge4-PUqfZlRQc,6737
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
7
- tests/dummy_data.py,sha256=sF8pXxq8innSpRc4lW0XxGcr34dESSAoBdAf2F2D4AI,63395
8
- tests/dummy_data_full.py,sha256=IwYoeqVX8cpfn_gE-7arXaWV9btRm_HHqka_LfKqW-E,64053
7
+ tests/dummy_data.py,sha256=qapeQxjh8kURf5b-9h4gUdJaqQJQDVdqfMtS2g5JReY,103406
8
+ tests/dummy_data_full.py,sha256=3HRGAQBq4xPYs4jLzoLV_UAe1CXFzOsVBOouDL_5RHw,104062
9
9
  tests/dummy_uv.py,sha256=TM1TwvNq_ea4WgIJyYsNAEXZJTx1dXH1ZVrW_LfLBLg,4548
10
10
  tests/test_get_daily_avg.py,sha256=MNd7u9Y7_E6SIyxg59EKfdKx4QJ7R_WT5wvRgm7Gzks,2315
11
11
  tests/test_get_daily_condition.py,sha256=9Qrhv14-vLnLz0N0FWG7Mv6_iEbNPqrHDDWWNQNydU0,2298
12
12
  tests/test_get_daily_max.py,sha256=schjGJDflg1YEQSdfRndw2NT4AvrVheSDveyVZrFySM,2220
13
13
  tests/test_get_daily_min.py,sha256=GzqlOfLdwLqGLYVeAJ0fbK1JRq-_fT7z6Gea74lSY7E,2224
14
14
  tests/test_get_daily_sum.py,sha256=UEntbPwGSleHocu0587WnuC5ijptQtzVNreR1d6yoM0,2221
15
- tests/test_get_day_values.py,sha256=KOMkp_bh_nqZIufP8F3PNmF3WqXnPLOn6LKHrSi3SMA,29310
15
+ tests/test_get_day_values.py,sha256=hDphH7fekfcWX7slJUF1QiH3B7te23nHiS5-Fro3HY4,31013
16
16
  tests/test_get_forecast_condition.py,sha256=YVapxXH5Svq5P7XvWn48n19hriQ1-7CSezuGc6DswJQ,2866
17
17
  tests/test_get_forecast_data.py,sha256=E1pIsgcWfQLgiVBMJ4URao3rBJgXebDWcPlV6FYZF-U,3394
18
18
  tests/test_get_station_name.py,sha256=S18TZCUrLSRUgAz7sJ66igC0X-9JX_7O3Yh9Z6-QHnQ,423
@@ -21,7 +21,7 @@ tests/test_get_timeframe_condition.py,sha256=9ED_Uyx6v4Gq6qQ5SQyWtS_fOkbbhExKzfG
21
21
  tests/test_get_timeframe_max.py,sha256=gas73o1Ferkk87M4Y3k4LZ-fXKehI2ulsxcQfIviDTs,2407
22
22
  tests/test_get_timeframe_min.py,sha256=WnFO36U_E-55TW7jR598lyLS4u-TOtXmufadJF7IWQs,2407
23
23
  tests/test_get_timeframe_sum.py,sha256=hjHY9fvJUqi4o8AdFLPSDwi8GpXtjzLqsRzVMoUVjn4,2424
24
- tests/test_get_timeframe_values.py,sha256=z8ozpWlyilw8-zjbk2gDExhTobNbgmcVTbZ6ZHjxAW4,6891
24
+ tests/test_get_timeframe_values.py,sha256=D9NJ98sZykLKAW1eZgLFuy0FMb4f_jUCtr4clzg65ms,7231
25
25
  tests/test_is_in_timerange.py,sha256=3y88L3N73NxSTJ-_edx6OCnxHWKJWWFma98gjZvJDGg,1338
26
26
  tests/test_is_valid_timeframe.py,sha256=mXjeu3lUyixiBUEljirTf6qDM_FZFQGWa-Rk0NBMUDU,891
27
27
  tests/test_location_tools.py,sha256=wto_XzVnARJQ-Qc83YAn0ahfMBSaOHpfzqAeKRDsNm8,1208
@@ -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.3.dist-info/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
39
- simple_dwd_weatherforecast-2.1.3.dist-info/METADATA,sha256=4OMLkaOyhaXOtfPDgoJa7viSn9JkCOxIdDwO6gr3DGg,12103
40
- simple_dwd_weatherforecast-2.1.3.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
41
- simple_dwd_weatherforecast-2.1.3.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
42
- simple_dwd_weatherforecast-2.1.3.dist-info/RECORD,,
38
+ simple_dwd_weatherforecast-2.1.5.dist-info/LICENCE,sha256=27UG7gteqvSWuZlsbIq2_OAbh7VyifGGl-1zpuUoBcw,1072
39
+ simple_dwd_weatherforecast-2.1.5.dist-info/METADATA,sha256=YAtr_r5aouZhkOGqfPYqbILWGKQIrZRAxORt0tUOc0s,12177
40
+ simple_dwd_weatherforecast-2.1.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
41
+ simple_dwd_weatherforecast-2.1.5.dist-info/top_level.txt,sha256=iyEobUh14Tzitx39Oi8qm0NhBrnZovl_dNKtvLUkLEM,33
42
+ simple_dwd_weatherforecast-2.1.5.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.2)
2
+ Generator: setuptools (75.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5