epinterface 1.0.1__py3-none-any.whl → 1.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -51,6 +51,34 @@ class SemanticModelFields(BaseModel):
51
51
  GFA_col: str | None = Field(
52
52
  default=None, description="The gross floor area column name [m2]."
53
53
  )
54
+ Building_ID_col: str | None = Field(
55
+ default=None, description="The building ID column name."
56
+ )
57
+ Basement_col: str | None = Field(
58
+ default=None, description="The basement column name."
59
+ )
60
+ Attic_col: str | None = Field(default=None, description="The attic column name.")
61
+ Exposed_Basement_Frac_col: str | None = Field(
62
+ default=None, description="The exposed basement fraction column name."
63
+ )
64
+ Weather_File_col: str | None = Field(
65
+ default=None, description="The weather file column name."
66
+ )
67
+
68
+ @property
69
+ def semantic_field_names(self) -> list[str]:
70
+ """The names of the semantic fields."""
71
+ return [f.Name for f in self.Fields]
72
+
73
+ @property
74
+ def rich_field_names(self) -> list[str | None]:
75
+ """The names of the rich fields."""
76
+ return [v for k, v in self.model_dump().items() if k.endswith("_col")]
77
+
78
+ @property
79
+ def field_names(self) -> list[str | None]:
80
+ """The names of the fields."""
81
+ return [*self.semantic_field_names, *self.rich_field_names]
54
82
 
55
83
  @model_validator(mode="after")
56
84
  def check_at_least_one_height_or_num_floors(self):
epinterface/sbem/utils.py CHANGED
@@ -1,7 +1,7 @@
1
1
  """Utility functions for working with SBEMs."""
2
2
 
3
3
  from pathlib import Path
4
- from typing import cast
4
+ from typing import Any, cast
5
5
 
6
6
  import yaml
7
7
  from tqdm.autonotebook import tqdm
@@ -15,11 +15,25 @@ from epinterface.sbem.fields.spec import SemanticModelFields
15
15
  from epinterface.sbem.prisma.client import PrismaSettings
16
16
 
17
17
 
18
+ class ModelsNotConstructableError(Exception):
19
+ """An error raised when the models are not constructable."""
20
+
21
+ def __init__(self, failing_contexts: list[dict[str, Any]]):
22
+ """Initialize the error."""
23
+ self.failing_contexts = failing_contexts
24
+ printable_contexts = failing_contexts[: min(10, len(failing_contexts))]
25
+ msg = "The following contexts failed to resolve to a valid zone component:\n"
26
+ msg += "\n\n"
27
+ msg += yaml.dump(printable_contexts, indent=2, sort_keys=False)
28
+ super().__init__(msg)
29
+
30
+
18
31
  def check_model_existence(
19
32
  component_map_path: Path,
20
33
  semantic_fields_path: Path,
21
34
  db_path: Path,
22
35
  max_tests: int = 100,
36
+ raise_on_error: bool = False,
23
37
  ) -> None:
24
38
  """Check if all semantic field combinations resolve to a valid zone component (up to some sampling limit).
25
39
 
@@ -34,6 +48,7 @@ def check_model_existence(
34
48
  semantic_fields_path: Path to the semantic fields file.
35
49
  db_path: Path to the database file.
36
50
  max_tests: Maximum number of tests to run.
51
+ raise_on_error: Whether to raise an error if any tests fail.
37
52
  """
38
53
  with open(semantic_fields_path) as f:
39
54
  semantic_fields_yaml = yaml.safe_load(f)
@@ -61,8 +76,13 @@ def check_model_existence(
61
76
  grid = grid.sample(min(max_tests, len(grid)))
62
77
 
63
78
  # Checks that things that should be in the db are in the db
79
+ failing_contexts = []
64
80
  with db:
65
- for _ix, row in tqdm(grid.iterrows(), total=len(grid)):
81
+ for _ix, row in tqdm(
82
+ grid.iterrows(),
83
+ total=len(grid),
84
+ desc="Checking semantic field/component lib compatibility.",
85
+ ):
66
86
  context = row.to_dict()
67
87
  for field_name, field_val in field_vals.items():
68
88
  context[field_name] = field_val[context[field_name]]
@@ -72,3 +92,6 @@ def check_model_existence(
72
92
  )
73
93
  except Exception as e:
74
94
  print(f"\nError: {e}, context: {context}\n")
95
+ failing_contexts.append(context)
96
+ if raise_on_error and failing_contexts:
97
+ raise ModelsNotConstructableError(failing_contexts)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: epinterface
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: This is a repository for dynamically generating energy models within Python, relying on Archetypal and Eppy for most of its functionality.
5
5
  Project-URL: Homepage, https://github.com/szvsw/epinterface
6
6
  Project-URL: Documentation, https://szvsw.github.io/epinterface
@@ -26,7 +26,7 @@ epinterface/sbem/exceptions.py,sha256=4uOXlZgJyvhhRG2cbSua2InxxXHanGSe74h2ioiNEk
26
26
  epinterface/sbem/flat_model.py,sha256=q-G23Rvw3GBDYRm7Oa6PItI8_Xp-FYieLZmLDR4mNyM,84602
27
27
  epinterface/sbem/interface.py,sha256=M9p5XK3psKjExBTcOY66IFLK1sRcPiuKXbu4BckAXgU,25417
28
28
  epinterface/sbem/model_graph_structure.md,sha256=uCky10vTV-yuosd9LyLoXzKUzH-Vu6_oY7UCk35oBCg,952
29
- epinterface/sbem/utils.py,sha256=AILbYbP5NAjKRvoUrGtyMcX3JRBFb7hIk5g9NF_wUcg,2633
29
+ epinterface/sbem/utils.py,sha256=i2BM9iwdW_fYpKfmnmXzOqJ4_APnxTaSlNHinVyWWUo,3581
30
30
  epinterface/sbem/components/__init__.py,sha256=nAhAN6WmcfR2uVfyJIjrFFctuzc7WFdVGmKJmjm3fwM,37
31
31
  epinterface/sbem/components/composer.py,sha256=Gs4v8-x8iqfCjaD28TREmqX0pHiRWwyoOh20OPnR3WU,16357
32
32
  epinterface/sbem/components/envelope.py,sha256=ccmLr2dajgA8s2qBwZxMaj3leu4DETROm6t4N6Q9oSo,12950
@@ -37,7 +37,7 @@ epinterface/sbem/components/space_use.py,sha256=CEWXZ47Etbn06zga88ypmlqwhXEIDSF6
37
37
  epinterface/sbem/components/systems.py,sha256=02C_HZd38mbE_4i0etxyS-py5y0UiZ9oXkkz_5hmqZ8,8945
38
38
  epinterface/sbem/components/zones.py,sha256=ivilWtXkDqWPej4JJho-XAu5aW4NrRqeR7mZDek2yQ0,1050
39
39
  epinterface/sbem/fields/__init__.py,sha256=4y74sjtmCMvTALurPyZxbXhTSPjvtkrY1rXgoFcvaYU,74
40
- epinterface/sbem/fields/spec.py,sha256=qa3PL_Z_FrswlB1JvTFtOXEBUN8ycMns7H0FKVsa1kU,3452
40
+ epinterface/sbem/fields/spec.py,sha256=lYEyMPV-aODwqehZxGbofb2YUwL8F4er-c4oOcXM83Q,4522
41
41
  epinterface/sbem/prisma/client.py,sha256=689cjAnU1trW4r1Bfh49itwbhi3FL9rhSDEBtO59a4I,22060
42
42
  epinterface/sbem/prisma/partial_types.py,sha256=HxOvndrx-XMrp8twUazEt2dVzrsdvQAXo-GfnhoeOKM,4929
43
43
  epinterface/sbem/prisma/schema.prisma,sha256=az4o4Tb5qzmtIFm6g_z7afmGaAyXc2GrqEawWZ7fBF4,19189
@@ -50,8 +50,8 @@ epinterface/sbem/prisma/migrations/20250325185158_add_mutually_exclusive_ventila
50
50
  epinterface/sbem/prisma/migrations/20250326141941_reduce_naming_complexity_ventilation/migration.sql,sha256=tslwxYOfpbfWCUPqnOadTGk-BzluLcly27MV-mZy2Sc,2289
51
51
  epinterface/sbem/prisma/migrations/20250331141910_add_support_for_attic_and_basement_constructions/migration.sql,sha256=fvAzKga8qsMmVM3jLFDAlSbBkWbqRGrHu5Mf2doIEgs,6690
52
52
  epinterface/sbem/prisma/migrations/20250919152559_decouple_basement_infiltration/migration.sql,sha256=YrQJxHcU1jrKb6AlBSdfuJKETKkkyxqdKb-X8krBH-8,1876
53
- epinterface-1.0.1.dist-info/METADATA,sha256=aPgH-xHuqPojhGonAAKM_bPRj2MRq-hnZ9cLedCxpt4,3426
54
- epinterface-1.0.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
55
- epinterface-1.0.1.dist-info/entry_points.txt,sha256=bjjYRuHWvWV0d-QUesH6prRqHqcppTJANSuAfg3h9j8,78
56
- epinterface-1.0.1.dist-info/licenses/LICENSE,sha256=hNp6DmbGMuUcwlnpYS8E-ZHYU7kxfmRUP8pLGQaCnu8,1066
57
- epinterface-1.0.1.dist-info/RECORD,,
53
+ epinterface-1.0.3.dist-info/METADATA,sha256=V_hpPgy5kYUvOK7qMtdHPRSc8GW-iasrfQtxf_CM5mk,3426
54
+ epinterface-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
55
+ epinterface-1.0.3.dist-info/entry_points.txt,sha256=bjjYRuHWvWV0d-QUesH6prRqHqcppTJANSuAfg3h9j8,78
56
+ epinterface-1.0.3.dist-info/licenses/LICENSE,sha256=hNp6DmbGMuUcwlnpYS8E-ZHYU7kxfmRUP8pLGQaCnu8,1066
57
+ epinterface-1.0.3.dist-info/RECORD,,