def testReal(): category = 7 heatDict = ld.profile2Dict("energyData/meterData/", "Heating:Gas") coolDict = ld.profile2Dict("energyData/meterData/", "Cooling:Elec") color_heat = colorRamp(category, "white*-red 1 (red*)", "rgb") color_cool = colorRamp(category, "white*-blue*", "rgb") length = 8760 # for key in heatDict: key = "Hospital" testlength = 50 heat_bp = ld.breakpt(heatDict[key][:testlength], category, "quantile") cool_bp = ld.breakpt(coolDict[key][:testlength], category, "quantile") arr_heat = ld.classify(heatDict[key][:testlength], heat_bp) arr_cool = ld.classify(coolDict[key][:testlength], cool_bp) arr_cl_heat = [color_heat[x] for x in arr_heat] arr_cl_cool = [color_cool[x] for x in arr_cool] mix = mixColor([arr_cl_heat, arr_cl_cool]) arr_cl_heat = [rgb2hex(x[0], x[1], x[2]) for x in arr_cl_heat] arr_cl_cool = [rgb2hex(x[0], x[1], x[2]) for x in arr_cl_cool] gridwidth = 20 for i in range(testlength): f = Canvas(master, width = gridwidth, height = gridwidth) f.create_rectangle(0, 0, gridwidth, gridwidth, fill = arr_cl_heat[i]) f.grid(row = 0, column = i) f = Canvas(master, width = gridwidth, height = gridwidth) f.create_rectangle(0, 0, gridwidth, gridwidth, fill = arr_cl_cool[i]) f.grid(row = 1, column = i) f = Canvas(master, width = gridwidth, height = gridwidth) f.create_rectangle(0, 0, gridwidth, gridwidth, fill = mix[i]) f.grid(row = 2, column = i)
def data2breakpoints(cate, method, topic): (x, y) = ld.read2dicts() allDict = dict(zip(x, y)) if (topic == "energy recovery"): heatDict = allDict["Space Heating"] coolDict = allDict["Cooling:Electricity"] else: heatDict = allDict["Heating"] coolDict = allDict["Electricity:Facility"] countDict = ld.bdCountDict totalheat = ld.total_count(countDict, heatDict) totalheat = [x for x in totalheat if x != 0.0] totalcool = ld.total_count(countDict, coolDict) totalcool = [x for x in totalcool if x != 0.0] breakpt_heat = ld.breakpt(totalheat, cate, method, False) breakpt_cool = ld.breakpt(totalcool, cate, method, False) coloridDict = {} for key in heatDict: if countDict[key] > 0: coloridDict[key] = zip(ar.bucket(heatDict[key], breakpt_heat), ar.bucket(coolDict[key], breakpt_cool)) return(breakpt_heat, breakpt_cool, coloridDict)
'Min Heaing Demand (Gas)/kBtu: {1}\n'+ 'Heating Demand Variation/kBtu: {2}\n'+ 'Heating Energy Variation Ratio: {3}\n\n').format(maxtotal, mintotal, dif, ratio) else: energy += ('Max Cooling Demand (Electricity)/kBtu: {0}\n'+ 'Min Cooling Demand (Electricity)/kBtu: {1}\n'+ 'Cooling Demand Variation/kBtu: {2}\n'+ 'Cooling Energy Variation Ratio: {3}\n\n').format(maxtotal, mintotal, dif, ratio) return energy # classify data totalheat = ld.total_count(countDict, heatDict) totalcool = ld.total_count(countDict, coolDict) totalheat = [x for x in totalheat if x != 0.0] totalcool = [x for x in totalcool if x != 0.0] heat_breakpt = ld.breakpt(totalheat, category, "quantile", False) cool_breakpt = ld.breakpt(totalcool, category, "quantile", False) # create 2d colorRamp colorGrid = cl.colorRamp_2d(category,[255, 255, 255], [255, 0, 0], [0, 255, 0]) color_2d = createColorScheme(category, 0, dim, size) heatColorDict = {} for key in heatDict: if countDict[key] != 0: heatColorDict[key] = ar.bucket(heatDict[key], heat_breakpt) coolColorDict = {} for key in coolDict: if countDict[key] != 0: