Class: IngvQuake::DataUsed

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

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ DataUsed

Initializes a new DataUsed instance with the provided data.

Parameters:

  • data (Hash)

    A hash containing detailed information about the data used for a moment-tensor inversion.



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_countInteger (readonly)

The number of data components of the type given in wave_type.

Returns:

  • (Integer)

    the current value of component_count



14
15
16
# File 'lib/ingv_quake/models/data_used.rb', line 14

def component_count
  @component_count
end

#longest_periodFloat (readonly)

The longest period present in the data. Unit: s

Returns:

  • (Float)

    the current value of longest_period



14
15
16
# File 'lib/ingv_quake/models/data_used.rb', line 14

def longest_period
  @longest_period
end

#shortest_periodFloat (readonly)

The shortest period present in the data. Unit: s

Returns:

  • (Float)

    the current value of shortest_period



14
15
16
# File 'lib/ingv_quake/models/data_used.rb', line 14

def shortest_period
  @shortest_period
end

#station_countInteger (readonly)

The number of stations that have contributed data of the type given in wave_type.

Returns:

  • (Integer)

    the current value of station_count



14
15
16
# File 'lib/ingv_quake/models/data_used.rb', line 14

def station_count
  @station_count
end

#wave_typeString (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’.

Returns:

  • (String)

    the current value of wave_type



14
15
16
# File 'lib/ingv_quake/models/data_used.rb', line 14

def wave_type
  @wave_type
end