Skip to content

Commit 56783ea

Browse files
committed
incomplete tops
1 parent 3694714 commit 56783ea

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

deepfield/field/field.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -969,11 +969,12 @@ def _add_welltracks(self, plotter):
969969
np.arange(0, count, 2),
970970
np.arange(1, count, 2)]).T
971971

972-
mesh = pv.PolyData(np.vstack(vertices), lines=np.vstack(faces))
973-
plotter.add_mesh(mesh, name='wells', color='b', line_width=3)
972+
if vertices:
973+
mesh = pv.PolyData(np.vstack(vertices), lines=np.vstack(faces))
974+
plotter.add_mesh(mesh, name='wells', color='b', line_width=3)
974975

975-
mesh = pv.PolyData(vertices_connectors, lines=faces_connectors)
976-
plotter.add_mesh(mesh, name='well_connectors', color='k', line_width=2)
976+
mesh = pv.PolyData(vertices_connectors, lines=faces_connectors)
977+
plotter.add_mesh(mesh, name='well_connectors', color='k', line_width=2)
977978

978979
return labeled_points
979980

deepfield/field/grids.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,13 @@ def _to_spatial(self, attr, **kwargs):
215215
_ = kwargs
216216
data = getattr(self, attr)
217217
if isinstance(data, np.ndarray) and data.ndim == 1:
218-
if attr in ['ACTNUM', 'DX', 'DY', 'DZ', 'TOPS']:
218+
if attr in ['ACTNUM', 'DX', 'DY', 'DZ']:
219219
data = data.reshape(self.dimens, order='F')
220+
elif attr == 'TOPS':
221+
if data.size == np.prod(self.dimens):
222+
data = data.reshape(self.dimens, order='F')
223+
else:
224+
data = data.reshape(self.dimens[:2], order='F')
220225
elif attr == 'COORD':
221226
nx, ny, nz = self.dimens
222227
data = data.reshape(-1, 6)
@@ -271,6 +276,11 @@ def __init__(self, **kwargs):
271276
tops = np.zeros(self.dimens)
272277
tops[..., 1:] = np.cumsum(self.dz, axis=-1)[..., :-1]
273278
setattr(self, 'TOPS', tops)
279+
elif self.tops.ndim == 2 and 'DZ' in self:
280+
tops = np.zeros(self.dimens)
281+
tops[..., 1:] = np.cumsum(self.dz, axis=-1)[..., :-1]
282+
tops += self.tops[:, :, None]
283+
setattr(self, 'TOPS', tops)
274284

275285
def get_xyz(self, ijk=None):
276286
"""Get x, y, z coordinates of cell vertices."""

0 commit comments

Comments
 (0)