Skip to content

Commit

Permalink
Handle missing causality and missing variability
Browse files Browse the repository at this point in the history
  • Loading branch information
nl78 committed Oct 26, 2024
1 parent 8946b1d commit 2fd01fb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fmutool/fmu_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ class FMUPort:
def __init__(self, attrs: Dict[str, str]):
self.name = attrs["name"]
self.vr = int(attrs["valueReference"])
self.causality = attrs["causality"]
self.causality = attrs.get("causality", "local")
self.attrs = attrs.copy()
self.attrs.pop("name")
self.attrs.pop("valueReference")
self.attrs.pop("causality")
if "causality" in self.attrs:
self.attrs.pop("causality")
self.type_name = None
self.child = None

Expand Down Expand Up @@ -52,10 +53,13 @@ def xml(self, vr: int, name=None, causality=None, start=None):
if causality is None:
causality = self.causality

variability = "continuous" if self.type_name == "Real" else "discrete"

scalar_attrs = {
"name": name,
"valueReference": vr,
"causality": causality
"causality": causality,
"variability": variability,
}
scalar_attrs.update(self.attrs)

Expand Down Expand Up @@ -173,6 +177,7 @@ def add_vr(self, type_name:str) -> int:
self.vr_table[type_name] += 1
return vr


class FMUContainer:
def __init__(self, identifier: str, fmu_directory: Union[str, Path]):
self.fmu_directory = Path(fmu_directory)
Expand Down

0 comments on commit 2fd01fb

Please sign in to comment.