Skip to content

Commit a689684

Browse files
committed
switching to dev
1 parent 23219b8 commit a689684

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

simpeg_drivers/components/topography.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,22 +101,24 @@ def active_cells(self, mesh: InversionMesh, data: InversionData) -> np.ndarray:
101101
self.params.active_cells.active_model, mesh.entity
102102
)
103103
else:
104-
centers = self.params.active_cells.topography_object.centroids
104+
topography = self.params.active_cells.topography_object
105+
locations = getattr(topography, "centroids", None) or self.locations
105106
xmin, xmax, ymin, ymax, zmin, zmax = mesh.entity.extent.ravel(order="F")
106107
mask = (
107-
(centers[:, 0] > xmin)
108-
& (centers[:, 0] < xmax)
109-
& (centers[:, 1] > ymin)
110-
& (centers[:, 1] < ymax)
111-
& (centers[:, 2] > zmin)
112-
& (centers[:, 2] < zmax)
108+
(locations[:, 0] > xmin)
109+
& (locations[:, 0] < xmax)
110+
& (locations[:, 1] > ymin)
111+
& (locations[:, 1] < ymax)
112+
& (locations[:, 2] > zmin)
113+
& (locations[:, 2] < zmax)
113114
)
114-
cells = self.params.active_cells.topography_object.cells[mask, :]
115+
116+
cells = getattr(topography, "cells", None)
115117
active_cells = active_from_xyz(
116118
mesh.entity,
117-
self.locations,
119+
locations,
118120
grid_reference="bottom" if forced_to_surface else "center",
119-
triangulation=cells,
121+
triangulation=cells[mask, :] or None,
120122
)
121123

122124
active_cells = (mesh.permutation @ active_cells).astype(bool)

0 commit comments

Comments
 (0)