env-canada 0.11.2__tar.gz → 0.12.0__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 (24) hide show
  1. {env_canada-0.11.2/env_canada.egg-info → env_canada-0.12.0}/PKG-INFO +1 -3
  2. env_canada-0.12.0/env_canada/constants.py +1 -0
  3. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_aqhi.py +5 -3
  4. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_hydro.py +4 -2
  5. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_weather.py +36 -3
  6. {env_canada-0.11.2 → env_canada-0.12.0/env_canada.egg-info}/PKG-INFO +1 -3
  7. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada.egg-info/SOURCES.txt +10 -0
  8. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada.egg-info/requires.txt +0 -2
  9. {env_canada-0.11.2 → env_canada-0.12.0}/pyproject.toml +5 -3
  10. env_canada-0.11.2/env_canada/constants.py +0 -1
  11. {env_canada-0.11.2 → env_canada-0.12.0}/LICENSE +0 -0
  12. {env_canada-0.11.2 → env_canada-0.12.0}/MANIFEST.in +0 -0
  13. {env_canada-0.11.2 → env_canada-0.12.0}/README.md +0 -0
  14. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/10x20.pbm +0 -0
  15. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/10x20.pil +0 -0
  16. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/__init__.py +0 -0
  17. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_cache.py +0 -0
  18. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_exc.py +0 -0
  19. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_historical.py +0 -0
  20. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_map.py +0 -0
  21. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada/ec_radar.py +0 -0
  22. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada.egg-info/dependency_links.txt +0 -0
  23. {env_canada-0.11.2 → env_canada-0.12.0}/env_canada.egg-info/top_level.txt +0 -0
  24. {env_canada-0.11.2 → env_canada-0.12.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: env_canada
3
- Version: 0.11.2
3
+ Version: 0.12.0
4
4
  Summary: A package to access meteorological data from Environment Canada
5
5
  Author-email: Michael Davie <michael.davie@gmail.com>
6
6
  Maintainer-email: Michael Davie <michael.davie@gmail.com>
@@ -17,9 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: aiohttp>=3.9.0
19
19
  Requires-Dist: geopy>=2.3.0
20
- Requires-Dist: imageio>=2.28.0
21
20
  Requires-Dist: lxml>=5.3.0
22
- Requires-Dist: numpy>=1.22.2
23
21
  Requires-Dist: pandas>=2.2.3
24
22
  Requires-Dist: Pillow>=10.0.1
25
23
  Requires-Dist: python-dateutil>=2.9
@@ -0,0 +1 @@
1
+ USER_AGENT = "env_canada/0.12.0"
@@ -9,9 +9,11 @@ from lxml import etree as et
9
9
 
10
10
  from .constants import USER_AGENT
11
11
 
12
- AQHI_SITE_LIST_URL = "https://dd.weather.gc.ca/air_quality/doc/AQHI_XML_File_List.xml"
13
- AQHI_OBSERVATION_URL = "https://dd.weather.gc.ca/air_quality/aqhi/{}/observation/realtime/xml/AQ_OBS_{}_CURRENT.xml"
14
- AQHI_FORECAST_URL = "https://dd.weather.gc.ca/air_quality/aqhi/{}/forecast/realtime/xml/AQ_FCST_{}_CURRENT.xml"
12
+ AQHI_SITE_LIST_URL = (
13
+ "https://dd.weather.gc.ca/today/air_quality/doc/AQHI_XML_File_List.xml"
14
+ )
15
+ AQHI_OBSERVATION_URL = "https://dd.weather.gc.ca/today/air_quality/aqhi/{}/observation/realtime/xml/AQ_OBS_{}_CURRENT.xml"
16
+ AQHI_FORECAST_URL = "https://dd.weather.gc.ca/today/air_quality/aqhi/{}/forecast/realtime/xml/AQ_FCST_{}_CURRENT.xml"
15
17
 
16
18
  CLIENT_TIMEOUT = ClientTimeout(10)
17
19
 
@@ -8,8 +8,10 @@ from geopy import distance
8
8
 
9
9
  from .constants import USER_AGENT
10
10
 
11
- SITE_LIST_URL = "https://dd.weather.gc.ca/hydrometric/doc/hydrometric_StationList.csv"
12
- READINGS_URL = "https://dd.weather.gc.ca/hydrometric/csv/{prov}/hourly/{prov}_{station}_hourly_hydrometric.csv"
11
+ SITE_LIST_URL = (
12
+ "https://dd.weather.gc.ca/today/hydrometric/doc/hydrometric_StationList.csv"
13
+ )
14
+ READINGS_URL = "https://dd.weather.gc.ca/today/hydrometric/csv/{prov}/hourly/{prov}_{station}_hourly_hydrometric.csv"
13
15
 
14
16
 
15
17
  __all__ = ["ECHydro"]
@@ -21,9 +21,11 @@ from lxml.etree import _Element
21
21
  from . import ec_exc
22
22
  from .constants import USER_AGENT
23
23
 
24
- SITE_LIST_URL = "https://dd.weather.gc.ca/citypage_weather/docs/site_list_en.csv"
24
+ SITE_LIST_URL = (
25
+ "https://dd.weather.gc.ca/today/citypage_weather/docs/site_list_towns_en.csv"
26
+ )
25
27
 
26
- WEATHER_BASE_URL = "https://dd.weather.gc.ca/citypage_weather/{province}/{hour}/"
28
+ WEATHER_BASE_URL = "https://dd.weather.gc.ca/today/citypage_weather/{province}/{hour}/"
27
29
 
28
30
  CLIENT_TIMEOUT = ClientTimeout(10)
29
31
 
@@ -35,7 +37,7 @@ ATTRIBUTION = {
35
37
  }
36
38
 
37
39
 
38
- __all__ = ["ECWeather", "ECWeatherUpdateFailed"]
40
+ __all__ = ["ECWeather", "ECWeatherUpdateFailed", "get_ec_sites_list"]
39
41
 
40
42
 
41
43
  @dataclass
@@ -277,6 +279,37 @@ async def get_ec_sites():
277
279
  return sites
278
280
 
279
281
 
282
+ async def get_ec_sites_list():
283
+ """
284
+ Get list of sites formatted for selection dropdowns.
285
+
286
+ Returns a list of dictionaries with the form:
287
+ {"label": "Toronto, ON", "value": "458"}
288
+ where the value is the last three digits of the site code.
289
+ """
290
+ LOG.debug("get_ec_sites_list() started")
291
+ sites_list = []
292
+
293
+ async with ClientSession(raise_for_status=True) as session:
294
+ response = await session.get(
295
+ SITE_LIST_URL, headers={"User-Agent": USER_AGENT}, timeout=CLIENT_TIMEOUT
296
+ )
297
+ sites_csv_string = await response.text()
298
+
299
+ sites_reader = csv.DictReader(sites_csv_string.splitlines()[1:])
300
+
301
+ for site in sites_reader:
302
+ if site["Province Codes"] != "HEF":
303
+ # Extract last 3 digits from site code (e.g., "s0000106" -> "106")
304
+ site_value = site["Codes"][5:]
305
+ # Create label with city name and province (e.g., "Toronto, ON")
306
+ label = f"{site['English Names']}, {site['Province Codes']}"
307
+ sites_list.append({"label": label, "value": site_value})
308
+
309
+ LOG.debug("get_ec_sites_list() done, retrieved %d sites", len(sites_list))
310
+ return sites_list
311
+
312
+
280
313
  def find_province_for_station(site_list, station_number):
281
314
  """Find the province code for a given station number."""
282
315
  for site in site_list:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: env_canada
3
- Version: 0.11.2
3
+ Version: 0.12.0
4
4
  Summary: A package to access meteorological data from Environment Canada
5
5
  Author-email: Michael Davie <michael.davie@gmail.com>
6
6
  Maintainer-email: Michael Davie <michael.davie@gmail.com>
@@ -17,9 +17,7 @@ Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: aiohttp>=3.9.0
19
19
  Requires-Dist: geopy>=2.3.0
20
- Requires-Dist: imageio>=2.28.0
21
20
  Requires-Dist: lxml>=5.3.0
22
- Requires-Dist: numpy>=1.22.2
23
21
  Requires-Dist: pandas>=2.2.3
24
22
  Requires-Dist: Pillow>=10.0.1
25
23
  Requires-Dist: python-dateutil>=2.9
@@ -2,6 +2,16 @@ LICENSE
2
2
  MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
+ ./env_canada/__init__.py
6
+ ./env_canada/constants.py
7
+ ./env_canada/ec_aqhi.py
8
+ ./env_canada/ec_cache.py
9
+ ./env_canada/ec_exc.py
10
+ ./env_canada/ec_historical.py
11
+ ./env_canada/ec_hydro.py
12
+ ./env_canada/ec_map.py
13
+ ./env_canada/ec_radar.py
14
+ ./env_canada/ec_weather.py
5
15
  env_canada/10x20.pbm
6
16
  env_canada/10x20.pil
7
17
  env_canada/__init__.py
@@ -1,8 +1,6 @@
1
1
  aiohttp>=3.9.0
2
2
  geopy>=2.3.0
3
- imageio>=2.28.0
4
3
  lxml>=5.3.0
5
- numpy>=1.22.2
6
4
  pandas>=2.2.3
7
5
  Pillow>=10.0.1
8
6
  python-dateutil>=2.9
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
  [project]
6
6
  name = "env_canada"
7
7
  description="A package to access meteorological data from Environment Canada"
8
- version="0.11.2"
8
+ version="0.12.0"
9
9
  authors = [
10
10
  {name = "Michael Davie", email = "michael.davie@gmail.com"},
11
11
  ]
@@ -22,9 +22,7 @@ classifiers = [
22
22
  dependencies = [
23
23
  "aiohttp >=3.9.0",
24
24
  "geopy >= 2.3.0",
25
- "imageio >=2.28.0",
26
25
  "lxml >= 5.3.0",
27
- "numpy >=1.22.2",
28
26
  "pandas >=2.2.3",
29
27
  "Pillow >=10.0.1",
30
28
  "python-dateutil >= 2.9",
@@ -65,6 +63,10 @@ asyncio_default_fixture_loop_scope = "function"
65
63
 
66
64
  [tool.setuptools]
67
65
  include-package-data = true
66
+ packages = ["env_canada"]
67
+
68
+ [tool.setuptools.package-dir]
69
+ "" = "."
68
70
 
69
71
  [tool.ruff.lint]
70
72
  select = ["E4", "E7", "E9", "F", "B", "T201", "PD", "RUF", "ERA", "LOG", "G"]
@@ -1 +0,0 @@
1
- USER_AGENT = "env_canada/0.11.2"
File without changes
File without changes
File without changes
File without changes