Class: WrfLibrary::JsonConverter::WrfStationJsonConverter
- Inherits:
-
BaseStationJsonConverter
- Object
- BaseStationJsonConverter
- WrfLibrary::JsonConverter::WrfStationJsonConverter
- Defined in:
- lib/wrf_library/json_converter/wrf_station_converter.rb
Overview
Abstract child class to add the relevant additional informations to the the JSON putput
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BaseStationJsonConverter
Instance Method Summary collapse
-
#add_additions ⇒ Hash
private
implementation of the abstract parent method.
-
#generate_grid_coordinates(grid_point) ⇒ Hash
private
method to generate a json Hash for the representation of a grid coordinate.
-
#generate_grid_data(grid_point) ⇒ Hash
private
method to generate a json Hash for the representation of a grid point.
Methods inherited from BaseStationJsonConverter
#convert, #generate_data_values, #generate_meta_hash, #generate_station_hash, #initialize
Constructor Details
This class inherits a constructor from WrfLibrary::JsonConverter::BaseStationJsonConverter
Instance Method Details
#add_additions ⇒ Hash (private)
implementation of the abstract parent method. In addition to the data stored by the parent class, the wrf data also stores data of the considered grid point
15 16 17 18 19 20 21 |
# File 'lib/wrf_library/json_converter/wrf_station_converter.rb', line 15 def add_additions additions = Hash.new() additions[:grid_point] = generate_grid_data(@data..grid_data) additions[:grid_coordinates] = generate_grid_coordinates(@data..grid_data) return additions end |
#generate_grid_coordinates(grid_point) ⇒ Hash (private)
method to generate a json Hash for the representation of a grid coordinate
36 37 38 39 40 41 |
# File 'lib/wrf_library/json_converter/wrf_station_converter.rb', line 36 def generate_grid_coordinates(grid_point) grid_coordinates = Hash.new() grid_coordinates[:grid_coordinates] = { :x => grid_point.grid_coordinates.x, :y => grid_point.grid_coordinates.y } return grid_coordinates end |
#generate_grid_data(grid_point) ⇒ Hash (private)
method to generate a json Hash for the representation of a grid point
26 27 28 29 30 31 |
# File 'lib/wrf_library/json_converter/wrf_station_converter.rb', line 26 def generate_grid_data(grid_point) grid_data = Hash.new() grid_data[:grid_point] = { :x => grid_point.grid_point.x, :y => grid_point.grid_point.y } return grid_data end |