Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regridding/_fill/_fill.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def fill(
kwargs
Additional method-specific keyword arguments.
For the Gauss-Seidel method, the valid keyword arguments are:
- ``guess=np.median(a[where], axis)``, the first guess at the fill value.
- ``num_iterations=100``, the number of red-black Gauss-Seidel iterations to perform.

Examples
Expand Down
8 changes: 6 additions & 2 deletions regridding/_fill/_gauss_seidel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ def fill_gauss_seidel(
a: np.ndarray,
where: np.ndarray,
axis: None | int | Sequence[int],
guess: None | float | np.ndarray = None,
num_iterations: int = 100,
) -> np.ndarray:

a = a.copy()

a, where = np.broadcast_arrays(a, where, subok=True)
if guess is None:
guess = np.median(a[where], axis=axis)

a[where] = 0
a, where, guess = np.broadcast_arrays(a, where, guess, subok=True)

a[where] = guess[where]

axis = regridding._util._normalize_axis(axis=axis, ndim=a.ndim)
axis_numba = ~np.arange(len(axis))[::-1]
Expand Down
Loading