YAC 3.21.0
Yet Another Coupler
Loading...
Searching...
No Matches
Distance-Nearest-Neighbour interpolation

Description

This method supports source and target fields that are defined on points at the grid corners, cells, or edges.

For each target point, this method searches for all source points within a specified search distance (i.e., inside a bounding circle) around the target point. Using the weighting method selected by the user, the interpolation stencil will be generated from the identified source points.

Grid connection information is not taken into account by this interpolation method.

There are different methods for defining the search distance for each target point see search distance.

The key difference between Distance-Nearest-Neighbour (DNN) and N-Nearest-Neighbour (NNN) is how source points are selected for interpolation. NNN searches for a fixed number of nearest source points (n) for each target point, resulting in a variable search distance but constant stencil size. In contrast, DNN searches within a specified distance around each target point, resulting in a variable number of source points depending on the local source point density. This makes DNN particularly suitable for grids with highly variable resolution or when adaptive stencil sizes based on target cell geometry are desired.

Remark: Here distances between two points on the surface of a unit sphere are defined as the angle between two vectors that point from the center of the sphere to the two points. In the configuration file, these distances are interpreted as degrees by default. An explicit unit suffix (deg, d, rad, r, case-insensitive) may be appended to override the default unit.

Options

  • Weighting method (default: weighted: distance_weighted)
    • arithmetic_average

      Simple average of all source points within the search distance

    • distance_weighted

      Inverse distance weighting

    • gauss_weighted

      Gaussian filter

      This method has an additional optional scaling parameter. Through empirical tests a good default value has be determined. (default: gauss_scale: YAC_INTERP_DNN_GAUSS_SCALE_DEFAULT)

    • rbf

      Radial basis function weighted average

      This method has an additional optional scaling parameter. (default: rbf_scale: YAC_INTERP_DNN_RBF_SCALE_DEFAULT)

  • Search distance (default: search_distance:cell_area:1.0) The search distance can be specified either as a fixed value in degree or computed from the target cell area.
    • Fixed search distance (fixed; no default)

      Valid range: 0.0 < search_distance <= 180.0

      Use a fixed search distance (in degree) around each target point.

    • Target cell area based (cell_area; no default)

      Valid range: 0.0 <= scale

      Compute the search distance from the target cell area. The search distance is calculated as the polar angle of a spherical cap with the same area as the target cell, multiplied by the scale factor specified in the search distance parameter.

      When using this option, the target field must be defined on points at cell centers.

  • Minimum number of source points per target point (default: n_min: 1)

    Valid range: 1 <= n_min

    A target point is only interpolated if at least n_min source points were found within its search distance. This can be used to avoid stencils that are based on very few source points in regions with a low source point density.

Remarks

This method is particularly useful when:

  • The number of source points within a region varies significantly
  • You want to interpolate based on a physical distance rather than a fixed number of points
  • The target cell size varies and you want adaptive search radii
  • You want to smooth out small-scale features from a high-resolution source field by selecting a search distance larger than these features, effectively averaging them out and reducing high-frequency noise

YAML example

Example using default values:

interpolation:
- dnn

Example with fixed search distance and weighting using arithmetic average:

interpolation:
- dnn:
weighted: arithmetic_average
search_distance:
fixed: 1.0 # 1 degree * 40000km / 360 = 111km

Example with cell area-based search distance and gauss filter based weighting:

interpolation:
- dnn:
weighted: gauss_weighted
gauss_scale: 1.0
search_distance:
cell_area: 2.0

Example that only interpolates target points for which at least three source points were found within the search distance:

interpolation:
- dnn:
weighted: arithmetic_average
n_min: 3
search_distance:
cell_area: 2.0