xlandsat.interpolate_missing#
- xlandsat.interpolate_missing(scene, pixel_radius=20, method='cubic')[source]#
Fill missing values (NaNs) in a scene by interpolation
Each missing value is filled by interpolating the pixels within a neighboring region (controlled by
pixel_radius
) using a piecewise cubic 2D interpolator. Interpolation is done for each band in a scene separately.Note that this is mostly good if there are a few missing values, not large regions of the scene.
- Parameters:
scene (
xarray.Dataset
) – A Landsat scene, as read withxlandsat.load_scene
.pixel_radius (int) – Number of pixels to the east, west, south, and north of a missing value that will be used for interpolation. Smaller values make for faster interpolation but may lead to bad results if many missing values are grouped together.
method (str) – The interpolation method used. Can be one of:
"cubic"
for cubic interpolation withscipy.interpolate.CloughTocher2DInterpolator
,"neighbors"
for nearest neighbor interpolation withscipy.interpolate.NearestNDInterpolator
.
- Returns:
filled_scene (
xarray.Dataset
) – The scene with missing values filled in.