env-canada 0.6.1__tar.gz → 0.6.2__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.
- {env_canada-0.6.1 → env_canada-0.6.2}/PKG-INFO +6 -4
- {env_canada-0.6.1 → env_canada-0.6.2}/README.md +5 -3
- env_canada-0.6.2/env_canada/__init__.py +5 -0
- env_canada-0.6.2/env_canada/constants.py +1 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_radar.py +18 -12
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada.egg-info/PKG-INFO +7 -5
- {env_canada-0.6.1 → env_canada-0.6.2}/setup.py +1 -1
- {env_canada-0.6.1 → env_canada-0.6.2}/tests/test_ec_weather.py +2 -10
- env_canada-0.6.1/env_canada/__init__.py +0 -5
- env_canada-0.6.1/env_canada/constants.py +0 -1
- {env_canada-0.6.1 → env_canada-0.6.2}/LICENSE +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/MANIFEST.in +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/10x20.pbm +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/10x20.pil +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_aqhi.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_cache.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_exc.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_historical.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_hydro.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada/ec_weather.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada.egg-info/SOURCES.txt +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada.egg-info/dependency_links.txt +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada.egg-info/requires.txt +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/env_canada.egg-info/top_level.txt +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/setup.cfg +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/tests/test_ec_aqhi.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/tests/test_ec_historical.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/tests/test_ec_hydro.py +0 -0
- {env_canada-0.6.1 → env_canada-0.6.2}/tests/test_ec_radar.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: env_canada
|
3
|
-
Version: 0.6.
|
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,7 +1,7 @@
|
|
1
1
|
# Environment Canada (env_canada)
|
2
2
|
|
3
3
|
[](https://badge.fury.io/py/env-canada)
|
4
|
-
[](https://snyk.io/vuln/pip:env-canada@0.6.
|
4
|
+
[](https://snyk.io/vuln/pip:env-canada@0.6.2?utm_source=badge)
|
5
5
|
|
6
6
|
This package provides access to various data sources published by [Environment and Climate Change Canada](https://www.canada.ca/en/environment-climate-change.html).
|
7
7
|
|
@@ -92,7 +92,8 @@ Once updated asynchronously, historical weather data is contained with the `stat
|
|
92
92
|
```python
|
93
93
|
import asyncio
|
94
94
|
|
95
|
-
from env_canada import ECHistorical
|
95
|
+
from env_canada import ECHistorical
|
96
|
+
from env_canada.ec_historical import get_historical_stations
|
96
97
|
|
97
98
|
# search for stations, response contains station_ids
|
98
99
|
coordinates = [53.916944, -122.749444] # [lat, long]
|
@@ -141,7 +142,8 @@ For example :
|
|
141
142
|
```python
|
142
143
|
import pandas as pd
|
143
144
|
import asyncio
|
144
|
-
from env_canada import ECHistoricalRange
|
145
|
+
from env_canada import ECHistoricalRange
|
146
|
+
from env_canada.ec_historical import get_historical_stations
|
145
147
|
from datetime import datetime
|
146
148
|
|
147
149
|
coordinates = ['48.508333', '-68.467667']
|
@@ -0,0 +1 @@
|
|
1
|
+
USER_AGENT = "env_canada/0.6.2"
|
@@ -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']
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="env_canada",
|
8
|
-
version="0.6.
|
8
|
+
version="0.6.2",
|
9
9
|
author="Michael Davie",
|
10
10
|
author_email="michael.davie@gmail.com",
|
11
11
|
description="A package to access meteorological data from Environment Canada",
|
@@ -17,20 +17,12 @@ def test_ecweather(init_parameters):
|
|
17
17
|
weather = ECWeather(**init_parameters)
|
18
18
|
assert isinstance(weather, ECWeather)
|
19
19
|
|
20
|
-
@pytest.fixture()
|
21
|
-
def no_conditions():
|
22
|
-
return ECWeather(station_id="ON/s0000773")
|
23
|
-
|
24
|
-
def test_update_no_conditions(no_conditions):
|
25
|
-
asyncio.run(no_conditions.update())
|
26
|
-
assert no_conditions.conditions == {}
|
27
|
-
assert no_conditions.daily_forecasts
|
28
|
-
assert no_conditions.hourly_forecasts
|
29
20
|
|
30
21
|
@pytest.fixture()
|
31
22
|
def with_conditions():
|
32
23
|
return ECWeather(station_id="ON/s0000430")
|
33
24
|
|
25
|
+
|
34
26
|
def test_update_with_conditions(with_conditions):
|
35
27
|
asyncio.run(with_conditions.update())
|
36
|
-
assert with_conditions.conditions
|
28
|
+
assert with_conditions.conditions
|
@@ -1 +0,0 @@
|
|
1
|
-
USER_AGENT = "env_canada/0.6.1"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|