Esempio n. 1
0
def temps_to_building_pkl(facility):
    start_date   = datetime.strptime("1/1/2011 00:00:00", "%m/%d/%Y %H:%M:%S").replace(tzinfo = tz_used)
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    data, desc = qload("temps_"+facility+".pkl",loc="")
    full_temps, temps_oriflag = fill_in(data,full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))
    
    
    dataagg, descagg = qload("state_b_records_2011_with_temps.pkl",loc = "")
Esempio n. 2
0
def temps_to_building_pkl(facility):
    start_date = datetime.strptime("1/1/2011 00:00:00",
                                   "%m/%d/%Y %H:%M:%S").replace(tzinfo=tz_used)
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    data, desc = qload("temps_" + facility + ".pkl", loc="")
    full_temps, temps_oriflag = fill_in(data, full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))

    dataagg, descagg = qload("state_b_records_2011_with_temps.pkl", loc="")
Esempio n. 3
0
def toadd_to_building_pkls(data,k):
    start_date   = datetime.strptime("1/1/2011 00:00:00", "%m/%d/%Y %H:%M:%S").replace(tzinfo = tz_used)
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    toadd, desctemp = qload("temps_"+k+".pkl",loc=data_loc + '2011/')
    ### fix it
    #times, tempe = zip(*toadd)
#    temp = {}
#    for date, number in toadd:
#        if date not in temp: # we see this key for the first time
#            temp[date] = (date, number)
#    result = temp.values()
    result = list(set(toadd)).sorted()
    
    full_temps, temps_oriflag = fill_in(result,full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))
    return data        
Esempio n. 4
0
def toadd_to_building_pkls(data, k):
    start_date = datetime.strptime("1/1/2011 00:00:00",
                                   "%m/%d/%Y %H:%M:%S").replace(tzinfo=tz_used)
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    toadd, desctemp = qload("temps_" + k + ".pkl", loc=data_loc + '2011/')
    ### fix it
    #times, tempe = zip(*toadd)
    #    temp = {}
    #    for date, number in toadd:
    #        if date not in temp: # we see this key for the first time
    #            temp[date] = (date, number)
    #    result = temp.values()
    result = list(set(toadd)).sorted()

    full_temps, temps_oriflag = fill_in(result, full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))
    return data
Esempio n. 5
0
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    toadd, desctemp = qload("temps_"+k+".pkl",loc=data_loc + '2011/')
    ### fix it
    #times, tempe = zip(*toadd)
#    temp = {}
#    for date, number in toadd:
#        if date not in temp: # we see this key for the first time
#            temp[date] = (date, number)
#    result = temp.values()
    result = list(set(toadd)).sorted()
    
    full_temps, temps_oriflag = fill_in(result,full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))
    return data        
    
    
        

if __name__== "__main__":
    facilities = {'1636483694' :'Danville',
                  '1988756172' :'Galesburg',
                  '2550170006' :'Vienna',
                  '5379783532' :'Pinckneyville'}
    data, desc = qload("state_b_records_2011_with_temps.pkl",loc = data_loc)
    for k in facilities:
        data = toadd_to_building_pkls(data,k)
    qdump((data,desc),"state_b_records_2011_with_temps.pkl",loc=data_loc)
                  
                  
Esempio n. 6
0
                                   "%m/%d/%Y %H:%M:%S").replace(tzinfo=tz_used)
    full_year_times = \
                [(start_date + rdatetime.timedelta(hours = n)) for n in range(8760)]
    toadd, desctemp = qload("temps_" + k + ".pkl", loc=data_loc + '2011/')
    ### fix it
    #times, tempe = zip(*toadd)
    #    temp = {}
    #    for date, number in toadd:
    #        if date not in temp: # we see this key for the first time
    #            temp[date] = (date, number)
    #    result = temp.values()
    result = list(set(toadd)).sorted()

    full_temps, temps_oriflag = fill_in(result, full_year_times)
    temp_times, temp_vals = zip(*full_temps)
    temps = (np.array(temp_vals), np.array(temps_oriflag))
    return data


if __name__ == "__main__":
    facilities = {
        '1636483694': 'Danville',
        '1988756172': 'Galesburg',
        '2550170006': 'Vienna',
        '5379783532': 'Pinckneyville'
    }
    data, desc = qload("state_b_records_2011_with_temps.pkl", loc=data_loc)
    for k in facilities:
        data = toadd_to_building_pkls(data, k)
    qdump((data, desc), "state_b_records_2011_with_temps.pkl", loc=data_loc)