improver.utilities.ancillary_creation module¶
-
class
improver.utilities.ancillary_creation.OrographicAlphas(min_alpha=0.0, max_alpha=1.0, coefficient=1, power=1, invert_alphas=True)[source]¶ Bases:
improver.BasePluginClass to generate alpha smoothing parameters for recursive filtering based on orography gradients.
-
__init__(min_alpha=0.0, max_alpha=1.0, coefficient=1, power=1, invert_alphas=True)[source]¶ Initialise class.
- Parameters
min_alpha (float) – The minimum value of alpha that you want to go into the recursive filter.
max_alpha (float) – The maximum value of alpha that you want to go into the recursive filter
coefficient (float) – The coefficient for the alpha calculation
power (float) – What power you want for your alpha equation
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
gradient_to_alpha(gradient_x, gradient_y)[source]¶ Generate alpha smoothing parameters from orography gradients in the x- and y- directions
- Parameters
gradient_x (iris.cube.Cube) – A cube of the normalised gradient in the x direction
gradient_y (iris.cube.Cube) – A cube of the normalised gradient in the y direction
- Returns
- tuple containing:
- alpha_x (iris.cube.Cube): A cube of orography-dependent
alphas calculated in the x direction.
- alpha_y (iris.cube.Cube): A cube of orography-dependent
alphas calculated in the y direction.
- Return type
(tuple)
-
process(cube)[source]¶ This creates the alpha cubes. It returns one for the x direction and one for the y direction. It uses the DifferenceBetweenAdjacentGridSquares plugin to calculate an average gradient across each grid square. These gradients are then used to calculate “alpha” smoothing arrays that are normalised between a user-specified max and min.
- Parameters
cube (iris.cube.Cube) – A 2D cube of the orography for the grid we want to get alphas for.
- Returns
- containing:
- alpha_x (iris.cube.Cube): A cube of orography-dependent
alphas calculated in the x direction.
- alpha_y (iris.cube.Cube): A cube of orography-dependent
alphas calculated in the y direction.
- Return type
-
static
scale_alphas(cubes, min_output=0, max_output=1)[source]¶ This scales a set of alphas from input cubes to range between the minimum and maximum alpha values.
- Parameters
cubes (iris.cube.CubeList) – A list of alpha cubes that we need to take the cube_max and cube_min from.
min_output (float) – The minimum value we want our alpha to be
max_output (float) – The maximum value we want our alpha to be
- Returns
A list of alpha cubes scaled to within the range specified.
- Return type
-
unnormalised_alphas(gradient_cube)[source]¶ This generates initial alpha values from gradients using a generalised power law, whose parameters are set at initialisation. Current defaults give an output alphas_cube equal to the input gradient_cube.
- Parameters
gradient_cube (iris.cube.Cube) – A cube of the normalised gradient
- Returns
The cube of initial unscaled alphas
- Return type
-
static
update_alphas_metadata(alphas_cube, cube_name)[source]¶ Update metadata in alphas cube. Remove any time coordinates and rename.
- Parameters
alphas_cube (iris.cube.Cube) – A cube of alphas with “gradient” metadata
cube_name (str) – A name for the resultant cube
- Returns
A cube of alphas with adjusted metadata
- Return type
-
-
class
improver.utilities.ancillary_creation.SaturatedVapourPressureTable(t_min=183.15, t_max=338.25, t_increment=0.1)[source]¶ Bases:
improver.BasePluginPlugin to create a saturated vapour pressure lookup table.
-
__init__(t_min=183.15, t_max=338.25, t_increment=0.1)[source]¶ Create a table of saturated vapour pressures that can be interpolated through to obtain an SVP value for any temperature within the range t_min –> (t_max - t_increment).
The default min/max values create a table that provides SVP values covering the temperature range -90C to +65.1C. Note that the last bin is not used, so the SVP value corresponding to +65C is the highest that will be used.
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
process()[source]¶ Create a saturated vapour pressure lookup table by calling the Utilities.saturation_vapour_pressure_goff_gratch function in psychrometric_calculations.Utilities.
- Returns
A cube of saturated vapour pressure values at temperature points defined by t_min, t_max, and t_increment (defined above).
- Return type
-