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)
dif = maxtotal - mintotal ratio = round(float(dif)/maxtotal, 3) if cate == "Heating": energy += ('Max Heaing Demand (Gas)/kBtu: {0}\n'+ '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)