Class: WrfForecast::JsonConverter::HourlyForecastJsonConverter

Inherits:
ForecastStationJsonConverter
  • Object
show all
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

Attributes inherited from ForecastStationJsonConverter

#forecast, #warnings

Instance Method Summary collapse

Methods inherited from ForecastStationJsonConverter

#add_additions, #convert_suntime, #generate_data_values, #generate_warnings

Constructor Details

#initialize(wrf_handler, forecast, warnings) ⇒ HourlyForecastJsonConverter

initialization

Parameters:

  • wrf_handler (WrfHandler)

    the wrf handler with the input data

  • forecast (ForecastRepository)

    the specific forecast data

  • warnings (Hash)

    the mapping of measurand and triggered thresholds for the current forecast



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_handlerWrfHandler (private)

Returns the wrf handler with the data of the model run.

Returns:

  • (WrfHandler)

    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_valuesObject (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_valuesObject (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_valuesObject (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