YetAnotherCoupler  2.4.1
Interpolation stack

Introduction

Individual interpolation methods may have limitations that prevents them from interpolating all required target field values. A typical solution is the definition of a fallback solution that tries to handle these remaining points.

YAC introduced the concept of the interpolation stack. It is a more general approach to defining fallback soluions. A interpolation stack is comprised of a list of one or more interpolation methods. To compute an interpolation, all required target field points are passed to the first method in a stack. This will try to generate interpolations for all target field points. The ones for which the memthod failed are passed to the next method in the stack. This is done until the end of the stack is reached.

There are no limitations on which interpolation methods can occure at which position in the stack as long as the respective methods are compatible with available source and target field data. This allows for a very flexible definition of an interpolation.

Example interpolation stacks

Average + Fixed

Description

A simple stack consist of an Average interpolation combined with Fixed value interpolation . The Average interpolation will fail for target points that are located outside of the region covered by the source grid or due to masked source points. The Fixed value interpolation will assign a fixed value (0.0 in this case) to these target points. This may be a fill value to ensure that the target model is able to continue working or it may be used to identify the respective points, which may help to debug potential problems.
(Grey target points are not interpolated and YAC will not assign any data to these points.)

Source field
Target field after AVG
Target field after FIXED

XML

<interpolation_requirements>
<interpolation method="average"
weighted="BARYCENTRIC_COORDINATE"
partial_coverage="false"/>
<interpolation method="fixed_value"
user_value="-1.0"/>
</interpolation_requirements>

HCSBB + N-Nearest-Neighbour

Description

A higher order stack consisting of an Hybrid cubic spherical Bernstein-B├ęzier patch interpolation with a N-Nearest-Neighbour interpolation fallback, which is used for the extrapolation of target points not covered by the source grid.
(Grey target points are not interpolated and YAC will not assign any data to these points.)

Source field
Target field after HCSBB
Target field after NNN

XML

<interpolation_requirements>
<interpolation method="bernstein_bezier"/>
<interpolation method="n-nearest_neighbor"
n="1"/>
</interpolation_requirements>

Source-Point-Mapping + Fixed

Description

A typical river-runoff stack can consist of Source to Target mapping combined with Fixed value interpolation. The Fixed value interpolation ensures that all target ocean cells receive a valid value in the get operation.
(Red cell indicate masked source cells or target cells that do not receive any data in the get operation.)

Source field
Target field after SPMAP
Target field after FIXED

XML

<interpolation_requirements>
<interpolation method="source_to_target_map"
weighted="ARITHMETIC_AVERAGE"
spread_distance="0.5"/>
<interpolation method="fixed_value"
user_value="0.0"/>
</interpolation_requirements>

Interpolation stack to file

YAC support the writing of the results of any interpolation stack to file. Such a file can contain the weights of multiple Interpolation methods and list of targets that receive a fixed value. The file is decomposition independent. It can be read in through the use of Interpolation from weight file.

You may want to write a file in order to inspect the results of the interpolation stack. YAC futher supports this by providing a tool that allows you to visualise a weight file (see Creating weight files and visualise them).

In case the weight generation for a specific interpolation stack is very costly, you can write out the results and reuse the precomputed weights in a later run. However, reading in and distributing the weights from file also takes some time. Therefore, it may often be quicker to recompute the weights for each run.

Via the weight files other software can also use weights computed by YAC. The other software would have to support the YAC weight file format or the weight file would have to be converted, if possible.

Writing is activated through the use of the ‹enforce_write_weight_file› tag.

XML

Writing

<interpolation_requirements>
<interpolation method="conservative"
order="1"
enforced_conservation="false"
partial_coverage="false"
normalisation="FRACAREA"/>
<interpolation method="fixed_value"
user_value="-9999.0"/>
</interpolation_requirements>
<enforce_write_weight_file filename="my_weight_file.nc">true</enforce_write_weight_file>

Reading

<interpolation_requirements>
<interpolation method="user_file"
filename="my_weight_file.nc"/>
</interpolation_requirements>