improver.generate_ancillaries.generate_topographic_zone_weights module¶
Module for generating the weights for topographic zones.
-
class
improver.generate_ancillaries.generate_topographic_zone_weights.GenerateTopographicZoneWeights[source]¶ Bases:
improver.BasePluginGenerate weights generated by determining where the orography lies within the topographic zones.
-
_abc_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version= 213¶
-
_abc_registry= <_weakrefset.WeakSet object>¶
-
static
add_weight_to_lower_adjacent_band(topographic_zone_weights, orography_band, midpoint, band_number)[source]¶ Once we have found the weight for a point in one band, we need to add 1-weight to the band below for points that are below the midpoint, unless the band being processed is the lowest band.
- Parameters
topographic_zone_weights (numpy.ndarray) – Weights that we have already calculated for the points within the orography band.
orography_band (numpy.ndarray) – All points within the orography band of interest.
midpoint (float) – The midpoint of the band the point is in.
band_number (float) – The index that corresponds to the band that is currently being processed.
- Returns
Topographic zone array containing the weights that we have already calculated for the points within the orography band that has been updated to account for the lower adjacent band.
- Return type
-
static
add_weight_to_upper_adjacent_band(topographic_zone_weights, orography_band, midpoint, band_number, max_band_number)[source]¶ Once we have found the weight for a point in one band, we need to add 1-weight to the band above for points that are above the midpoint, unless the band being processed is the uppermost band.
- Parameters
topographic_zone_weights (numpy.ndarray) – Weights that we have already calculated for the points within the orography band.
orography_band (numpy.ndarray) – All points within the orography band of interest.
midpoint (float) – The midpoint of the band the point is in.
band_number (float) – The index that corresponds to the band that is currently being processed.
max_band_number (float) – The highest index for the bands coordinate in the weights.
- Returns
Weights that we have already calculated for the points within the orography band that has been updated to account for the upper adjacent band.
- Return type
-
static
calculate_weights(points, band)[source]¶ Calculate weights where the weight at the midpoint of a band is 1.0 and the weights at the edge of the band is 0.5. The midpoint is assumed to be in the middle of the band.
- Parameters
points (numpy.ndarray) – The points at which to find the weights. e.g. np.array([125]) or np.array([125, 140]).
band (list) – The band to be used for determining the weight that the selected points should have within the band e.g. [100., 200.].
- Returns
The weights generated to indicate the contribution of each point to a band.
- Return type
-
process(orography, thresholds_dict, landmask=None)[source]¶ Calculate the weights depending upon where the orography point is within the topographic zones.
- Parameters
orography (iris.cube.Cube) – Orography on standard grid.
thresholds_dict (dict) – Definition of orography bands required. The expected format of the dictionary is e.g. {‘bounds’: [[0, 50], [50, 200]], ‘units’: ‘m’}
landmask (iris.cube.Cube) – Land mask on standard grid. If provided sea points are masked out in the output array.
- Returns
Cube containing the weights depending upon where the orography point is within the topographic zones.
- Return type
-