Skip to content

Commit 9e9bacc

Browse files
committed
include custom input files for data class
1 parent 753af87 commit 9e9bacc

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

teaser/data/dataclass.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,44 +47,57 @@ class DataClass(object):
4747
4848
"""
4949

50-
def __init__(self, construction_data: ConstructionData) -> object:
50+
def __init__(self,
51+
construction_data: ConstructionData,
52+
custom_path_type_elements: str=None,
53+
custom_path_material_templates: str=None,
54+
custom_path_use_conditions: str=None) -> object:
55+
5156
"""Construct DataClass."""
5257
self.element_bind = None
53-
if construction_data.is_iwu():
58+
if custom_path_type_elements:
59+
self.path_tb = custom_path_type_elements
60+
elif not custom_path_type_elements and construction_data.is_custom():
61+
raise KeyError("Provide path to custom type elements .json file")
62+
elif construction_data.is_iwu():
5463
self.path_tb = utils.get_full_path(
5564
"data/input/inputdata/TypeElements_IWU.json"
5665
)
57-
self.load_tb_binding()
5866
elif construction_data.is_tabula_de():
5967
self.path_tb = utils.get_full_path(
6068
os.path.join(
6169
"data", "input", "inputdata", "TypeElements_TABULA_DE.json"
6270
)
6371
)
64-
self.load_tb_binding()
6572
elif construction_data.is_tabula_dk():
6673
self.path_tb = utils.get_full_path(
6774
os.path.join(
6875
"data", "input", "inputdata", "TypeElements_TABULA_DK.json"
6976
)
7077
)
71-
self.load_tb_binding()
7278
elif construction_data.is_kfw():
7379
self.path_tb = utils.get_full_path(
7480
os.path.join(
7581
"data", "input", "inputdata", "TypeElements_KFW.json"
7682
)
7783
)
78-
self.load_tb_binding()
7984
elif construction_data is None:
8085
pass
86+
8187
self.material_bind = None
82-
self.path_mat = utils.get_full_path(
83-
"data/input/inputdata/MaterialTemplates.json"
84-
)
88+
if custom_path_material_templates:
89+
self.path_mat = custom_path_material_templates
90+
else:
91+
self.path_mat = utils.get_full_path(
92+
"data/input/inputdata/MaterialTemplates.json")
93+
8594
self.conditions_bind = None
86-
self.path_uc = utils.get_full_path("data/input/inputdata/UseConditions.json")
95+
if custom_path_use_conditions:
96+
self.path_uc = custom_path_use_conditions
97+
else:
98+
self.path_uc = utils.get_full_path("data/input/inputdata/UseConditions.json")
8799

100+
self.load_tb_binding()
88101
self.load_uc_binding()
89102
self.load_mat_binding()
90103

teaser/data/utilities.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ class ConstructionData(Enum):
9191
kfw_70 = "kfw_70"
9292
kfw_85 = "kfw_85"
9393
kfw_100 = "kfw_100"
94+
custom = "Custom"
9495

9596
def get_prefix(self):
9697
parts = self.value.split("_", 2)
@@ -112,6 +113,9 @@ def is_tabula_dk(self):
112113
def is_kfw(self):
113114
return self.get_prefix() == "kfw"
114115

116+
def is_custom(self):
117+
return True
118+
115119
# Dictionary that maps GeometryData enumeration values to their corresponding building classes.
116120
geometries = {
117121
#non residential:

0 commit comments

Comments
 (0)