Module: WrfLibrary::Measurand::ApparentTemperature

Defined in:
lib/wrf_library/measurand/apparent_temperature.rb

Overview

module to calculate the apparent temperature, more specific the australian apparent temperature as described in https://en.wikipedia.org/wiki/Apparent_temperature. The apparent temperature takes the water vapor pressure, the wind speed in 10 m and the air temperature to calculate the temperature. For lower temperatures the apparent temperatures the results are related to the wind chill while higher temperature are related to heat indices

Class Method Summary collapse

Class Method Details

.calculate_apparent_temperature(temperature, wind_speed, humidity, pressure) ⇒ Float

calculates the apparent temperature

Parameters:

  • temperature (Float)

    the air temperature in degree celcius

  • wind_speed (Float)

    the wind speed in kilometer per hour

  • humidity (Float)

    the vapor mixing ratio in kg/kg

  • pressure (Float)

    the air pressure in hectopascal

Returns:

  • (Float)

    the apparent temperature



18
19
20
# File 'lib/wrf_library/measurand/apparent_temperature.rb', line 18

def self.calculate_apparent_temperature(temperature, wind_speed, humidity, pressure)
  temperature + 0.33 * calculate_water_vapour_pressure(temperature, pressure, humidity) - 0.7 * wind_speed - 4.0
end

.calculate_water_vapour_pressure(temperature, pressure, humidity) ⇒ Float

calculates the water vapor pressure for the current condition

Parameters:

  • temperature (Float)

    the air temperature in degree celcius

  • humidity (Float)

    the vapor mixing ratio in kg/kg

  • pressure (Float)

    the air pressure in hectopascal

Returns:

  • (Float)

    the water vapor pressure



27
28
29
30
31
# File 'lib/wrf_library/measurand/apparent_temperature.rb', line 27

def self.calculate_water_vapour_pressure(temperature, pressure, humidity)
  relative_humidity = WrfLibrary::Measurand::RelativeHumidity.
                        calculate_relative_humidity(temperature, pressure, humidity)
  6.105 * (relative_humidity / 100) * Math.exp((17.27 * temperature) / (temperature + 237.7))
end