Added function to extract thermal transmittence

This commit is contained in:
Khalim Conn-Kowlessar 2023-06-08 09:59:33 +01:00
parent ec95fcf99c
commit 532bb684d2

View file

@ -81,6 +81,24 @@ def handler():
raise Exception("Unhandled")
import re
def extract_thermal_transmittence(description_lower):
# Find U-value
u_value = re.search(r"(\d+\.\d+)", description_lower)
if u_value is not None:
u_value = float(u_value.group(1))
else:
u_value = None
# Find unit
unit = re.search(r"(w/m-¦k)", description_lower)
if unit is not None:
unit = unit.group(1)
else:
unit = None
return u_value, unit
def clean_roof(description):
"""
We aim to extract features about the roof, so we can characterise it. We will check:
@ -104,7 +122,9 @@ def handler():
"insulation_thickness": 0,
"has_dwelling_above": True,
"assumed": "assumed" in description_lower,
"is_flat": "flat" in description_lower
"is_flat": "flat" in description_lower,
"thermal_transmittence": None,
"thermal_transmittence_unit": None,
}
is_pitched = "pitched" in description_lower
@ -112,14 +132,11 @@ def handler():
has_loft = "loft" in description_lower
is_flat = "flat" in description_lower
thermal_transmittence, thermal_transmittence_unit, insulation_thickness = None, None, None
if "insulation" in description_lower or "insulated" in description_lower:
# if has_loft and is_pitched:
# insulation_thickness = find_insulation_thickness(description_lower)
# elif not has_loft and is_pitched:
# insulation_thickness = find_insulation_thickness(description_lower)
# else:
# raise Exception("Implement me")
insulation_thickness = find_insulation_thickness(description_lower, is_pitched, is_roof_room, is_flat)
elif "thermal transmittance" in description_lower:
thermal_transmittence, thermal_transmittence_unit = extract_thermal_transmittence(description_lower)
else:
raise Exception("Implment me 2")
@ -130,7 +147,9 @@ def handler():
"insulation_thickness": insulation_thickness,
"has_dwelling_above": False,
"assumed": "assumed" in description_lower,
"is_flat": is_flat
"is_flat": is_flat,
"thermal_transmittence": thermal_transmittence,
"thermal_transmittence_unit": thermal_transmittence_unit
}
return attributes