fill_nearest#

Fill missing NetCDF cells from nearest valid neighbours.

This interpolator should not be used on global scale as it will be slow.

The module fills spatial gaps in gridded NetCDF variables by copying values from the nearest valid source cell. For variables with a time dimension, the nearest source cells are selected from the first time slice and then reused for all time steps, preserving temporal variability at the selected source locations.

An optional mask can reserve cells that must remain outside the filled domain. Those masked cells are written with the configured fill value instead of being nearest-neighbour filled.

Authors - Simon Lüdke - Sebastian Müller

Functions#

fill(input_dir[, fname, output_dir, ...])

Fill missing values in matching NetCDF files with nearest neighbours.

fill_dataarray_with_nearest(array[, ...])

Fill missing values in a data array with nearest valid neighbours.

fill_nearest(input_dir[, fname, output_dir, ...])

Fill missing values in matching NetCDF files with nearest neighbours.

fill_one_file(input_file, input_dir, ...)

Fill all data variables in one NetCDF file and write the result.

nearest_indices(input_positions, ...)

Return nearest source indices for target coordinate positions.

read_mask(mask_file, mask_var)

Read a fixed output mask from a NetCDF variable.