bctc.intertie — US and AB Intertie Flows Report Data

Tools for parsing intertie flow historical reports posted at <http://www.bctc.com/transmission_system/actual_flow_data/historical_data.htm> (2010-02-08).

class bctc.intertie.IntertieFlowPoint(t, us, ab)

Object representing intertie flows at a given point in time. The object is iterable so that it can be unpacked:

>>> from datetime import datetime
>>> import pytz
>>> point = IntertieFlowPoint(pytz.utc.localize(datetime(2001, 1, 1)), 12, 57)
>>> t, us, ab = point
>>> assert t == point.t
>>> assert us == point.us
>>> assert ab == point.ab
Parameters:
ab

Flow to Alberta in MW.

Return type:int
t
Return type:UTC offset-aware datetime.datetime
us

Flow to US in MW.

Return type:int
bctc.intertie.yield_intertie_flows(start_dt = pytz.utc.localize(datetime(2001, 1, 1)), end_dt = pytz.utc.localize(datetime.today() + timedelta(1)), manager = IntertieBookManager())

Yields hourly historical IntertieFlowPoint objects with time t such that start_dt <= t < end_dt. By default all available data is returned. A manager object, if provided, gives advanced users the ability to use previously cached files to save download time.

Parameters:
  • start_dt – offset-aware datetime.datetime; typically like pytz.utc.localize(datetime(1999, 1, 1))
  • end_dt – offset-aware datetime.datetime; typically like pytz.utc.localize(datetime.today() + timedelta(1))
  • managerYearBookManager instance like IntertieBookManager()
Example Usage::
>>> from bctc.intertie import IntertieFlowPoint, yield_intertie_flows
>>> from datetime import datetime
>>> import pytz
>>>
>>> # list of all available data points
>>> points = list(yield_intertie_flows())
>>> assert len(points) > 10000
>>>
>>> # Create a list of all data for 2007 and use a manager
>>> # object to cache downloaded data for later usage.
>>> manager = IntertieBookManager()
>>> start_dt = pytz.utc.localize(datetime(2007, 1, 1))
>>> end_dt = pytz.utc.localize(datetime(2008, 1, 1))
>>> points_2007 = list(yield_intertie_flows(start_dt, end_dt, manager = manager))
>>> assert len(points_2007) > 10000
>>>
>>> # Create a new list of 2007 and 2008 points re-using the
>>> # 2007 data already stored by *manager* to save time.
>>> points_2007_and_2008 = list(yield_intertie_flows(start_dt, end_dt, manager = manager))
>>> assert len(points_2007_and_2008) > 10000
class bctc.intertie.IntertieBookManager
A cache manager that dynamically downloads historical flow data from 1999 onwards. The managed hourly report files are those at <http://www.bctc.com/transmission_system/actual_flow_data/historical_data.htm> (2010-02-23).
bctc.intertie.parse_intertie_xls_file(f)
Yields IntertieFlowPoint objects extracted from Excel file f. File f may be either a file-like object or a string containing the path to an Excel file.

Previous topic

bctc.load — Control Area Load Report Data

Next topic

Examples

This Page