Skip to content

Commit

Permalink
BUG: fix zslices for Cube class, which failed for non integer zinc
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrivenaes committed Jun 10, 2024
1 parent 7095d1b commit 4fa8336
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/xtgeo/cube/cube1.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,11 +430,7 @@ def xlines(self, values):
@property
def zslices(self):
"""Return the time/depth slices as an int array (read only)."""
# This is a derived property
zslices = range(
int(self.zori), int(self.zori + self.nlay * self.zinc), int(self.zinc)
)
return np.array(zslices)
return np.array(range(self.nlay)) # This is a derived property

@property
def traceidcodes(self):
Expand Down
1 change: 1 addition & 0 deletions tests/test_cube/test_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def test_create():
vec = xcu.values
xdim, _ydim, _zdim = vec.shape
assert xdim == 5, "NX from numpy shape "
assert xcu.zslices.tolist() == [0, 1, 2, 3]


@pytest.mark.parametrize(
Expand Down

0 comments on commit 4fa8336

Please sign in to comment.