improver.spotdata.height_adjustment module

Applies height adjustment for height above ground level spot forecasts.

class SpotHeightAdjustment(neighbour_selection_method='nearest')[source]

Bases: BasePlugin

Class to adjust spot extracted “height above ground level” forecasts to account for differences between site height and orography grid square height. The spot forecast contains information representative of the associated grid point and as such this needs to be adjusted to reflect the true site altitude.

For realization or percentile data the vertical displacement is added on to each realization or percentile.

For probability data the data is interpolated between thresholds for each site and the equivalent set of thresholds relative to the site altitude extracted. Any new threshold that is above or below the original set of thresholds uses the highest or lowest threshold’s probability from the original cube respectively for that spot.

__init__(neighbour_selection_method='nearest')[source]
Parameters:

neighbour_selection_method (str) – The neighbour cube may contain one or several sets of grid coordinates that match a spot site. These are determined by the neighbour finding method employed. This keyword is used to extract the desired set of coordinates from the neighbour cube.

_abc_impl = <_abc_data object>
adjust_prob_cube(spot_cube, vertical_displacement)[source]

Adjust probability spot forecasts based on the vertical displacement of sites in relation to orography.

Parameters:
  • spot_cube (Cube) – A cube of spot forecasts. If this is a cube of probabilities then the units of the threshold coordinate must be convertible to metres as this is expected to represent a vertical coordinate. There must be at least two thresholds on this cube. If this is a cube of percentiles or realizations then the units of the cube must be convertible to metres as the cube is expected to represent a vertical profile.

  • vertical_displacement (Cube) – A cube containing information about the difference between spot data site height and the orography grid square height.

Return type:

Cube

Returns:

A cube with the same metadata and shape as spot_cube but with probabilities adjusted to be relative to the site altitude rather than grid square altitude.

process(spot_cube, neighbour)[source]

Adjusts spot forecast data to be relative to site height rather than grid square orography height.

Parameters:
  • spot_cube (Cube) – A cube of spot forecasts. If this is a cube of probabilities then the units of the threshold coordinate must be convertible to metres as this is expected to represent a vertical coordinate. There must be at least two thresholds on this cube. If this is a cube of percentiles or realizations then the units of the cube must be convertible to metres as the cube is expected to represent a vertical profile.

  • neighbour (Cube) – A cube containing information about the spot data sites and their grid point neighbours.

Return type:

Cube

Returns:

A cube of the same shape as spot_data but with data adjusted to account for the difference between site height and orography height.

Raises:

ValueError – If spot_cube is a probability cube and there are fewer than two thresholds.