pyinterp.fill.multigrid

Contents

pyinterp.fill.multigrid#

pyinterp.fill.multigrid(grid, config=None, *, max_iterations=None, epsilon=None, pre_smooth=None, post_smooth=None, first_guess=None, is_periodic=None, num_threads=None)[source]#

Fill missing values using multigrid method.

Parameters:
  • grid (_FloatArrayT) – 2D grid with missing values (NaN)

  • config (Multigrid | None) – Configuration object (if provided, keyword args are ignored)

  • max_iterations (int | None) – Maximum number of iterations

  • epsilon (float | None) – Convergence criterion

  • pre_smooth (int | None) – Number of pre-smoothing iterations

  • post_smooth (int | None) – Number of post-smoothing iterations

  • first_guess (Literal['zero', 'zonal_average'] | None) – Initial guess method

  • is_periodic (bool | None) – Whether to assume periodic boundaries

  • num_threads (int | None) – Number of threads (0 = auto)

Returns:

Tuple of (number of iterations, final residual)

Return type:

tuple[int, float]

Examples

>>> iterations, residual = multigrid(
...     grid,
...     max_iterations=100,
...     epsilon=1e-5,
...     pre_smooth=2,
...     post_smooth=2,
... )