Class: IngvQuake::DataUsed
- Inherits:
-
Object
- Object
- IngvQuake::DataUsed
- Defined in:
- lib/ingv_quake/models/data_used.rb
Overview
The DataUsed class represents the data used for the moment tensor calculation. It contains information about the type of waveform data, station count, component count, and the shortest and longest periods present in the data.
Instance Attribute Summary collapse
-
#component_count ⇒ Integer
readonly
The number of data components of the type given in wave_type.
-
#longest_period ⇒ Float
readonly
The longest period present in the data.
-
#shortest_period ⇒ Float
readonly
The shortest period present in the data.
-
#station_count ⇒ Integer
readonly
The number of stations that have contributed data of the type given in wave_type.
-
#wave_type ⇒ String
readonly
The type of waveform data used for the moment tensor calculation.
Instance Method Summary collapse
-
#initialize(data) ⇒ DataUsed
constructor
Initializes a new DataUsed instance with the provided data.
Constructor Details
#initialize(data) ⇒ DataUsed
Initializes a new DataUsed instance with the provided data.
20 21 22 23 24 25 26 |
# File 'lib/ingv_quake/models/data_used.rb', line 20 def initialize(data) @wave_type = data.fetch('waveType', nil) @station_count = data.fetch('stationCount', nil)&.to_i @component_count = data.fetch('componentCount', nil)&.to_i @shortest_period = data.fetch('shortestPeriod', nil)&.to_f @longest_period = data.fetch('longestPeriod', nil)&.to_f end |
Instance Attribute Details
#component_count ⇒ Integer (readonly)
The number of data components of the type given in wave_type.
14 15 16 |
# File 'lib/ingv_quake/models/data_used.rb', line 14 def component_count @component_count end |
#longest_period ⇒ Float (readonly)
The longest period present in the data. Unit: s
14 15 16 |
# File 'lib/ingv_quake/models/data_used.rb', line 14 def longest_period @longest_period end |
#shortest_period ⇒ Float (readonly)
The shortest period present in the data. Unit: s
14 15 16 |
# File 'lib/ingv_quake/models/data_used.rb', line 14 def shortest_period @shortest_period end |
#station_count ⇒ Integer (readonly)
The number of stations that have contributed data of the type given in wave_type.
14 15 16 |
# File 'lib/ingv_quake/models/data_used.rb', line 14 def station_count @station_count end |
#wave_type ⇒ String (readonly)
The type of waveform data used for the moment tensor calculation. Can be on of: ‘P waves’, ‘body waves’, ‘surface waves’, ‘mantle waves’, ‘combined’, ‘unknown’.
14 15 16 |
# File 'lib/ingv_quake/models/data_used.rb', line 14 def wave_type @wave_type end |