Class: WrfForecast::Threshold::TemperatureThreshold
- Inherits:
-
BaseThreshold
- Object
- BaseThreshold
- WrfForecast::Threshold::TemperatureThreshold
- Defined in:
- lib/wrf_forecast/threshold/temperature_threshold.rb
Overview
This class determines the significant temperature 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 bases on the climate indicators of the german (weatherservice):
-
ice day: the temperature of the day did not exceed 0.0 degrees celsius
-
frost day: the temperature was below 0.0 degress celsius at least once
-
summer day: the temperature did exceed 25.0 degress celsius at least once
-
hot day: the temperature did exceed 30.0 degress celsius at least once
-
tropical night: the temperature of the day did not fall below 20.0 degrees celsius
Instance Attribute Summary
Attributes inherited from BaseThreshold
Instance Method Summary collapse
-
#determine_indicators(data_values) ⇒ Object
private
method to determine the indicators based on the input data.
-
#initialize_indicators ⇒ Object
private
initialization of the required indicators.
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
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/wrf_forecast/threshold/temperature_threshold.rb', line 31 def determine_indicators(data_values) data_values.each { |value| change_indicator(:ice_day, false, value > 273.15) change_indicator(:frost_day, true, value < 273.15) change_indicator(:summer_day, true, value > 298.15) change_indicator(:hot_day, true, value > 303.15) change_indicator(:tropical_night, false, value < 293.15) } nil end |
#initialize_indicators ⇒ Object (private)
initialization of the required indicators
20 21 22 23 24 25 26 27 |
# File 'lib/wrf_forecast/threshold/temperature_threshold.rb', line 20 def initialize_indicators add_indicator(:ice_day, true, I18n.t("threshold.temperature.ice_day")) add_indicator(:frost_day, false, I18n.t("threshold.temperature.frost_day")) add_indicator(:summer_day, false, I18n.t("threshold.temperature.summer_day")) add_indicator(:hot_day, false, I18n.t("threshold.temperature.hot_day")) add_indicator(:tropical_night, true, I18n.t("threshold.temperature.tropical_night")) nil end |