def _convert_one_sec_data(ukdale_path, store, ac_type_map): ids_of_one_sec_data = [ identifier for identifier, ac_types in ac_type_map.iteritems() if ac_types == ['active', 'apparent'] ] if not ids_of_one_sec_data: return for identifier in ids_of_one_sec_data: key = Key(building=identifier[0], meter=identifier[1]) print("Loading 1-second data for", key, "...") house_path = 'house_{:d}'.format(key.building) filename = join(ukdale_path, house_path, 'mains.dat') df = _load_csv(filename, ONE_SEC_COLUMNS, TZ) store.put(store, str(key), df) # Set 'disabled' metadata attributes # TODO: needs to use `nilmtk.DataStore` API rather than grabbing # the `pd.HDFStore` directly. group = store.store._handle.get_node('/building{:d}'.format( key.building)) metadata = group._f_getattr('metadata') metadata['elec_meters'][key.meter]['disabled'] = True group._f_setattr('metadata', metadata) store.store.flush() store.close()
def _convert_one_sec_data(ukdale_path, store, ac_type_map): ids_of_one_sec_data = [ identifier for identifier, ac_types in ac_type_map.iteritems() if ac_types == ['active', 'apparent']] if not ids_of_one_sec_data: return for identifier in ids_of_one_sec_data: key = Key(building=identifier[0], meter=identifier[1]) print("Loading 1-second data for", key, "...") house_path = 'house_{:d}'.format(key.building) filename = join(ukdale_path, house_path, 'mains.dat') df = _load_csv(filename, ONE_SEC_COLUMNS, TZ) store.put(str(key), df) # Set 'disabled' metadata attributes # TODO: needs to use `nilmtk.DataStore` API rather than grabbing # the `pd.HDFStore` directly. group = store.store._handle.get_node('/building{:d}'.format(key.building)) metadata = group._f_getattr('metadata') metadata['elec_meters'][key.meter]['disabled'] = True group._f_setattr('metadata', metadata) store.store.flush() store.close()
def _convert_one_sec_data(ukdale_path, store, ac_type_map, drop_duplicates): ids_of_one_sec_data = [ identifier for identifier, ac_types in iteritems(ac_type_map) if ac_types == ['active', 'apparent']] if not ids_of_one_sec_data: return for identifier in ids_of_one_sec_data: key = Key(building=identifier[0], meter=identifier[1]) print("Loading 1-second data for", key, "...") house_path = 'house_{:d}'.format(key.building) filename = join(ukdale_path, house_path, 'mains.dat') df = _load_csv(filename, ONE_SEC_COLUMNS, TZ, drop_duplicates=drop_duplicates) store.put(str(key), df) store.close()
def _convert_one_sec_data(ukdale_path, store, ac_type_map): ids_of_one_sec_data = [ identifier for identifier, ac_types in iteritems(ac_type_map) if ac_types == ['active', 'apparent']] if not ids_of_one_sec_data: return for identifier in ids_of_one_sec_data: key = Key(building=identifier[0], meter=identifier[1]) print("Loading 1-second data for", key, "...") house_path = 'house_{:d}'.format(key.building) filename = join(ukdale_path, house_path, 'mains.dat') df = _load_csv(filename, ONE_SEC_COLUMNS, TZ) store.put(str(key), df) store.close()