Class: IngvQuake::Origin

Inherits:
Object
  • Object
show all
Defined in:
lib/ingv_quake/models/origin.rb

Overview

This class represents the focal time and geographical location of an earthquake hypocenter, as well as additional meta-information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Origin

Initializes a new Origin instance with the provided data.

Parameters:

  • data (Hash)

    A hash containing detailed information about the origin of an event.



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/ingv_quake/models/origin.rb', line 34

def initialize(data)
  @evaluation_mode = data.fetch('evaluationMode', nil)
  @type = data.fetch('type', nil)
  @time = data.dig('time', 'value')
  @latitude = data.dig('latitude', 'value')&.to_f
  @longitude = data.dig('longitude', 'value')&.to_f
  @depth = data.dig('depth', 'value')&.to_i
  @uncertainty = data.dig('depth', 'uncertainty')&.to_i
  @depth_type = data.fetch('depthType', nil)
  @origin_uncertainty = data.fetch('originUncertainty', nil)&.then { |origin_uncertainty_data| OriginUncertainty.new(origin_uncertainty_data) }
  @quality = data.fetch('quality', nil)&.then { |quality_data| Quality.new(quality_data) }
  @evaluation_status = data.fetch('evaluationStatus', nil)
  @method_id = data.fetch('methodID', nil)
  @earth_model_id = data.fetch('earthModelID', nil)
  @creation_info = data.fetch('creationInfo', nil)&.then { |creation_info_data| CreationInfo.new(creation_info_data) }
  @public_id = data.fetch('publicID', nil)
end

Instance Attribute Details

#creation_infoCreationInfo (readonly)

The creation info of the origin.

Returns:



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def creation_info
  @creation_info
end

#depthInteger (readonly)

Depth of hypocenter with respect to the nominal sea level given by the WGS84 geoid. Unit: m

Returns:

  • (Integer)

    the current value of depth



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def depth
  @depth
end

#depth_typeString (readonly)

Type of depth determination. Can be on of: <b>‘from location’, ‘from moment tensor inversion’, ‘from from modeling of broad-band P waveforms’, ‘constrained by depth phases’, ‘constrained by direct phases’, ‘constrained by depth and direct phases’,

'operator assigned', 'other'</b>.

Returns:

  • (String)

    the current value of depth_type



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def depth_type
  @depth_type
end

#earth_model_idString (readonly)

Identifies the earth model used in methodID.

Returns:

  • (String)

    the current value of earth_model_id



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def earth_model_id
  @earth_model_id
end

#evaluation_modeString (readonly)

Evaluation mode of Origin. Can be on of: ‘manual’ or ‘automated’.

Returns:

  • (String)

    the current value of evaluation_mode



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def evaluation_mode
  @evaluation_mode
end

#evaluation_statusString (readonly)

The evaluation status of the origin. Can be one of: ‘preliminary’, ‘confirmed’, ‘reviewed’, ‘final’, ‘rejected’.

Returns:

  • (String)

    the current value of evaluation_status



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def evaluation_status
  @evaluation_status
end

#latitudeFloat (readonly)

Hypocenter latitude, with respect to the WGS84 reference system. Unit: deg

Returns:

  • (Float)

    the current value of latitude



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def latitude
  @latitude
end

#longitudeFloat (readonly)

Hypocenter longitude, with respect to the WGS84 reference system. Unit: deg

Returns:

  • (Float)

    the current value of longitude



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def longitude
  @longitude
end

#method_idString (readonly)

The method ID of the origin. Identifies the method used for locating the event.

Returns:

  • (String)

    the current value of method_id



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def method_id
  @method_id
end

#origin_uncertaintyOriginUncertainty (readonly)

The origin uncertainty of the origin.

Returns:



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def origin_uncertainty
  @origin_uncertainty
end

#public_idString (readonly)

The public ID of the origin.

Returns:

  • (String)

    the current value of public_id



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def public_id
  @public_id
end

#qualityQuality (readonly)

The quality of the origin.

Returns:

  • (Quality)

    the current value of quality



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def quality
  @quality
end

#timeString (readonly)

Focal date and time.

Returns:

  • (String)

    the current value of time



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def time
  @time
end

#typeString (readonly)

Describes the Origin type. Can be on of: ‘hypocenter’, ‘centroid’, ‘amplitude’, ‘macroseismic’, ‘rupture start’, ‘rupture end’.

Returns:

  • (String)

    the current value of type



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def type
  @type
end

#uncertaintyInteger (readonly)

The depth uncertainty of the origin. Unit: m

Returns:

  • (Integer)

    the current value of uncertainty



27
28
29
# File 'lib/ingv_quake/models/origin.rb', line 27

def uncertainty
  @uncertainty
end