def load_building(self, root_directory, building_name): # Construct new Building and set known attributes building = Building() # MIT's coorindates building.geographic_coordinates = (42.360091, -71.09416) # Load labels building_dir = os.path.join(root_directory, building_name) labels = load_labels(building_dir) # Load mains mains_chans = [chan for chan, label in labels.iteritems() if label == 'mains'] mains_chan_dict = {} for mains_chan in mains_chans: col_name = 'mains_{:d}_meter_1_active'.format(mains_chan) mains_chan_dict[col_name] = load_chan(building_dir, mains_chan) # Make a DataFrame containing all mains channels df = pd.DataFrame(mains_chan_dict) df = df.tz_localize('UTC') df = df.tz_convert('US/Eastern') # MIT is on the east coast! building.electric.mains = df # Load sub metered channels # TODO # Convert from REDD channel names to standardised names # Set up wiring self.buildings[building_name] = building