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_rain_values ⇒ Object
private
method to create the output hash for the precipitation values.
-
#generate_temperature_values ⇒ Object
private
method to create the output hash for the temperature values.
-
#generate_wind_values ⇒ Object
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_rain_values ⇒ Object (private)
method to create the output hash for the precipitation values
36 37 38 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 36 def generate_rain_values WrfLibrary::Statistic::Hourly.calculate_hourly_rainsum(@wrf_handler) end |
#generate_temperature_values ⇒ Object (private)
method to create the output hash for the temperature values
26 27 28 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 26 def generate_temperature_values WrfLibrary::Statistic::Hourly.calculate_hourly_means(:air_temperature, @wrf_handler) end |
#generate_wind_values ⇒ Object (private)
method to create the output hash for the wind values
31 32 33 |
# File 'lib/wrf_forecast/json_converter/hourly_forecast_converter.rb', line 31 def generate_wind_values WrfLibrary::Statistic::Hourly.calculate_hourly_windspeed_means(@wrf_handler) end |