env-canada 0.6.1__py3-none-any.whl → 0.6.2__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/__init__.py +5 -5
- env_canada/constants.py +1 -1
- env_canada/ec_radar.py +18 -12
- {env_canada-0.6.1.dist-info → env_canada-0.6.2.dist-info}/METADATA +7 -5
- {env_canada-0.6.1.dist-info → env_canada-0.6.2.dist-info}/RECORD +8 -8
- {env_canada-0.6.1.dist-info → env_canada-0.6.2.dist-info}/WHEEL +1 -1
- {env_canada-0.6.1.dist-info → env_canada-0.6.2.dist-info}/LICENSE +0 -0
- {env_canada-0.6.1.dist-info → env_canada-0.6.2.dist-info}/top_level.txt +0 -0
env_canada/__init__.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
from .ec_aqhi import
|
2
|
-
from .ec_historical import
|
3
|
-
from .ec_hydro import
|
4
|
-
from .ec_radar import
|
5
|
-
from .ec_weather import
|
1
|
+
from .ec_aqhi import ECAirQuality
|
2
|
+
from .ec_historical import ECHistorical, ECHistoricalRange
|
3
|
+
from .ec_hydro import ECHydro
|
4
|
+
from .ec_radar import ECRadar
|
5
|
+
from .ec_weather import ECWeather
|
env_canada/constants.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
USER_AGENT = "env_canada/0.6.
|
1
|
+
USER_AGENT = "env_canada/0.6.2"
|
env_canada/ec_radar.py
CHANGED
@@ -1,17 +1,18 @@
|
|
1
|
-
from aiohttp.client_exceptions import ClientConnectorError
|
2
1
|
import asyncio
|
3
2
|
import datetime
|
4
|
-
from io import BytesIO
|
5
3
|
import logging
|
6
4
|
import math
|
7
5
|
import os
|
8
|
-
from
|
6
|
+
from io import BytesIO
|
9
7
|
|
10
|
-
from .ec_cache import CacheClientSession as ClientSession
|
11
8
|
import dateutil.parser
|
12
9
|
import defusedxml.ElementTree as et
|
13
10
|
import imageio.v2 as imageio
|
14
11
|
import voluptuous as vol
|
12
|
+
from aiohttp.client_exceptions import ClientConnectorError
|
13
|
+
from PIL import Image, ImageDraw, ImageFont
|
14
|
+
|
15
|
+
from .ec_cache import CacheClientSession as ClientSession
|
15
16
|
|
16
17
|
ATTRIBUTION = {
|
17
18
|
"english": "Data provided by Environment Canada",
|
@@ -331,6 +332,17 @@ class ECRadar(object):
|
|
331
332
|
async def get_loop(self, fps=5):
|
332
333
|
"""Build an animated GIF of recent radar images."""
|
333
334
|
|
335
|
+
def build_image():
|
336
|
+
gif_frames = [imageio.imread(f, mode="RGBA") for f in frames]
|
337
|
+
gif_bytes = imageio.mimwrite(
|
338
|
+
imageio.RETURN_BYTES,
|
339
|
+
gif_frames,
|
340
|
+
format="GIF",
|
341
|
+
duration=duration,
|
342
|
+
subrectangles=True,
|
343
|
+
)
|
344
|
+
return gif_bytes
|
345
|
+
|
334
346
|
"""Build list of frame timestamps."""
|
335
347
|
start, end = await self._get_dimensions()
|
336
348
|
frame_times = [start]
|
@@ -361,12 +373,6 @@ class ECRadar(object):
|
|
361
373
|
"""Assemble animated GIF."""
|
362
374
|
duration = 1000 / fps
|
363
375
|
|
364
|
-
|
365
|
-
gif_bytes =
|
366
|
-
imageio.RETURN_BYTES,
|
367
|
-
gif_frames,
|
368
|
-
format="GIF",
|
369
|
-
duration=duration,
|
370
|
-
subrectangles=True,
|
371
|
-
)
|
376
|
+
loop = asyncio.get_running_loop()
|
377
|
+
gif_bytes = await loop.run_in_executor(None, build_image)
|
372
378
|
return gif_bytes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
|
-
Name:
|
3
|
-
Version: 0.6.
|
2
|
+
Name: env_canada
|
3
|
+
Version: 0.6.2
|
4
4
|
Summary: A package to access meteorological data from Environment Canada
|
5
5
|
Home-page: https://github.com/michaeldavie/env_canada
|
6
6
|
Author: Michael Davie
|
@@ -25,7 +25,7 @@ Requires-Dist: voluptuous
|
|
25
25
|
# Environment Canada (env_canada)
|
26
26
|
|
27
27
|
[](https://badge.fury.io/py/env-canada)
|
28
|
-
[](https://snyk.io/vuln/pip:env-canada@0.6.
|
28
|
+
[](https://snyk.io/vuln/pip:env-canada@0.6.2?utm_source=badge)
|
29
29
|
|
30
30
|
This package provides access to various data sources published by [Environment and Climate Change Canada](https://www.canada.ca/en/environment-climate-change.html).
|
31
31
|
|
@@ -116,7 +116,8 @@ Once updated asynchronously, historical weather data is contained with the `stat
|
|
116
116
|
```python
|
117
117
|
import asyncio
|
118
118
|
|
119
|
-
from env_canada import ECHistorical
|
119
|
+
from env_canada import ECHistorical
|
120
|
+
from env_canada.ec_historical import get_historical_stations
|
120
121
|
|
121
122
|
# search for stations, response contains station_ids
|
122
123
|
coordinates = [53.916944, -122.749444] # [lat, long]
|
@@ -165,7 +166,8 @@ For example :
|
|
165
166
|
```python
|
166
167
|
import pandas as pd
|
167
168
|
import asyncio
|
168
|
-
from env_canada import ECHistoricalRange
|
169
|
+
from env_canada import ECHistoricalRange
|
170
|
+
from env_canada.ec_historical import get_historical_stations
|
169
171
|
from datetime import datetime
|
170
172
|
|
171
173
|
coordinates = ['48.508333', '-68.467667']
|
@@ -1,16 +1,16 @@
|
|
1
1
|
env_canada/10x20.pbm,sha256=ClKTs2WUmhUhTHAQzPuGwPTICGVBzCvos5l-vHRBE5M,2463
|
2
2
|
env_canada/10x20.pil,sha256=Oki6-TD7b0xFtfm6vxCKsmpEpsZ5Jaia_0v_aDz8bfE,5143
|
3
|
-
env_canada/__init__.py,sha256=
|
4
|
-
env_canada/constants.py,sha256=
|
3
|
+
env_canada/__init__.py,sha256=wEx1BCwVUH__GoosSlhNMHuUKCKNZAvv5uuSa5ZWq_g,187
|
4
|
+
env_canada/constants.py,sha256=aVL9KzeCGoOZ2odaGXcKNqcxHZRamfD0CLXSFmyoZSM,32
|
5
5
|
env_canada/ec_aqhi.py,sha256=kJQ8xEgFnujGMYdxRXpoEK17B5e-ya-Y7rK0vLo_-w0,7768
|
6
6
|
env_canada/ec_cache.py,sha256=qoFxmO-kOBT8jhgPeNWtVBRmguXcARIIOI54OaDh-20,1171
|
7
7
|
env_canada/ec_exc.py,sha256=SBJwzmLf94lTx7KYVLfQYrMXYNYUoIxeVXc-BLkuXoE,67
|
8
8
|
env_canada/ec_historical.py,sha256=slHaFwsoyW16uCVtE3_-IF3_BFhFD4IuWl7rpIRsCm4,15901
|
9
9
|
env_canada/ec_hydro.py,sha256=LBsWreTlaTKec6ObjI0ih8-zOKBNjD02oiXKTyUa1EQ,4898
|
10
|
-
env_canada/ec_radar.py,sha256=
|
10
|
+
env_canada/ec_radar.py,sha256=TPzIlzwkgnsCSbN9Isdo_Q-1ORemNdYEBCcKfl_-ZcE,12415
|
11
11
|
env_canada/ec_weather.py,sha256=uBY6qd0-hVyZDhqPcpipfMDImXpJGiNIzMOjIzqNBfo,17358
|
12
|
-
env_canada-0.6.
|
13
|
-
env_canada-0.6.
|
14
|
-
env_canada-0.6.
|
15
|
-
env_canada-0.6.
|
16
|
-
env_canada-0.6.
|
12
|
+
env_canada-0.6.2.dist-info/LICENSE,sha256=c037dTHQWAgRgDqZNN-5d-CZvcteSYN37u39SNklO0I,1072
|
13
|
+
env_canada-0.6.2.dist-info/METADATA,sha256=0-49I2ZCrOoguMf9YnoCrmV3I0eR_Pn-l2_Rvvkpwxw,10652
|
14
|
+
env_canada-0.6.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
15
|
+
env_canada-0.6.2.dist-info/top_level.txt,sha256=fw7Pcl9ULBXYvqnAdyBdmwPXW8GSRFmhO0sLZWVfOCc,11
|
16
|
+
env_canada-0.6.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|