mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Added function to extract thermal transmittence
This commit is contained in:
parent
ec95fcf99c
commit
532bb684d2
1 changed files with 27 additions and 8 deletions
|
|
@ -81,6 +81,24 @@ def handler():
|
||||||
|
|
||||||
raise Exception("Unhandled")
|
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):
|
def clean_roof(description):
|
||||||
"""
|
"""
|
||||||
We aim to extract features about the roof, so we can characterise it. We will check:
|
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,
|
"insulation_thickness": 0,
|
||||||
"has_dwelling_above": True,
|
"has_dwelling_above": True,
|
||||||
"assumed": "assumed" in description_lower,
|
"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
|
is_pitched = "pitched" in description_lower
|
||||||
|
|
@ -112,14 +132,11 @@ def handler():
|
||||||
has_loft = "loft" in description_lower
|
has_loft = "loft" in description_lower
|
||||||
is_flat = "flat" 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 "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)
|
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:
|
else:
|
||||||
raise Exception("Implment me 2")
|
raise Exception("Implment me 2")
|
||||||
|
|
||||||
|
|
@ -130,7 +147,9 @@ def handler():
|
||||||
"insulation_thickness": insulation_thickness,
|
"insulation_thickness": insulation_thickness,
|
||||||
"has_dwelling_above": False,
|
"has_dwelling_above": False,
|
||||||
"assumed": "assumed" in description_lower,
|
"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
|
return attributes
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue