Class: WrfForecast::JsonConverter::HourlyForecastJsonConverter
- Inherits:
-
ForecastStationJsonConverter
- Object
- WrfLibrary::JsonConverter::BaseStationJsonConverter
- ForecastStationJsonConverter
- WrfForecast::JsonConverter::HourlyForecastJsonConverter
- Defined in:
- lib/wrf_forecast/json_converter/hourly_forecast_converter.rb
Overview
Child class to generate valid json output for the result data of a given wrf meteogram result already stored in a data repository
Instance Attribute Summary collapse
-
#wrf_handler ⇒ WrfHandler
private
The wrf handler with the data of the model run.
Attributes inherited from ForecastStationJsonConverter
Instance Method Summary collapse
-
#generate_air_temperature_values ⇒ Array
private
method to create the output hash for the air temperature values.
-
#generate_apparent_temperature_values ⇒ Array
private
method to create the output hash for the temperature values.
-
#generate_pressure_values ⇒ Array
private
method to create the output hash for the pressure values.
-
#generate_rain_values ⇒ Array
private
method to create the output hash for the precipitation values.
-
#generate_winddirection_values ⇒ Array
private
method to create the output hash for wind direction values.
-
#generate_windspeed_values ⇒ Array
private
method to create the output hash for the wind values.
-
#initialize(wrf_handler, forecast, warnings) ⇒ HourlyForecastJsonConverter
constructor
initialization.
Methods inherited from ForecastStationJsonConverter
#add_additions, #convert_suntime, #generate_data_values, #generate_warnings
Constructor Details
#initialize(wrf_handler, forecast, warnings) ⇒ HourlyForecastJsonConverter
initialization
15 16 17 18 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 15 def initialize(wrf_handler, forecast, warnings) @wrf_handler = wrf_handler super(wrf_handler.data_repository, forecast, warnings) end |
Instance Attribute Details
#wrf_handler ⇒ WrfHandler (private)
Returns the wrf handler with the data of the model run.
23 24 25 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 23 def wrf_handler @wrf_handler end |
Instance Method Details
#generate_air_temperature_values ⇒ Array (private)
method to create the output hash for the air temperature values
35 36 37 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 35 def generate_air_temperature_values WrfLibrary::Statistic::Hourly.calculate_hourly_means(:air_temperature, @wrf_handler) end |
#generate_apparent_temperature_values ⇒ Array (private)
method to create the output hash for the temperature values
27 28 29 30 31 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 27 def generate_apparent_temperature_values = @wrf_handler.retrieve_data_set(:forecast_time) data = @forecast.forecast_data[:apparent_temperature] WrfLibrary::Statistic::Hourly.calculate_hourly_data_means(, data) end |
#generate_pressure_values ⇒ Array (private)
method to create the output hash for the pressure values
41 42 43 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 41 def generate_pressure_values WrfLibrary::Statistic::Hourly.calculate_hourly_means(:pressure, @wrf_handler) end |
#generate_rain_values ⇒ Array (private)
method to create the output hash for the precipitation values
59 60 61 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 59 def generate_rain_values WrfLibrary::Statistic::Hourly.calculate_hourly_rainsum(@wrf_handler) end |
#generate_winddirection_values ⇒ Array (private)
method to create the output hash for wind direction values
53 54 55 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 53 def generate_winddirection_values WrfLibrary::Statistic::Hourly.calculate_hourly_winddirection_means(@wrf_handler) end |
#generate_windspeed_values ⇒ Array (private)
method to create the output hash for the wind values
47 48 49 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 47 def generate_windspeed_values WrfLibrary::Statistic::Hourly.calculate_hourly_windspeed_means(@wrf_handler) end |