Class: WrfForecast::Threshold::PressureThreshold

Inherits:
BaseThreshold show all
Defined in:
lib/wrf_forecast/threshold/pressure_threshold.rb

Overview

This class determines the significant pressure thresholds for a forecast day. That means that this class can only work correctly if the data represents a time span of up to 24 hours. The indicators and thresholds are based on the climate indicators of the german (weatherservice)[https://www.dwd.de/DE/wetter/warnungen_aktuell/kriterien/warnkriterien.html]:

  • low pressure: the pressure is below 1005 hPa during the day
  • very low pressure: the pressure is below 990 hPa during the day
  • high pressure: the pressure is above 1020 hPa during the day
  • very high pressure: the pressure is below 1035 hPa during the day

Instance Attribute Summary

Attributes inherited from BaseThreshold

#indicators

Instance Method Summary collapse

Methods inherited from BaseThreshold

#add_indicator, #change_indicator, #check_data_values, #initialize

Constructor Details

This class inherits a constructor from WrfForecast::Threshold::BaseThreshold

Instance Method Details

#determine_indicators(data_values) ⇒ Object (private)

method to determine the indicators based on the input data

Parameters:

  • data_values (Array)

    the input values



29
30
31
32
33
34
35
36
37
# File 'lib/wrf_forecast/threshold/pressure_threshold.rb', line 29

def determine_indicators(data_values)
  data_values.each { |value|
    change_indicator(:low_pressure, true, value < 100500)
    change_indicator(:very_low_pressure, true, value < 99000)
    change_indicator(:high_pressure, true, value > 102000)
    change_indicator(:very_high_pressure, true, value > 103500)
  }
  nil
end

#initialize_indicatorsObject (private)

initialization of the required indicators



19
20
21
22
23
24
25
# File 'lib/wrf_forecast/threshold/pressure_threshold.rb', line 19

def initialize_indicators
  add_indicator(:low_pressure, false, I18n.t("threshold.pressure.low_pressure"))
  add_indicator(:very_low_pressure, false, I18n.t("threshold.pressure.very_low_pressure"))
  add_indicator(:high_pressure, false, I18n.t("threshold.pressure.low_pressure"))
  add_indicator(:very_high_pressure, false, I18n.t("threshold.pressure.very_high_pressure"))
  nil
end