pencil.calc.fill_gaps_in_grid

Functions

fill_gaps_in_grid(array[, key, steps, order, DEBUG])

Interpolates nans by nearest neighbor method to fill gaps in arrays.

Module Contents

pencil.calc.fill_gaps_in_grid.fill_gaps_in_grid(array, key='nan', steps=['interpolate', 'extrapolate'], order=1, DEBUG=False)

Interpolates nans by nearest neighbor method to fill gaps in arrays. Beware this method does not invoke bondaries correctly! This method does not work with array beeing a vector field! Hence, use componentwise and stitch together manually!

Parameters:
  • array (-) – array with nans inside

  • key (-) – indicates array entries that will be interpolated

  • method (-) – as specified in scipy.interpolate.griddata, i.e. use ‘linear’ for 3D data

Returns:

array without nans inside.

Example

[[0, 1, 0], [[0, 1, 0,],

[1, nan, 1], -interpol-> [1, 2, 1], [0, 1, 0]] [0, 1, 0]]