def test_get_table_names(self): s_tables = psda.get_table_names('shared') c_tables = psda.get_table_names('curated') r_tables = psda.get_table_names('raw') self.assertIn('group1_disaggregated_2012_12', c_tables, 'curated schema has correct tables') self.assertIn('egauge_15min_2013', r_tables, 'raw schema has correct tables') self.assertIn('validated_01_2014', s_tables, 'shared schema has correct tables')
def test_get_table_names(self): s_tables = psda.get_table_names('shared') c_tables = psda.get_table_names('curated') r_tables = psda.get_table_names('raw') self.assertIn('group1_disaggregated_2012_12', c_tables, 'curated schema has correct tables') self.assertIn('egauge_15min_2013', r_tables, 'raw schema has correct tables') self.assertIn('validated_01_2014', s_tables, 'shared schema has correct tables')
def get_test_data(num_houses): devices_types_unsampled={} ids_for_devices={} db_url='postgresql://*****:*****@db.wiki-energy.org:5432/postgres' psda.set_url(db_url) schema = 'shared' tables= psda.get_table_names(schema) print tables table=tables[3] ids_device_name='air1' ids_for_devices[ids_device_name]=psda.get_dataids_with_real_values(schema,table,ids_device_name) device_name='air1' devices_types_unsampled[device_name]=psda.generate_type_for_appliance_by_dataids(schema,table,device_name,ids_for_devices[ids_device_name][:num_houses]) device_name='use' devices_types_unsampled[device_name]=psda.generate_type_for_appliance_by_dataids(schema,table,device_name,ids_for_devices[ids_device_name][:num_houses]) #Resamples the data devices_types={} devices_types_unsplit={} sample_rate='1T' length='D' for key in devices_types_unsampled: devices_types_unsplit[key]=devices_types_unsampled[key].resample(sample_rate) #devices_types[key]=devices_types_unsplit[key].split_by(length) devices_types[key]=devices_types_unsplit[key] print "Resampled " + str(key) return devices_types
def get_test_data(num_houses): devices_types_unsampled = {} ids_for_devices = {} db_url = 'postgresql://*****:*****@db.wiki-energy.org:5432/postgres' psda.set_url(db_url) schema = 'shared' tables = psda.get_table_names(schema) print tables table = tables[3] ids_device_name = 'air1' ids_for_devices[ids_device_name] = psda.get_dataids_with_real_values( schema, table, ids_device_name) device_name = 'air1' devices_types_unsampled[ device_name] = psda.generate_type_for_appliance_by_dataids( schema, table, device_name, ids_for_devices[ids_device_name][:num_houses]) device_name = 'use' devices_types_unsampled[ device_name] = psda.generate_type_for_appliance_by_dataids( schema, table, device_name, ids_for_devices[ids_device_name][:num_houses]) #Resamples the data devices_types = {} devices_types_unsplit = {} sample_rate = '1T' length = 'D' for key in devices_types_unsampled: devices_types_unsplit[key] = devices_types_unsampled[key].resample( sample_rate) #devices_types[key]=devices_types_unsplit[key].split_by(length) devices_types[key] = devices_types_unsplit[key] print "Resampled " + str(key) return devices_types
The curated data set has 15 minute interval data for 2013 and 2012 (the largest interval lasts from 12/12-11/13. If you want to analyze longer term data, the curated set is recommended, whereas if you want shorter but more frequent data the shared set is recommended. Would you like to recieve data from the shared or curated set?''' # get tables from schema dataset = raw_input('Please enter either "shared" or "curated"(no quotes):\n') ##this is wrong it depends which version is running schema = dataset #schema_e = schema[1:-1] tables = pecan.get_table_names(schema) print 'You can now view data for any of these months\n' for i in tables: print i + '\n' print '''Which month would you like to view data for? Please enter one of the table names exactly as it is printed and as a string: ''' month = raw_input() print month print "This next step takes about a minute..." i, a = pecan.get_table_dataids_and_column_names(schema, str(month)) print '''You can now load data for a single home. Here are the homes you can choose from:\n'''
The curated data set has 15 minute interval data for 2013 and 2012 (the largest interval lasts from 12/12-11/13. If you want to analyze longer term data, the curated set is recommended, whereas if you want shorter but more frequent data the shared set is recommended. Would you like to recieve data from the shared or curated set?''' # get tables from schema dataset = raw_input('Please enter either "shared" or "curated"(no quotes):\n') ##this is wrong it depends which version is running schema = dataset #schema_e = schema[1:-1] tables = pecan.get_table_names(schema) print 'You can now view data for any of these months\n' for i in tables: print i + '\n' print '''Which month would you like to view data for? Please enter one of the table names exactly as it is printed and as a string: ''' month = raw_input() print month print "This next step takes about a minute..." i,a = pecan.get_table_dataids_and_column_names(schema,str(month)) print '''You can now load data for a single home. Here are the homes you can choose from:\n'''