Reference

Contents

Index

MetJl.calc.LCLMethod
LCL(pressure::Unitful.Pressure, T_air::Unitful.Temperature, dewpoint::Unitful.Temperature)

Calculates the lifting condensation level (LCL) of a parcel of air.

The LCL is the pressure level at which a parcel of air becomes saturated and begins to condense when lifted dry adiabatically from the surface. This function uses an iterative approach to find the LCL by comparing the specific humidity of the parcel at a given pressure level to the specific humidity at the surface.

Arguments:

  • pressure: The pressure at the surface in Unitful pressure units.
  • T_air: The temperature at the surface in Unitful temperature units.
  • dewpoint: The dew point temperature at the surface in Unitful temperature units.

Returns:

  • A tuple of two Unitful quantities: the temperature and pressure at the LCL.

Example:

julia> calc.LCL(1013.25u"hPa", 25u"°C", 20u"°C")
(291.9970210003215 K, 942 hPa)
source
MetJl.calc.add_height_to_pressureMethod

addheightto_pressure(pressure, height)

Adjusts the pressure level by adding a specified height, assuming standard atmospheric conditions.

This function uses a standard atmospheric model to convert the input pressure to a height, adds the specified height to this pressure level, and then converts the new height back to a pressure level using the same standard model.

Arguments:

  • pressure: The pressure level in a Unitful pressure unit.
  • height: The height to be added in a Unitful length unit.

Returns:

  • Unitful.Pressure: The new pressure level after adding the specified height, in hPa.

Example:

julia> calc.add_height_to_pressure(1000u"hPa",800u"m")
908.303207892483 hPa
source
MetJl.calc.add_pressure_to_heightMethod

addpressureto_height(height, pressure)

Adjusts a given height by a certain pressure difference to find the new height at which the adjusted pressure would occur.

This function uses standard atmospheric pressure to height conversion functions to determine the new height. It first converts the input height to meters and pressure to hectopascals (hPa), then finds the pressure level corresponding to the input height. Finally, it subtracts the given pressure from this pressure level to find the new height at which this adjusted pressure would occur.

Arguments:

  • height: The initial height in a Unitful length unit.
  • pressure: The pressure difference to be subtracted in a Unitful pressure unit.

Returns:

  • A Unitful.Length: The new height at which the adjusted pressure would occur.

Example:

julia> add_pressure_to_height(1000u"m", 10u"hPa")
1.0911907787454445 km
source
MetJl.calc.dewpointMethod

dewpoint(vapor_pressure)

Calculates the dew point temperature from the given vapor pressure.

This function uses the formula to convert the vapor pressure to the dew point temperature in Celsius, and then converts the result to Kelvin.

Arguments:

  • vapor_pressure: The vapor pressure in a Unitful pressure unit.

Returns:

  • Unitful.Temperature: The dew point temperature in Kelvin.

Example:

julia> calc.dewpoint(6.11u"hPa")
273.1455029235403 K
source
MetJl.calc.dewpoint_from_rhMethod

dewpointfromrh(T_air::Unitful.Temperature, RH::Real)

Calculates the dew point temperature given the air temperature and relative humidity.

This function uses the Magnus-Tetens approximation to estimate the saturation vapor pressure and iteratively adjusts the dew point temperature until the calculated vapor pressure matches the saturation vapor pressure corresponding to the dew point.

Arguments:

  • T_air::Unitful.Temperature: The current air temperature.
  • RH::Real: The relative humidity as a real number between 0 and 1.

Returns:

  • Unitful.Temperature: The dewpoint temperature in Kelvin.

Example:

julia> calc.dewpoint_from_rh(300u"K",0.5)
288.701999999987 K

julia> calc.dewpoint_from_rh([300,300,300]*u"K",[0.5,0.5,0.5])
3-element Vector{Quantity{Float64, 𝚯, Unitful.FreeUnits{(K,), 𝚯, nothing}}}:
 288.701999999987 K
 288.701999999987 K
 288.701999999987 K

Note:

  • The function assumes that the input temperature is in a Unitful temperature unit and the relative humidity is a real number between 0 and 1.
  • The function uses an iterative approach to find the dew point temperature, which may not converge for very low temperatures or high humidities.
source
MetJl.calc.dewpoint_from_shMethod

dewpointfromsh(pressure, q)

Calculates the dew point temperature from the given pressure and specific humidity.

This function uses the saturation vapor pressure formula to calculate the dew point temperature. It first converts the input pressure to hectopascals (hPa) and the specific humidity to grams per kilogram (g/kg). Then, it calculates the vapor pressure using the relationship between specific humidity, vapor pressure, and pressure. Finally, it uses the dewpoint function to find the dew point temperature corresponding to the calculated vapor pressure.

Arguments:

  • pressure::Unitful.Pressure: The atmospheric pressure.
  • q::Unitful.Quantity: The specific humidity as a ratio (g/kg).

Returns:

  • Unitful.Temperature: The dew point temperature.

Example:

julia> calc.dewpoint_from_sh(1013.25u"hPa", 0.01u"g/kg")
212.51310407992628 K
source
MetJl.calc.q_from_dewpointMethod
q_from_dewpoint(pressure, dewpoint)

Calculates the specific humidity (q) given the atmospheric pressure and dew point temperature.

This function uses the dew point temperature to calculate the saturation vapor pressure (e) using the vapor_pressure_from_dewpoint function, and then computes the specific humidity using the formula:

q = 0.622 * e / (pressure - 0.378 * e)

where:

  • q is the specific humidity (in kg/kg),
  • e is the saturation vapor pressure (in hPa),
  • pressure is the atmospheric pressure (in hPa),
  • dewpoint is the dew point temperature (in Kelvin).

Arguments:

  • pressure::Unitful.Pressure: The atmospheric pressure.
  • dewpoint::Unitful.Temperature: The dew point temperature.

Returns:

  • q Unitful.Quantity: The specific humidity (in g/kg).

Example:

julia> calc.q_from_dewpoint(983u"hPa", 298.15u"K")
20.303761468426334 g kg⁻¹
source
MetJl.calc.q_from_vapor_pressureMethod
q_from_vapor_pressure(pressure, vapor_pressure)

Calculates the specific humidity (q) from the given atmospheric pressure and vapor pressure.

This function uses the formula to convert vapor pressure to specific humidity, which is the ratio of the mass of water vapor to the total mass of the air. The formula takes into account the molecular weight difference between water vapor and dry air, and the assumption that the air behaves as an ideal gas.

Arguments:

  • pressure::Unitful.Pressure: The atmospheric pressure in which the vapor pressure is measured.
  • vapor_pressure::Unitful.Pressure: The vapor pressure of water in the air.

Returns:

  • q Unitful.Quantity: The specific humidity in grams per kilogram (g/kg).

Example: ```julia julia> calc.qfromvapor_pressure(1013.25u"hPa", 2.3u"hPa") 1.4131049133102709 g kg⁻¹

source
MetJl.calc.rh_from_dewpontMethod

rhfromdewpoint(T_air, dewpoint)

Calculates the relative humidity (RH) given the air temperature and dew point temperature.

This function uses the formula for saturation vapor pressure as a function of temperature to calculate the vapor pressures at the air temperature and dew point temperature, then computes the relative humidity as the ratio of these two vapor pressures.

Arguments:

  • T_air: The current air temperature in a Unitful temperature unit.
  • dewpoint: The dew point temperature in a Unitful temperature unit.

Returns:

  • A Unitful.Quantity: The relative humidity as a real number between 0 and 1.

Example:

julia> calc.rh_from_dewpont(300u"K",288u"K")
0.4779147464796312

julia> calc.rh_from_dewpont([300,300,300]u"K",[288,288,288]u"K")
3-element Vector{Float64}:
 0.4779147464796312
 0.4779147464796312
 0.4779147464796312
source
MetJl.calc.thetaMethod
theta(T_air, Pressure)

Calculates the potential temperature (θ) given the air temperature and pressure.

This function uses the formula for potential temperature, which is a measure of the temperature of air after it has been brought adiabatically to a reference pressure, usually 1000 hPa. The formula is:

θ = T_air * (1000 / Pressure)^0.286

Arguments:

  • T_air: The current air temperature in a Unitful temperature unit.
  • Pressure: The atmospheric pressure in a Unitful pressure unit.

Returns:

  • A Unitful.Quantity: The potential temperature in Kelvin.

Example:

julia> calc.theta(25u"°C", 800u"hPa")
317.79793975452117 K
source
MetJl.calc.vapor_pressure_from_dewpointMethod

vaporpressurefrom_dewpoint(dewPoint)

Calculates the saturation vapor pressure from the dew point temperature.

This function uses the Tetens formula to estimate the saturation vapor pressure from the dew point temperature. The Tetens formula is an approximation that is valid for temperatures between 0°C and 50°C.

Arguments:

  • dewPoint: The dew point temperature in a Unitful temperature unit.

Returns:

  • Unitful.Pressure: The saturation vapor pressure in hectopascals (hPa).

Example:

julia> calc.vapor_pressure_from_dewpoint(20u"°C")
23.397012933719008 hPa
source
MetJl.calc.wind_chill_indexMethod

windchillindex(windspeed, Tair)

Calculates the wind chill index (WCI) based on the wind speed and air temperature.

This function implements the formula for the wind chill index, which estimates the perceived temperature felt by the human body due to the cooling effect of the wind. The formula is:

WCI = (10 * sqrt(windspeed) - windspeed + 10.5) * (33 - T_air)

Arguments:

  • wind_speed: The wind speed in a Unitful velocity unit.
  • T_air: The air temperature in a Unitful temperature unit.

Returns:

  • A Unitful.Quantity: The wind chill index with units of kg*cal/m^2/h.

Example:

julia> calc.wind_chill_index(20u"m/s", 290u"K")
568.824956732432 cal kg m⁻² s⁻¹
source