Skip to content

Commit 2572749

Browse files
committed
fix: updating stratigraphic column, need update loopstructural.
Reading from dict was reversing column.
1 parent 50cec1b commit 2572749

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

loopstructural/gui/modelling/stratigraphic_column/stratigraphic_column.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def update_display(self):
6767
"""Update the widget display based on the data manager's stratigraphic column."""
6868
self.unitList.clear()
6969
if self.data_manager and self.data_manager._stratigraphic_column:
70-
for unit in reversed(self.data_manager._stratigraphic_column.order):
70+
for unit in self.data_manager._stratigraphic_column.order:
7171
if unit.element_type == StratigraphicColumnElementType.UNIT:
7272
self.add_unit(unit_data=unit.to_dict(), create_new=False)
7373
elif unit.element_type == StratigraphicColumnElementType.UNCONFORMITY:

loopstructural/main/data_manager.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,6 @@ def from_dict(self, data):
466466
self._structural_orientations = data['structural_orientations']
467467
if 'stratigraphic_column' in data:
468468
self._stratigraphic_column = StratigraphicColumn.from_dict(data['stratigraphic_column'])
469-
print([o.name for o in self._stratigraphic_column.order])
470469
self.stratigraphic_column_callback()
471470

472471
def update_from_dict(self, data):
@@ -537,11 +536,10 @@ def update_from_dict(self, data):
537536
if 'stratigraphic_column' in data:
538537
self._stratigraphic_column.update_from_dict(data['stratigraphic_column'])
539538
else:
540-
self._stratigraphic_column = StratigraphicColumn()
539+
self._stratigraphic_column.clear()
541540

542541
if self.stratigraphic_column_callback:
543542
self.stratigraphic_column_callback()
544-
print([o.name for o in self._stratigraphic_column.order])
545543

546544

547545
def find_layer_by_name(self, layer_name):

loopstructural/main/model_manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,16 @@ def __call__(self, line: gpd.GeoDataFrame, dem: Callable, use_z: bool) -> pd.Dat
6363
{'X': x, 'Y': y, 'Z': z, 'feature_id': feature_id, **attributes}
6464
)
6565
elif geom.geom_type == 'Point':
66-
x, y = geom.x, geom.y
66+
67+
coords = list(geom.coords[0])
6768
# Use Z from geometry if available, otherwise use DEM
68-
if use_z and hasattr(geom, 'z'):
69-
z = geom.z
69+
if use_z and len(coords) > 2:
70+
z = coords[2]
71+
elif dem is not None:
72+
z = dem(coords[0], coords[1])
7073
else:
71-
z = dem(x, y)
72-
points.append({'X': x, 'Y': y, 'Z': z, 'feature_id': feature_id, **attributes})
74+
z = 0
75+
points.append({'X': coords[0], 'Y': coords[1], 'Z': z, 'feature_id': feature_id, **attributes})
7376
feature_id += 1
7477
df = pd.DataFrame(points)
7578
return df

0 commit comments

Comments
 (0)