Module: WrfLibrary::Measurand::Pressure

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

Overview

Helper module to calculate and modify pressure values

Class Method Summary collapse

Class Method Details

.reduce_pressure_to_sealevel(pressure, temperature, station_elevation) ⇒ Array

function to reduce the station pressure to sea level using the barometric formula with the arithmetic mean of the temperature from the station and reduced to sea level

Parameters:

  • pressure (Array)

    the array with the pressure values

  • temperature (Array)

    the array with the temperature values

  • station_elevation (Float)

    the elevation of the station above sea level

Returns:

  • (Array)

    the pressure values reduced to sea level



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/wrf_library/measurand/pressure.rb', line 15

def self.reduce_pressure_to_sealevel(pressure, temperature, station_elevation)
  r_0 = 287.05 # J/(kg*K)
  g = 9.80665 # m/s^2
  sealevel_pressure = Array.new()

  pressure.each_with_index { |entry, i|
    t_m = temperature[i] + station_elevation / 200 # approx. dT = 1 K / 100 m
    sealevel_pressure[i] = entry * Math.exp((g * station_elevation)/(r_0 * t_m))
  }

  sealevel_pressure
end