bctc.load — Control Area Load Report Data

Tools for parsing control area load historical reports posted at <http://www.bctc.com/transmission_system/balancing_authority_load_data/historical_transmission_data.htm> (2010-02-08).

class bctc.load.LoadPoint(t, load)

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

>>> from datetime import datetime
>>> import pytz
>>> point = LoadPoint(pytz.utc.localize(datetime(2001, 1, 1)), 1000)
>>> t, load = point
>>> assert t == point.t
>>> assert load = point.load
Parameters:
load

Load in MW.

Return type:int
t
Return type:UTC offset-aware datetime.datetime
bctc.load.yield_load_points(start_dt = pytz.utc.localize(datetime(2001, 1, 1)), end_dt = pytz.utc.localize(datetime.today() + timedelta(1)), manager = LoadBookManager())

Yields control area LoadPoint 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(2001, 1, 1))
  • end_dt – offset-aware datetime.datetime; typically like pytz.utc.localize(datetime.today() + timedelta(1))
  • managerYearBookManager instance like LoadBookManager()
Example Usage::
>>> from bctc.load import LoadBookManager, yield_load_points
>>> from datetime import datetime
>>> import pytz
>>>
>>> # list of all available data points
>>> points = list(yield_load_points())
>>> 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 = LoadBookManager()
>>> start_dt = pytz.utc.localize(datetime(2007, 1, 1))
>>> end_dt = pytz.utc.localize(datetime(2008, 1, 1))
>>> points_2007 = list(yield_load_points(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_load_points(start_dt, end_dt, manager = manager))
>>> assert len(points_2007_and_2008) > 10000
class bctc.load.LoadBookManager
A cache manager that dynamically downloads historical load data from 2001 onwards. The managed hourly report files are those at <http://www.bctc.com/transmission_system/balancing_authority_load_data/historical_transmission_data.htm> (2010-02-23).
bctc.load.parse_load_xls_file(f)
Yields LoadPoint 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

What’s New in pybctc 0.1

Next topic

bctc.intertie — US and AB Intertie Flows Report Data

This Page