fixing missed unit for pulling out u-values

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-18 18:51:59 +01:00
parent 9bbb688a28
commit 5cfa3d291f
2 changed files with 12 additions and 4 deletions

View file

@ -2,8 +2,9 @@ import re
import string
from typing import Tuple, Union, Dict, List
THERMAL_TRANSMITTENCE_STR = r"average thermal transmittance (-?\d+\.\d+)\s(w/m-¦k)"
THERMAL_TRANSMITTANCE_REGEX = re.compile(THERMAL_TRANSMITTENCE_STR)
THERMAL_TRANSMITTANCE_STR = r"average thermal transmittance (-?\d+\.\d+)\s(w/m\S+k)"
THERMAL_TRANSMITTANCE_REGEX = re.compile(THERMAL_TRANSMITTANCE_STR)
DOUBLE_SPACE_PATTERN = re.compile(r"\s+")
@ -20,11 +21,12 @@ def extract_thermal_transmittance(result: dict, description: str) -> Tuple[
"""
match = THERMAL_TRANSMITTANCE_REGEX.search(description)
if match:
result['thermal_transmittance'] = float(match.group(1))
result['thermal_transmittance_unit'] = match.group(2)
# Remove the match from the description
description = re.sub(THERMAL_TRANSMITTENCE_STR, "", description)
description = re.sub(THERMAL_TRANSMITTANCE_STR, "", description)
else:
result['thermal_transmittance'] = None
result['thermal_transmittance_unit'] = None

View file

@ -690,5 +690,11 @@ wall_cases = [
'thermal_transmittance_unit': None, 'is_cavity_wall': False, 'is_filled_cavity': False, 'is_solid_brick': True,
'is_system_built': False, 'is_timber_frame': False, 'is_granite_or_whinstone': False, 'is_as_built': True,
'is_cob': False, 'is_assumed': True, 'is_sandstone_or_limestone': False, 'insulation_thickness': 'none',
'external_insulation': False, 'internal_insulation': False}
'external_insulation': False, 'internal_insulation': False},
{'original_description': 'Average thermal transmittance 1.60 W/m+é-¦K',
'thermal_transmittance': 1.6, 'thermal_transmittance_unit': 'w/m+é-¦k', 'is_cavity_wall': False,
'is_filled_cavity': False, 'is_solid_brick': False, 'is_system_built': False, 'is_timber_frame': False,
'is_granite_or_whinstone': False, 'is_as_built': False, 'is_cob': False, 'is_assumed': False,
'is_sandstone_or_limestone': False, 'insulation_thickness': None, 'external_insulation': False,
'internal_insulation': False}
]