improver.spotdata.apply_lapse_rate module

Apply temperature lapse rate adjustments to a spot data cube.

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

Bases: PostProcessingPlugin

Adjusts spot data temperatures by a lapse rate to better represent the conditions at their altitude that may not be captured by the model orography.

__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. The methods available will be all, or a subset, of the following:

- nearest
- nearest_land
- nearest_land_minimum_dz
- nearest_minimum_dz

The method available in a neighbour cube will depend on the options that were specified when it was created.

_abc_impl = <_abc_data object>
process(spot_data_cube, neighbour_cube, gridded_lapse_rate_cube)[source]

Extract lapse rates from the appropriate grid points and apply them to the spot extracted temperatures.

The calculation is:

lapse_rate_adjusted_temperatures = temperatures + lapse_rate *
vertical_displacement
Parameters
  • spot_data_cube (Cube) – A spot data cube of temperatures for the spot data sites, extracted from the gridded temperature field. These temperatures will have been extracted using the same neighbour_cube and neighbour_selection_method that are being used here.

  • neighbour_cube (Cube) – The neighbour_cube that contains the grid coordinates at which lapse rates should be extracted and the vertical displacement between those grid points on the model orography and the spot data sites actual altitudes. This cube is only updated when a new site is added.

  • gridded_lapse_rate_cube (Cube) – A cube of temperature lapse rates on the same grid as that from which the spot data temperatures were extracted.

Return type

Cube

Returns

A copy of the input spot_data_cube with the data modified by the lapse rates to give a better representation of the site’s temperatures.

Raises
  • ValueError – If the lapse rate cube was provided but the diagnostic being processed is not air temperature.

  • ValueError – If the lapse rate cube provided does not have the name “air_temperature_lapse_rate”

  • ValueError – If the lapse rate cube does not contain a single valued height coordinate.

Warns

warning – If a lapse rate cube was provided, but the height of the temperature does not match that of the data used.