Class: WrfLibrary::JsonConverter::WrfJsonConverter
- Inherits:
-
WrfStationJsonConverter
- Object
- BaseStationJsonConverter
- WrfStationJsonConverter
- WrfLibrary::JsonConverter::WrfJsonConverter
- Defined in:
- lib/wrf_library/json_converter/wrf_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
Attributes inherited from BaseStationJsonConverter
Instance Method Summary collapse
-
#create_data_hash(dataset) ⇒ Hash
private
method to create a valid json hash for a given data entry as pair value.
-
#generate_data_values ⇒ Hash
private
implementation of the abstract parent method to create valid json objects for the stored data values.
Methods inherited from WrfStationJsonConverter
#add_additions, #generate_grid_coordinates, #generate_grid_data
Methods inherited from BaseStationJsonConverter
#add_additions, #convert, #generate_meta_hash, #generate_station_hash, #initialize
Constructor Details
This class inherits a constructor from WrfLibrary::JsonConverter::BaseStationJsonConverter
Instance Method Details
#create_data_hash(dataset) ⇒ Hash (private)
method to create a valid json hash for a given data entry as pair value
28 29 30 31 32 33 34 |
# File 'lib/wrf_library/json_converter/wrf_converter.rb', line 28 def create_data_hash(dataset) data_entries = Hash.new() dataset.instance_variables.map{ |ivar| data_entries[ivar.to_s.tr("@", "")] = dataset.instance_variable_get(ivar) } return data_entries end |
#generate_data_values ⇒ Hash (private)
implementation of the abstract parent method to create valid json objects for the stored data values
16 17 18 19 20 21 22 |
# File 'lib/wrf_library/json_converter/wrf_converter.rb', line 16 def generate_data_values data_array = Array.new() @data.repository.each { |dataset| data_array << create_data_hash(dataset) } return data_array end |