Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

    • t: temperature (K)
    • r: relative humidity ([0-1]%)

The result is the dewpoint temperature in K units. On error nil is returned. The computation is based on the following formula:

...

vector dewpoint_from_specific_humidity(q: vector, p: vector)fieldset dewpoint_from_specific_humidity(q: fieldset)

fieldset dewpoint_from_specific_humidity(q: fieldset, [p: fieldset])

Computes the dewpoint temperature from the given specific humidity and pressure, where

...

The result is the relative humidity in the range of [0, 1]% units. On error  nil is returned. The computation is based on the following formula:

...

where ewsat is the saturation vapour pressure over water.


Anchor
saturation_mixing_ratiosaturation_mixing_ratio

number saturation_mixing_ratio(t: number, p: number)

...

relative_humidity_from_specific_humidity
relative_humidity_from_specific_humidity

number relative_humidity_from_specific_humidity(t: number, q: number, p: number

...

)

vector

...

relative_humidity_from_specific_humidity(t: vector, q: vector, p: vector)

vector saturation_mixing_ratio(t: vector, p: vector, phase)

...

fieldset relative_humidity_from_specific_humidity(t: fieldset, q: fieldset, [p: fieldset])

New in Metview version 5.14.0.

Computes the relative humidity from the given temperature and specific humidity and pressure where

    • t:
  • the
    • temperature (K)
    • q: specific humidity (kg/kg)
    • p:
  • the
    • pressure (Pa)
  • phase: is either "water", "ice" or "mixed". When it is not specified the "water" phase is used.

The result is the saturation mixing ratio in kg/kg units. On error The result is the relative humidity in % units. On error nil is returned. The computation is implemented via the following function calls:

ws = mixing_ratio(p, saturation_vapour_pressure(t, phase))

...

following rules are applied when t and q are fieldset objects:

    • if t is a pressure level fieldset no p is needed
    • if t is defined on ECMWF model levels (hybrid/eta) p must be either a single LNSP (logarithm of surface pressure, identified by paramId=152) field or a fieldset defining the pressure on the same levels as t
    • for other level types p must be a fieldset defining the pressure on the same levels as t.

When the result is a fieldset the ecCodes paramId in the output is set to 157 (=relative humidity). The computation is based on the following formula:

Mathdisplay
r = 100 \frac {e(q, p)}{e_{msat}(t)}

where:

    • e is the vapour pressure (see vapour_pressure())
    • emsat is the saturation vapour pressure based on the "mixed" phase (see saturation_vapour_pressure())
    • q is the specific humidity
    • p is the pressure
    • t is the temperature


Anchor
saturation_mixing_ratio
saturation_mixing_ratio

number saturation_mixing_ratio(t: number, p: number, [phase])

vector saturation_mixing_ratio(t: vector, p: vector, [phase])

Computes the saturation mixing ratio for a given temperature, pressure and phase where

    • t: the temperature (K)
    • p: the pressure (Pa)
    • phase: is either "water", "ice" or "mixed". When it is not specified the "water" phase is used.

The result is the saturation mixing ratio in kg/kg units. On error nil is returned. The computation is implemented via the following function calls:

ws = mixing_ratio(p, saturation_vapour_pressure(t, phase))


Anchor
saturation_vapour_pressure
saturation_vapour_pressure

number saturation_vapour_pressure(t: number, [phase])

vector saturation_vapour_pressure(t: vector, [phase])

fieldset saturation_vapour_pressure(t: fieldset, [phase])

Computes the saturation vapour pressure for a given temperature and phase, where

    • t: the temperature (K)
    • phase: is either "water", "ice" or "mixed". When it is not specified the "water" phase is used.

The result is the saturation vapour pressure in Pa units. On error nil is returned. The computations for saturation over "water" and "ice" are based on the Tetens formula:

Mathdisplay
e_{sat} = a_{1}\;exp \left(a_{3}\frac{T-273.16}{T-a_{4}}\right)

where the parameters are set as follows

    • "water": a1=611.21 Pa, a3=17.502 and a4=32.19 K
    • "ice": a1=611.21 Pa, a3=22.587 and a4=-0.7 K

For the "mixed" phase  the linear combination of the "water" and "ice" phases are used as described in the IFS documentation (see here on p116 for details for model cycle CY45R1).


fieldset seqpott_m(...)

Computes the saturation equivalent potential temperature from fieldsets on (hybrid) model levels. This is a Metview icon function, for detailed documentation please see Potential Temperature.


fieldset seqpott_p(...)

Computes the saturation equivalent potential temperature from fieldsets on pressure levels. This is a Metview icon function, for detailed documentation please see Potential Temperature.


Anchor
specific_humidity_from_relative_humidity
specific_humidity_from_relative_humidity

number specific_humidity_from_relative_humidity(t: number, r: number, p:number)

vector specific_humidity_from_relative_humidity(t: vector, r: vector, p:vector)

fieldset specific_humidity_from_relative_humidity(t: fieldset, r: fieldset, p:fieldset)

New in Metview version 5.14.0.

Computes the specific humidity from the given temperature, relative_humidity and pressure, where:

    • t: temperature (K)
    • r: relative humidity (%)
    • p: pressure (Pa)

The result is the specific humidity in kg/kg units. On error nil is returned. The following rules are applied when t and r are fieldset objects:

    • if t is a pressure level fieldset no p is needed
    • if t is defined on ECMWF model levels (hybrid/eta) p must be either a single LNSP (logarithm of surface pressure, identified by paramId=152) field or a fieldset defining the pressure on the same levels as t
    • for other level types p must be a fieldset defining the pressure on the same levels as t

When the result is a fieldset the ecCodes paramId in the output is set to 133 (=specific humidity). The computation is based on the following equation:

Mathdisplay
r = 100 \frac {e(q, p)}{e_{msat}(t)}

where

    • e is the vapour pressure (see vapour_pressure())
    • emsat is the saturation vapour pressure based on the "mixed" phase (see saturation_vapour_pressure())
    • r is the relative humidity
    • p is the pressure
    • t is the temperature

...

number saturation_vapour_pressure(t: number)

number saturation_vapour_pressure(t: number, phase)

vector saturation_vapour_pressure(t: vector)

vector saturation_vapour_pressure(t: vector, phase)

fieldset saturation_vapour_pressure(t: fieldset)

fieldset saturation_vapour_pressure(t: fieldset, phase)

Computes the saturation vapour pressure for a given temperature and phase, where

    • t: the temperature (K)
    • phase: is either "water", "ice" or "mixed". When it is not specified the "water" phase is used.

The result is the saturation vapour pressure in Pa units. On error nil is returned. The computations for saturation over "water" and "ice" are based on the Tetens formula:

Mathdisplay
e_{sat} = a_{1}\;exp \left(a_{3}\frac{T-273.16}{T-a_{4}}\right)

where the parameters are set as follows

    • "water": a1=611.21 Pa, a3=17.502 and a4=32.19 K
    • "ice": a1=611.21 Pa, a3=22.587 and a4=-0.7 K

For the "mixed" phase  the linear combination of the "water" and "ice" phases are used as described in the IFS documentation (see here on p116 for details for model cycle CY45R1).

fieldset seqpott_m(...)

Computes the saturation equivalent potential temperature from fieldsets on (hybrid) model levels. This is a Metview icon function, for detailed documentation please see Potential Temperature.

fieldset seqpott_p(...)

...


Anchor
temperature_from_potential_temperature
temperature_from_potential_temperature

...