@@ -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