Skip to content

Commit

Permalink
v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldavie committed Dec 19, 2023
1 parent 5048fc6 commit f53bd0b
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 18 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,153 +1,201 @@
# Changelog for `env_canada`

## v0.6.1

- Dependency updates

## v0.6.0

- Support weather stations without current conditions
- Fix sunrise and sunset conditions
- Switch radar URL to HTTPS

## v0.5.37

- Update dependencies

## v0.5.36

- Handle non-numeric hourly wind speed
- Set `imageio` dependency >= 2.28.0

## v0.5.35

- Add wind speed and direction to hourly forecasts
- Handle missing AQHI forecasts
- Fixes for dependency changes

## v0.5.34

- Fix radar GIF for latest `Pillow`

## v0.5.33

- Fix handling unexpected strings

## v0.5.32

- Generalize handling unexpected strings

## v0.5.31

- Handle wind speed of "calm" km/h

## v0.5.30

- Pin `numpy` version
- Update XML encoding

## v0.5.29

- Handle forecast temperatures of 0º

## v0.5.28

- Raise error on old weather data

## v0.5.27

- Change radar frame interval

## v0.5.26

- Add sunrise and sunset to weather
- Ignore bad hydrometric site data

## v0.5.25

- Add support for hourly historical data
- Add `pandas` dependency

## v0.5.24

- Add yesterday's low and high temperature

## v0.5.23

- Use `defusedxml` for XML parsing

## v0.5.22

- Refresh radar legend on layer change
- Automatically update radar layer

## v0.5.21

- Handle missing AQHI observations
- Add logging

## v0.5.20

- Add Mapbox as fallback map source

## v0.5.19

- Work around GeoGratis map service outage

## v0.5.18

- Add user agent

## v0.5.17

- Add caching of web requests to radar

## v0.5.16

- Make radar `precip_type` stable

## v0.5.15

- Exclude `tests` from build

## v0.5.14

- Change update in radar to save image
- Always get site data for weather so that lat/lon/station can be fully validated

## v0.5.13

- Change hydrometric URL for retrieving data
- Change weather data API back to "slow" servers -- fast servers not reliable

## v0.5.12

- Add attribution infomation available to radar and AQHI API
- Add French label in radar for snow/rain

## v0.5.11

- Add attribution infomation available to weather API

## v0.5.10

- Add normal_high and normal_low sensor values

## v0.5.9

- Save region and timestamp in AQHI for API users to retrieve

## v0.5.8

- Add error checking on bad XML when fetching weather

## v0.5.7

- Fix init issue on AQHI
- Add radar `update` for HA (alias of `get_loop()`)

## v0.5.6

- Improve auto snow/rain checking on radar

## v0.5.5

- Make `precip_type` a property of radar objects

## v0.5.4

- Bug fix radar `voluptuous`

## v0.5.3

- Check AQHI zone
- Allow `precip_type` of `None` meaning `auto` for radar image

## v0.5.2

- Add `voluptuous` checking on all `__init__` parameters
- Add `raise_for_status=True` on `aiohttp.ClientSession()`

## v0.5.1

- Switch to "high speed" server for retrieving weather data

## v0.5.0

- Add ability to retrieve historical data

## v0.4.1

- Make radar timestamp and legend optional

## v0.4.0

- Add type info for weather XML data and use typing when creating return value
- Switch from unparsed datetime to `datetime` object in output

## v0.3.2

- Make radar GIF frames per second configurable
- Make radar opacity configurable

## v0.3.1

- Remove ability to specify station for radar (only lat/lon supported)

## v0.3.0

- Switch to ECWeather class from ECData
- Split off AQHI retrieval into separate class
- Switch to asyncio from blocking IO
Expand Down
30 changes: 14 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Environment Canada (env_canada)

[![PyPI version](https://badge.fury.io/py/env-canada.svg)](https://badge.fury.io/py/env-canada)
[![Snyk rating](https://snyk-widget.herokuapp.com/badge/pip/env-canada/badge.svg)](https://snyk.io/vuln/pip:[email protected].0?utm_source=badge)
[![Snyk rating](https://snyk-widget.herokuapp.com/badge/pip/env-canada/badge.svg)](https://snyk.io/vuln/pip:[email protected].1?utm_source=badge)

This package provides access to various data sources published by [Environment and Climate Change Canada](https://www.canada.ca/en/environment-climate-change.html).

Expand Down Expand Up @@ -153,33 +154,30 @@ ec = ECHistoricalRange(station_id=int(stations.iloc[0,2]), timeframe="daily",

ec.get_data()

#yield an XML formated str.
#yield an XML formated str.
# For more options, use ec.to_xml(*arg, **kwargs) with pandas options
ec.xml

#yield an CSV formated str.
# For more options, use ec.to_csv(*arg, **kwargs) with pandas options
ec.csv
```

In this example ```ec.df``` will be:

| Date/Time | Longitude (x) | Latitude (y) | Station Name | Climate ID | Year | Month | Day | Data Quality | Max Temp (°C) | Max Temp Flag | Min Temp (°C) | Min Temp Flag | Mean Temp (°C) | Mean Temp Flag | Heat Deg Days (°C) | Heat Deg Days Flag | Cool Deg Days (°C) | Cool Deg Days Flag | Total Rain (mm) | Total Rain Flag | Total Snow (cm) | Total Snow Flag | Total Precip (mm) | Total Precip Flag | Snow on Grnd (cm) | Snow on Grnd Flag | Dir of Max Gust (10s deg) | Dir of Max Gust Flag | Spd of Max Gust (km/h) | Spd of Max Gust Flag | |
|--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |--- |
| 2022-07-02 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 2 | | 22,8 | | 12,5 | | 17,7 | | 0,3 | | 0 | | | | | | 0 | | | | 26 | | 37 | | |
| 2022-07-03 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 3 | | 21,7 | | 10,1 | | 15,9 | | 2,1 | | 0 | | | | | | 0,4 | | | | 28 | | 50 | | |
|||||||||||||||||||||||||||||||||
| 2022-07-31 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 31 | | 23,5 | | 14,1 | | 18,8 | | 0 | | 0,8 | | | | | | 0 | | | | 23 | | 31 | | |
| 2022-08-01 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 8 | 1 | | 23 | | 15 | | 19 | | 0 | | 1 | | | | | | 0 | | | | 21 | | 35 | | |
In this example `ec.df` will be:

| Date/Time | Longitude (x) | Latitude (y) | Station Name | Climate ID | Year | Month | Day | Data Quality | Max Temp (°C) | Max Temp Flag | Min Temp (°C) | Min Temp Flag | Mean Temp (°C) | Mean Temp Flag | Heat Deg Days (°C) | Heat Deg Days Flag | Cool Deg Days (°C) | Cool Deg Days Flag | Total Rain (mm) | Total Rain Flag | Total Snow (cm) | Total Snow Flag | Total Precip (mm) | Total Precip Flag | Snow on Grnd (cm) | Snow on Grnd Flag | Dir of Max Gust (10s deg) | Dir of Max Gust Flag | Spd of Max Gust (km/h) | Spd of Max Gust Flag | |
| ---------- | ------------- | ------------ | --------------------- | ---------- | ---- | ----- | --- | ------------ | -------------- | ------------- | -------------- | ------------- | --------------- | -------------- | ------------------- | ------------------ | ------------------- | ------------------ | --------------- | --------------- | --------------- | --------------- | ----------------- | ----------------- | ----------------- | ----------------- | ------------------------- | -------------------- | ---------------------- | -------------------- | --- |
| 2022-07-02 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 2 | | 22,8 | | 12,5 | | 17,7 | | 0,3 | | 0 | | | | | | 0 | | | | 26 | | 37 | | |
| 2022-07-03 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 3 | | 21,7 | | 10,1 | | 15,9 | | 2,1 | | 0 | | | | | | 0,4 | | | | 28 | | 50 | | |
|||||||||||||||||||||||||||||||||
| 2022-07-31 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 7 | 31 | | 23,5 | | 14,1 | | 18,8 | | 0 | | 0,8 | | | | | | 0 | | | | 23 | | 31 | | |
| 2022-08-01 | -68,47 | 48,51 | POINTE-AU-PERE (INRS) | 7056068 | 2022 | 8 | 1 | | 23 | | 15 | | 19 | | 0 | | 1 | | | | | | 0 | | | | 21 | | 35 | | |

One should note that july 1st is excluded as the time provided contains specific hours, so it yields only data after or at exactly
the time provided.

To have all the july 1st data in that case, one can provide a datarange without time: ```datetime(2022, 7, 7)``` instead
of ```datetime(2022, 7, 1, 12, 12)```


To have all the july 1st data in that case, one can provide a datarange without time: `datetime(2022, 7, 7)` instead
of `datetime(2022, 7, 1, 12, 12)`

# License

Expand Down
2 changes: 1 addition & 1 deletion env_canada/constants.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
USER_AGENT = "env_canada/0.6.0"
USER_AGENT = "env_canada/0.6.1"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="env_canada",
version="0.6.0",
version="0.6.1",
author="Michael Davie",
author_email="[email protected]",
description="A package to access meteorological data from Environment Canada",
Expand Down

0 comments on commit f53bd0b

Please sign in to comment.