improver.blending.blend_across_adjacent_points module

Module containing Blending classes that blend over adjacent points, as opposed to collapsing the whole dimension.

class TriangularWeightedBlendAcrossAdjacentPoints(coord, central_point, parameter_units, width)[source]

Bases: PostProcessingPlugin

Applies a weighted blend to the data using a triangular weighting function at each point in the specified dimension. The maximum weighting is applied to the specified point, and weighting decreases linearly for neighbouring points to zero at the specified triangle width.

Returns a cube with the same coordinates as the input cube, with each point in the dimension having been blended with the adjacent points according to a triangular weighting function of a specified width.

__init__(coord, central_point, parameter_units, width)[source]

Set up for a Weighted Blending plugin

Parameters:
  • coord (str) – The name of a coordinate dimension in the cube to be blended over.

  • central_point (Union[int, float]) – Central point at which the output from the triangular weighted blending will be calculated. This should be in the units of the units argument that is passed in. This value should be a point on the coordinate for blending over.

  • parameter_units (str) – The units of the width of the triangular weighting function and the units of the central_point. This does not need to be the same as the units of the coordinate being blending over, but it should be possible to convert between them.

  • width (float) – The width from the triangle’s centre point, in units of the units argument, which will determine the triangular weighting function used to blend that specified point with its adjacent points. Beyond this width the weighting drops to zero.

_abc_impl = <_abc_data object>
_find_central_point(cube)[source]

Find the cube that contains the central point, otherwise, raise an exception.

Parameters:

cube (Cube) – Cube containing input for blending.

Return type:

Cube

Returns:

Cube containing central point.

Raises:

ValueError – Central point is not available within the input cube.

process(cube)[source]

Apply the weighted blend for each point in the given dimension.

Parameters:

cube (Cube) – Cube containing input for blending.

Return type:

Cube

Returns:

A processed cube, with the same coordinates as the input central_cube. The points in one dimension corresponding to the specified coordinate will be blended with the adjacent points based on a triangular weighting function of the specified width.