Skip to content

Commit

Permalink
fix in get_slowness module
Browse files Browse the repository at this point in the history
the iteration failed if slowness is assigned to the cells
  • Loading branch information
dickyaz authored and bernard-giroux committed Feb 16, 2025
1 parent dac4772 commit 71821fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/ttcrpy/rgrid.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,11 @@ cdef class Grid3d:
self.grid.getSlowness(slown)
nx, ny, nz = self.shape
slowness = np.ndarray((nx*ny*nz,), order='F')
for i in range(slown.size()):
if self.cell_slowness:
slown_size = (nx - 1) * (ny - 1) * (nz - 1)
else:
slown_size = nx * ny * nz
for i in range(slown_size):
slowness[i] = slown[i]
return slowness.reshape((nx, ny, nz))

Expand Down Expand Up @@ -2173,7 +2177,11 @@ cdef class Grid2d:
self.grid.getSlowness(slown)
nx, nz = self.shape
slowness = np.ndarray((nx*nz,))
for i in range(slown.size()):
if self.cell_slowness:
slown_size = (nx - 1) * (nz - 1)
else:
slown_size = nx * nz
for i in range(slown_size):
slowness[i] = slown[i]
return slowness.reshape((nx, nz))

Expand Down

0 comments on commit 71821fd

Please # to comment.