improver.psychrometric_calculations.hail_size module
module to calculate hail_size
- class HailSize(model_id_attr=None)[source]
Bases:
BasePlugin
Plugin to calculate the diameter of the hail stones from input cubes cloud condensation level (ccl) temperature, cloud condensation level pressure, temperature on pressure levels, the height of the wet bulb freezing level above sea level and orography.
- From these, the values for three other cubes are calculated:
Temperature of the environment at 268.15K (-5 Celsius) and the pressure level where this occurs.
Temperature after a saturated ascent from ccl pressure to the pressure of the environment at 268.15K (-5 Celsius).
Temperature after a dry adiabatic descent from the pressure of the environment at 268.15K (-5 Celsius) to the ccl pressure.
- From these, two indexes are calculated as:
Temperature after a dry adiabatic descent - the temperature of the atmosphere at 268.15K
Temperature after a saturated ascent - the temperature of the atmosphere at 268.15K
These indexes can then be used to extract values of hail size depending on the wet bulb freezing altitude. The wet bulb freezing altitude is calculated by subtracting the orography from the wet bulb freezing altitude above sea level.
If the wet bulb freezing altitude is between 3350m and 4400m then the indexes are used to extract an initial hail value from the first table. A second table is then accessed to reduce the hail size. The second table is stored as a dictionary, with the key being the wet bulb freezing altitude and each column in the associated arrays referring to the previously calculated hail diameter being less than a pre-defined value. An updated hail_size is then extracted and stored.
If the wet_bulb_freezing_altitude is greater than 4400m then the hail size is set to 0 and if the wet bulb_freezing_altitude is less than 3350m then the originally calculated hail size is not altered.
Both tables are taken from Hand and Cappelluti (2011) which are a tabular versions of the graphs from Fawbush and Miller(1953)
- References
Hand, W., and G. Cappelluti. 2011. “A global hail climatology using the UK Met Office convection diagnosis procedure (CDP) and model analyses.” Meteorological Applications 18: 446-458. doi:https://doi.org/10.1002/met.236
Fawbush, E.J., and R.C. Miller. 1953. “A method for forecasting hailstone size at the earth’s surface.” Bulletin of the American Meteorological Society 34: 235-244. doi: https://doi.org/10.1175/1520-0477-34.6.235
- __init__(model_id_attr=None)[source]
Sets up Class :type model_id_attr:
Optional
[str
] :param model_id_attr: Name of model ID attribute to be copied from source cubes to output cube
- _abc_impl = <_abc_data object>
- check_cubes(ccl_temperature, ccl_pressure, temperature_on_pressure, wet_bulb_zero_asl, orography)[source]
Checks the size and units of input cubes and enforces the standard coord order
- Parameters:
ccl_temperature (
Cube
) – Cube of cloud condensation level temperatureccl_pressure (
Cube
) – Cube of cloud condensation level pressuretemperature_on_pressure (
Cube
) – Cube of environment temperature on pressure levelswet_bulb_zero_asl (
Cube
) – Cube of the height of the wet bulb freezing level above sea levelorography (
Cube
) – Cube of the orography height.
- Return type:
- static dry_adiabatic_descent_to_ccl(ccl_pressure, temperature_at_268, pressure_at_268)[source]
Calculates the temperature due to a dry adiabatic descent from the pressure of the environment at 268.15K to the cloud condensation level pressure.
- Parameters:
- Return type:
- Returns:
Cube of temperature after the dry adiabatic descent
- get_hail_size(vertical, horizontal, wet_bulb_zero)[source]
Uses the lookup_table and the vertical and horizontal indexes calculated to extract and store values from the lookup nomogram.
- The hail size will be set to 0 if
there are masked data points,
vertical or horizontal values are negative,
the wet bulb freezing altitude is greater that 4400m.
If the wet bulb freezing altitude is greater that 3300m then the hail_size is reduced.
- Parameters:
vertical (
ndarray
) – An n dimensional array containing the values used to calculate the vertical indexeshorizontal (
ndarray
) – An n dimensional array containing the values used to calculate the horizontal indexeswet_bulb_zero (
ndarray
) – An n dimensional array containing the height of the wet bulb freezing level
- Return type:
- Returns:
an n dimension array of values for the diameter of hail (mm)
- hail_size_data(temperature_at_268, pressure_at_268, ccl_pressure, ccl_temperature, humidity_mixing_ratio_at_ccl, wet_bulb_zero)[source]
Gets temperature of environment at 268.15K, temperature after a dry adiabatic descent from the pressure of air at 268.15K to ccl pressure and the temperature after a saturated ascent from ccl pressure to the pressure of air at 268.15K. From these values it calculates vertical and horizontal indices. It also masks data where the ccl_temperature is below 268.15K.
- Parameters:
temperature_at_268 (
Cube
) – Cube of the temperature of the environment at 268.15Kpressure_at_268 (
Cube
) – Cube of the pressure of the environment at 268.15Kccl_pressure (
Cube
) – Cube of cloud condensation level pressureccl_temperature (
Cube
) – Cube of cloud condensation level pressurehumidity_mixing_ratio_at_ccl (
array
) – Array of humidity mixing ratio at the pressure of the environment at the CCLwet_bulb_zero (
Cube
) – Cube of the height of the wet-bulb freezing level
- Return type:
- Returns:
An n dimensional array of diameter of hail stones (m)
- static make_hail_cube(hail_size, ccl_temperature, ccl_pressure, attributes)[source]
Puts the hail data into a cube with appropriate metadata
- Parameters:
- Return type:
- Returns:
A cube of the diameter of hail stones (m)
- static nomogram_values()[source]
Sets-up an array of a table containing possible diameter of hail stones(mm). It is a transposed version of the table in Hand and Cappelluti (2011).
The axes of the table are as follows: :rtype:
ndarray
Horizontal axis is calculated from two values: the temperature after a dry adiabatic descent from the pressure of atmosphere at 268.15K to the cloud condensation level pressure and the temperature of the atmosphere at 268.15K. Each column represents a value calculated as the temperature after the dry adiabatic descent minus the temperature of the atmosphere at 268.15K rounded to the nearest 0.5K.
The vertical axis is also calculated from two values: the temperature after a saturated ascent from the ccl pressure to the pressure of environment at 268.15K and the temperature of the atmosphere at 268.25K. Each row is represented by a value calculated as the temperature after the saturated ascent minus the temperature of the atmosphere at 268.15K rounded to the nearest 5K.
- process(ccl_temperature, ccl_pressure, temperature_on_pressure, wet_bulb_zero_height_asl, orography)[source]
Main entry point of this class
- Parameters:
ccl_temperature (
Cube
) – Cube of the cloud condensation level temperatureccl_pressure (
Cube
) – Cube of the cloud condensation level pressure.temperature_on_pressure (
Cube
) – Cube of temperature on pressure levelswet_bulb_zero_height_asl (
Cube
) – Cube of the height of the wet-bulb freezing level above sea levelorography (
Cube
) – Cube of the orography height.
- Return type:
- Returns:
Cube of hail diameter (m)
- static temperature_after_saturated_ascent_from_ccl(ccl_temperature, ccl_pressure, pressure_at_268, humidity_mixing_ratio_at_ccl)[source]
Calculates the temperature after a saturated ascent from the cloud condensation level to the pressure of the atmosphere at 268.15K
- Parameters:
ccl_temperature (
Cube
) – Cube of cloud condensation level temperatureccl_pressure (
Cube
) – Cube of cloud condensation level pressurepressure_at_268 (
Cube
) – Cube of the pressure of the environment at 268.15Khumidity_mixing_ratio_at_ccl (
array
) – Array of humidity mixing ratio at the pressure of the environment at the CCL
- Return type:
- Returns:
Cube of temperature after the saturated ascent
- updated_hail_size(hail_size, wet_bulb_height)[source]
Uses the updated_nomogram values dictionary to access an updated hail size based on the original predicted hail size and a wet bulb freezing height.
- Parameters:
hail_size (
array
) – Integers of hail diameter value taken from the original nomogramwet_bulb_height (
array
) – Floats of the height of the wet bulb freezing level
- Return type:
array
- Returns:
An updated value for the hail diameter (mm)
- static updated_nomogram()[source]
Sets up a dictionary of updated hail diameter values (mm).
The dictionary keys are the height of the wet bulb freezing level (m) where, when accessing at some height value, it should be rounded to the nearest lower value (e.g. 3549m should access 3350m key).
Each key has an associated list in which each element is a new hail diameter based on the original hail size that was calculated from nomogram_values table. Specifically each column associated hail size (mm) is [<5,<10,<20,<25,<50,<75,<100,<125]. The largest possible value where the equality still holds should be used.
If the wet bulb freezing height is less than 3350m then the original hail size is used. If the wet bulb freezing height is greater than 4400m then all hail sizes are set to 0.