improver.orographic_enhancement module¶
This module contains a plugin to calculate the enhancement of precipitation over orography.
-
class
improver.orographic_enhancement.OrographicEnhancement[source]¶ Bases:
improver.BasePluginClass to calculate orographic enhancement from horizontal wind components, temperature and relative humidity.
References
- Alpert, P. and Shafir, H., 1989: Meso-Gamma-Scale Distribution of
Orographic Precipitation: Numerical Study and Comparison with Precipitation Derived from Radar Measurements. Journal of Applied Meteorology, 28, 1105-1117.
- Roe, G., 2005: Orographic Precipitation. Annual Review of Earth
and Planetary Sciences, 33, 645-671.
-
__init__()[source]¶ Initialise the plugin with thresholds from STEPS code. Usage as follows:
- Criteria for site orographic enhancement calculation:
3x3 mean topography height >= self.orog_thresh_m (20 m)
Relative humidity (fraction) >= self.rh_thresh_ratio (0.8)
v dot grad z (wind x topography gradient) >= self.vgradz_thresh_ms (0.0005 m/s)
- Parameters for calculating upstream contribution:
Maximum range of an upstream cell to contribute to the total enhancement (self.upstream_range_of_influence_km). This is 15 km in STEPS.
Cloud lifetime (self.cloud_lifetime_s) defines the standard deviation of the distance weighting function for upstream enhancement contributions. This is 102 seconds in STEPS.
Scaling factor by which to multiply the weighted sum of upstream contributions (self.efficiency_factor). This is 0.23265 in STEPS.
Create placeholder class members for regridded variable cubes (orography, temperature, humidity, pressure and wind components), saturation vapour pressure, V.gradZ (uplift) array and grid spacing.
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
_add_upstream_component(point_orogenh)[source]¶ Add upstream component to site orographic enhancement
- Parameters
point_orogenh (numpy.ndarray) – Site orographic enhancement in mm h-1
- Returns
Total orographic enhancement in mm h-1
- Return type
-
_compute_weighted_values(point_orogenh, x_source, y_source, distance, wind_speed)[source]¶ Extract orographic enhancement values from source points and weight according to source-destination distance.
- Parameters
point_orogenh (numpy.ndarray) – 2D array of point orographic enhancement values
x_source (numpy.ndarray) – 3D array of x-coordinates of source points from which to read upstream contribution
y_source (numpy.ndarray) – 3D array of y-coordinates of source points from which to read upstream contribution
distance – 3D array of grid point source-to-destination distances
wind_speed – 2D array of wind speeds
- Returns
- tuple containing:
- orogenh (numpy.ndarray):
2D array containing a weighted sum of orographic enhancement components from upstream source points
- sum_of_weights (numpy.ndarray):
2D array containing weights for normalisation
- Return type
(tuple)
-
_create_output_cube(orogenh_data, reference_cube)[source]¶ Creates a cube containing orographic enhancement values in SI units.
- Parameters
orogenh_data (numpy.ndarray) – Orographic enhancement value in mm h-1
reference_cube (iris.cube.Cube) – Cube with the correct time and forecast period coordinates on the UK standard grid
- Returns
Orographic enhancement cube (m s-1)
- Return type
-
_generate_mask()[source]¶ Generates a boolean mask of areas NOT to calculate orographic enhancement. Criteria for calculating orographic enhancement are that all of the following are true:
3x3 mean topography height >= threshold (20 m)
Relative humidity (fraction) >= threshold (0.8)
v dot grad z (wind x topography gradient) >= threshold (0.0005)
The mask is therefore “True” if any of these conditions are false.
- Returns
Boolean mask - where True, set orographic enhancement to a default zero value
- Return type
-
_get_point_distances(wind_speed, max_sin_cos)[source]¶ Generate 3d array of distances to upstream components
- Parameters
wind_speed (numpy.ndarray) – 2D array of wind speeds
max_roi (numpy.ndarray) – 2D array of maximum ranges of influence in grid squares
max_sin_cos (numpy.ndarray) – 2D array containing the larger of sin(wind_direction) or cos(wind_direction) with respect to grid north
- Returns
3D array of source-to-destination distances in grid points, with np.nan filled in for out of range values
- Return type
-
static
_locate_source_points(wind_speed, distance, sin_wind_dir, cos_wind_dir)[source]¶ Generate 3D arrays of source points from which to add upstream orographic enhancement contribution. Assumes spatial coordinate ordering [y, x].
- Parameters
wind_speed (numpy.ndarray) – 2D array of wind speed magnitudes
distance (numpy.ndarray) – 3D array of grid point source-to-destination distances
sin_wind_dir (numpy.ndarray) – 2D array of sin wind direction wrt grid north
cos_wind_dir (numpy.ndarray) – 2D array of cos wind direction wrt grid north
- Returns
- tuple containing:
- x_source (numpy.ndarray):
3D array of source point x-coordinates
- y_source (numpy.ndarray):
3D array of source point y-coordinates
- Return type
(tuple)
-
_orography_gradients()[source]¶ Calculates the dimensionless gradient of self.topography along both spatial axes, smoothed along the perpendicular axis. If spatial coordinates are not in the same units as topography height (m), converts coordinate units in place.
- Returns
- tuple containing:
- gradx (iris.cube.Cube):
2D cube of dimensionless topography gradients in the positive x direction
- grady (iris.cube.Cube):
2D cube of dimensionless topography gradients in the positive y direction
- Return type
(tuple)
-
_point_orogenh()[source]¶ Calculate the grid-point precipitation enhancement contribution due to orographic uplift using:
- orogenh = ((humidity * svp * vgradz) /
(R_WATER_VAPOUR * temperature)) * 60 * 60
- Returns
Orographic enhancement values in mm/h
- Return type
-
_regrid_and_populate(temperature, humidity, pressure, uwind, vwind, topography)[source]¶ Regrids input variables onto the high resolution orography field, then populates the class instance with regridded variables before converting to SI units. Also calculates V.gradZ as a class member.
- Parameters
temperature (iris.cube.Cube) – Temperature at top of boundary layer
humidity (iris.cube.Cube) – Relative humidity at top of boundary layer
pressure (iris.cube.Cube) – Pressure at top of boundary layer
uwind (iris.cube.Cube) – Positive eastward wind vector component at top of boundary layer
vwind (iris.cube.Cube) – Positive northward wind vector component at top of boundary layer
topography (iris.cube.Cube) – Height of topography above sea level on 1 km UKPP domain grid
-
_regrid_variable(var_cube, unit)[source]¶ Sorts spatial coordinates in ascending order, regrids the input variable onto the topography grid and converts to the required units. This function does not modify the input variable cube.
- Parameters
var_cube (iris.cube.Cube) – Cube containing input variable data
unit (str) – Required unit for this variable
- Returns
Cube containing regridded variable data
- Return type
-
process(temperature, humidity, pressure, uwind, vwind, topography)[source]¶ Calculate precipitation enhancement over orography on high resolution grid. Input diagnostics are all expected to be on the same grid, and are regridded to match the orography.
- Parameters
temperature (iris.cube.Cube) – Temperature at top of boundary layer
humidity (iris.cube.Cube) – Relative humidity at top of boundary layer
pressure (iris.cube.Cube) – Pressure at top of boundary layer
uwind (iris.cube.Cube) – Positive eastward wind vector component at top of boundary layer
vwind (iris.cube.Cube) – Positive northward wind vector component at top of boundary layer
topography (iris.cube.Cube) – Height of topography above sea level on high resolution (1 km) UKPP domain grid
- Returns
Precipitation enhancement due to orography in m/s.
- Return type