seisflows.tools.array

Tools useful for array manipulation in Seisflows

Module Contents

Functions

count_zeros(a)

Counts number of zeros in a list or array

sortrows(a[, return_index, return_inverse])

Sorts the rows of a numpy array. By default returns only the sorted array

uniquerows(a[, sort_array, return_index])

Finds unique rows of numpy array

gridsmooth(Z, span)

Smooths values on 2D rectangular grid

meshsmooth(v, mesh, span)

Smooths values on 2D unstructured mesh

mesh2grid(v, mesh)

Interpolates from an unstructured coordinates (mesh) to a structured

grid2mesh(V, grid, mesh)

Interpolates from structured coordinates (grid) to unstructured

seisflows.tools.array.count_zeros(a)

Counts number of zeros in a list or array

Parameters

a (list or np.array) – list to count the number of zeros in

Return type

int

Returns

number of zeros in a

seisflows.tools.array.sortrows(a, return_index=False, return_inverse=False)

Sorts the rows of a numpy array. By default returns only the sorted array

Parameters
  • a (np.array) – array to sort

  • return_index (bool) – return the indices and the sorted array

  • return_inverse (bool) – returns the inverse sorted array as well

seisflows.tools.array.uniquerows(a, sort_array=False, return_index=False)

Finds unique rows of numpy array

Parameters
  • a (np.array) – array to find rows of

  • sort_array (bool) – sort the rows before findingunique rows

  • return_index (bool) – return indices as well as the unique rows

seisflows.tools.array.gridsmooth(Z, span)

Smooths values on 2D rectangular grid

Note:

‘grid’: set of structured coordinates, ‘mesh’: set of unstructured coordinates

Parameters
  • Z (np.array) – array to smooth

  • span (float) – span to smooth along

Return type

np.array

Returns

smoothed array

seisflows.tools.array.meshsmooth(v, mesh, span)

Smooths values on 2D unstructured mesh

Note:

‘grid’: set of structured coordinates, ‘mesh’: set of unstructured coordinates

seisflows.tools.array.mesh2grid(v, mesh)

Interpolates from an unstructured coordinates (mesh) to a structured coordinates (grid)

seisflows.tools.array.grid2mesh(V, grid, mesh)

Interpolates from structured coordinates (grid) to unstructured coordinates (mesh)