EnvironmentCanada¶
An utility class to retrieve the weather forecast from the Environment Canada service. https://www.weather.gc.ca/forecast/
-
class
aaa_modules.environment_canada.
EnvCanada
[source]¶ Utility class to retreive the hourly forecast.
-
CITY_FORECAST_MAPPING
= {'ottawa': 'on-118'}¶ Mapping from lowercase city name to the env canada identifier.
-
static
retrieveHourlyForecast
(cityOrUrl, hourCount=12)[source]¶ Retrieves the hourly forecast for the given city.
Parameters: - cityOrUrl (str) – the city name or the Environment Canada website ‘https://www.weather.gc.ca/forecast/hourly/on-118_metric_e.html’
- hourCount (int) – the # of forecast hour to get, starting from the next hour relative to the current time.
Return type: list(Forecast)
Raise: ValueError if cityOrUrl points to an invalid city, or if hourCount is more than 24 and less than 1.
-
-
class
aaa_modules.environment_canada.
Forecast
(forecastTime, temperature, condition, precipationProbability, wind)[source]¶ Represent the weather forecast.
-
__init__
(forecastTime, temperature, condition, precipationProbability, wind)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
getPrecipationProbability
()[source]¶ Return the precipation probability. Possible values: High (70%+), Medium (60% - 70%), Low (< 40%), or Nil (0%).
Return type: str
-