Class: WrfLibrary::MetaData
- Inherits:
-
RubyUtils::MetaData
- Object
- RubyUtils::MetaData
- WrfLibrary::MetaData
- Defined in:
- lib/wrf_library/meta_data.rb
Overview
Childclass that represents the meta data of a wrf station output
Instance Attribute Summary collapse
-
#grid_data ⇒ GridPoint
readonly
The corresponding grid point.
-
#start_date ⇒ Time
readonly
The start date and time of the data series.
-
#station ⇒ Station
readonly
The information abount the station.
Instance Method Summary collapse
-
#delete_special_chars(entries) ⇒ Array
private
helper method to clear entries of certain special character.
-
#initialize(header_line, start_date) ⇒ MetaData
constructor
initialization relevant meta information.
-
#parse_header(header_line) ⇒ Object
private
method which parses the required meta information from the head line relevant meta information.
Constructor Details
#initialize(header_line, start_date) ⇒ MetaData
initialization relevant meta information
23 24 25 26 |
# File 'lib/wrf_library/meta_data.rb', line 23 def initialize(header_line, start_date) @start_date = start_date super(header_line) end |
Instance Attribute Details
#grid_data ⇒ GridPoint (readonly)
Returns the corresponding grid point.
11 12 13 |
# File 'lib/wrf_library/meta_data.rb', line 11 def grid_data @grid_data end |
#start_date ⇒ Time (readonly)
Returns the start date and time of the data series.
17 18 19 |
# File 'lib/wrf_library/meta_data.rb', line 17 def start_date @start_date end |
#station ⇒ Station (readonly)
Returns the information abount the station.
14 15 16 |
# File 'lib/wrf_library/meta_data.rb', line 14 def station @station end |
Instance Method Details
#delete_special_chars(entries) ⇒ Array (private)
helper method to clear entries of certain special character
50 51 52 53 54 55 |
# File 'lib/wrf_library/meta_data.rb', line 50 def delete_special_chars(entries) entries.each { |entry| entry.delete("(),") } return entries end |
#parse_header(header_line) ⇒ Object (private)
method which parses the required meta information from the head line
relevant meta information
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/wrf_library/meta_data.rb', line 34 def parse_header(header_line) entries = delete_special_chars(header_line) # switch entries for geo coordinates since latitude comes before longitude geo_coordinate = Entity::Coordinate.new(entries[6].to_f, entries[5].to_f) @grid_data = Entity::GridPoint.new(entries[8].to_f, entries[9].to_f, entries[12].to_f, entries[11].to_f) # special case for multi word locations station_name = entries[0].sub("_", " ") @station = Entity::Station.new(station_name, entries[3], entries[13].to_f, geo_coordinate) nil end |