env-canada 0.11.2__py3-none-any.whl → 0.12.0__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.
- env_canada/constants.py +1 -1
- env_canada/ec_aqhi.py +5 -3
- env_canada/ec_hydro.py +4 -2
- env_canada/ec_weather.py +36 -3
- {env_canada-0.11.2.dist-info → env_canada-0.12.0.dist-info}/METADATA +1 -3
- env_canada-0.12.0.dist-info/RECORD +15 -0
- env_canada/10x20.pbm +0 -0
- env_canada/10x20.pil +0 -0
- env_canada-0.11.2.dist-info/RECORD +0 -17
- {env_canada-0.11.2.dist-info → env_canada-0.12.0.dist-info}/WHEEL +0 -0
- {env_canada-0.11.2.dist-info → env_canada-0.12.0.dist-info}/licenses/LICENSE +0 -0
- {env_canada-0.11.2.dist-info → env_canada-0.12.0.dist-info}/top_level.txt +0 -0
env_canada/constants.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
USER_AGENT = "env_canada/0.
|
1
|
+
USER_AGENT = "env_canada/0.12.0"
|
env_canada/ec_aqhi.py
CHANGED
@@ -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 =
|
13
|
-
|
14
|
-
|
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
|
|
env_canada/ec_hydro.py
CHANGED
@@ -8,8 +8,10 @@ from geopy import distance
|
|
8
8
|
|
9
9
|
from .constants import USER_AGENT
|
10
10
|
|
11
|
-
SITE_LIST_URL =
|
12
|
-
|
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"]
|
env_canada/ec_weather.py
CHANGED
@@ -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 =
|
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.
|
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,15 @@
|
|
1
|
+
env_canada/__init__.py,sha256=EXzGEHwon-usFzLzuJeISKHlfJdV3DBa0_rR9b_XfvE,405
|
2
|
+
env_canada/constants.py,sha256=1OlE7zCUy4imLHpReP1va3SzbksbwGXFQNyQzwR9NCw,33
|
3
|
+
env_canada/ec_aqhi.py,sha256=bmgzq__b8ecvPGR_PAlDBa4uyA6OTVllikBVYwOefRc,8106
|
4
|
+
env_canada/ec_cache.py,sha256=zb3n79ul7hUTE0IohDfZbRBLY-siOHPjYzWldMbuPVk,798
|
5
|
+
env_canada/ec_exc.py,sha256=SBJwzmLf94lTx7KYVLfQYrMXYNYUoIxeVXc-BLkuXoE,67
|
6
|
+
env_canada/ec_historical.py,sha256=qMr4RE6vfNiNa_zFolQ0PQGraok8bQtIVjs_o6sJKD4,16276
|
7
|
+
env_canada/ec_hydro.py,sha256=HxfUsx43A6KBPdzNQs1-204UVstMXAyrpyj8h2B8Hlc,4909
|
8
|
+
env_canada/ec_map.py,sha256=HIyCZ8j9EbuLX3-YhvMKjYPiE2AH_behL6IaOXjXpaQ,15564
|
9
|
+
env_canada/ec_radar.py,sha256=dKZqWJyb66R2EJzAy4K7pii7vPK9FxDKmuW9vA1ADbw,3330
|
10
|
+
env_canada/ec_weather.py,sha256=VS25XdRhFiFnqd3IBemwoc8pXz29j7hyimmTKLxeoNo,24638
|
11
|
+
env_canada-0.12.0.dist-info/licenses/LICENSE,sha256=BkgGIGgy9sv-OsI7mRi9dIQ3Su0m4IbjpZlfxv8oBbM,1073
|
12
|
+
env_canada-0.12.0.dist-info/METADATA,sha256=33e5Bojm24UU2jY7-M7FVhZZS5PqlJaJx6HaNgmUIv4,13618
|
13
|
+
env_canada-0.12.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
14
|
+
env_canada-0.12.0.dist-info/top_level.txt,sha256=fw7Pcl9ULBXYvqnAdyBdmwPXW8GSRFmhO0sLZWVfOCc,11
|
15
|
+
env_canada-0.12.0.dist-info/RECORD,,
|
env_canada/10x20.pbm
DELETED
Binary file
|
env_canada/10x20.pil
DELETED
Binary file
|
@@ -1,17 +0,0 @@
|
|
1
|
-
env_canada/10x20.pbm,sha256=ClKTs2WUmhUhTHAQzPuGwPTICGVBzCvos5l-vHRBE5M,2463
|
2
|
-
env_canada/10x20.pil,sha256=Oki6-TD7b0xFtfm6vxCKsmpEpsZ5Jaia_0v_aDz8bfE,5143
|
3
|
-
env_canada/__init__.py,sha256=EXzGEHwon-usFzLzuJeISKHlfJdV3DBa0_rR9b_XfvE,405
|
4
|
-
env_canada/constants.py,sha256=pB3ld_VBSAL8c6LAUF0U2VgKhhkOmP7U6T5kLJvo938,33
|
5
|
-
env_canada/ec_aqhi.py,sha256=oE52qfk-AKbHdhTSl5RP3vsWL-50eMRCCRVy9RW-pP4,8080
|
6
|
-
env_canada/ec_cache.py,sha256=zb3n79ul7hUTE0IohDfZbRBLY-siOHPjYzWldMbuPVk,798
|
7
|
-
env_canada/ec_exc.py,sha256=SBJwzmLf94lTx7KYVLfQYrMXYNYUoIxeVXc-BLkuXoE,67
|
8
|
-
env_canada/ec_historical.py,sha256=qMr4RE6vfNiNa_zFolQ0PQGraok8bQtIVjs_o6sJKD4,16276
|
9
|
-
env_canada/ec_hydro.py,sha256=JoBe-QVV8GEeZXCNFscIs2R_spgkbxCZpLt7tL6-NUI,4889
|
10
|
-
env_canada/ec_map.py,sha256=HIyCZ8j9EbuLX3-YhvMKjYPiE2AH_behL6IaOXjXpaQ,15564
|
11
|
-
env_canada/ec_radar.py,sha256=dKZqWJyb66R2EJzAy4K7pii7vPK9FxDKmuW9vA1ADbw,3330
|
12
|
-
env_canada/ec_weather.py,sha256=pFcVKBbYKLj01ocjZmy8RiQaf7YVSQOo4id_BbZ7gds,23421
|
13
|
-
env_canada-0.11.2.dist-info/licenses/LICENSE,sha256=BkgGIGgy9sv-OsI7mRi9dIQ3Su0m4IbjpZlfxv8oBbM,1073
|
14
|
-
env_canada-0.11.2.dist-info/METADATA,sha256=uWS4H6dImil9koOPvBxkdSJKut2gmOzsqLwjIyE2sOc,13678
|
15
|
-
env_canada-0.11.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
16
|
-
env_canada-0.11.2.dist-info/top_level.txt,sha256=fw7Pcl9ULBXYvqnAdyBdmwPXW8GSRFmhO0sLZWVfOCc,11
|
17
|
-
env_canada-0.11.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|