Skip to content

Commit eef12b4

Browse files
committed
fix: check id type when creating and use add id to/from dict
1 parent b5574a1 commit eef12b4

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

LoopStructural/modelling/core/stratigraphic_column.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __init__(self, *, uuid=None, name=None, colour=None, thickness=None, data=No
5757
self._thickness = thickness
5858
self.data = data
5959
self.element_type = StratigraphicColumnElementType.UNIT
60-
self._id = id
60+
self.id = id
6161
self.min_value = None # Minimum scalar field value for the unit
6262
self.max_value = None # Maximum scalar field value for the unit
6363
@property
@@ -99,7 +99,7 @@ def to_dict(self):
9999
colour = self.colour
100100
if isinstance(colour, np.ndarray):
101101
colour = colour.astype(float).tolist()
102-
return {"name": self.name, "colour": colour, "thickness": self.thickness, 'uuid': self.uuid}
102+
return {"name": self.name, "colour": colour, "thickness": self.thickness, 'uuid': self.uuid, 'id': self.id}
103103

104104
@classmethod
105105
def from_dict(cls, data):
@@ -112,7 +112,7 @@ def from_dict(cls, data):
112112
colour = data.get("colour")
113113
thickness = data.get("thickness", None)
114114
uuid = data.get("uuid", None)
115-
return cls(uuid=uuid, name=name, colour=colour, thickness=thickness)
115+
return cls(uuid=uuid, name=name, colour=colour, thickness=thickness, id=data.get("id", None))
116116

117117
def __str__(self):
118118
"""

0 commit comments

Comments
 (0)