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:
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

getCondition()[source]

Return the weather condition.

Return type:str
getForecastTime()[source]

Return the hour in 24-hour format.

Return type:int
getPrecipationProbability()[source]

Return the precipation probability. Possible values: High (70%+), Medium (60% - 70%), Low (< 40%), or Nil (0%).

Return type:str
getTemperature()[source]

Return the temperature in Celcius.

Return type:int
getUserFriendlyForecastTime()[source]

Returns the forecast hour in user friendly format (1AM, 2PM,…)

Return type:str
getWind()[source]

Return the wind info such as “15 NW”.

Return type:str