shakelib.conversions.convert_imt

class shakelib.conversions.convert_imt.IMTConverter[source]

Bases: abc.ABC

Base class for implementing conversions between intensity measurement types (IMT).

abstract convertAmps(imt_in, imt_out, imt)[source]

Returns an array of converted IMT amplitude values.

Parameters:
  • imt_in (str) – OQ intensity measure type. Same as type as the input values defined by the imt variable.

  • imt_out (str) – OQ intensity measure type that the values will be converted to.

  • imt (OpenQuake IMT) – The intensity measurements of the input ground motions. Valid IMTs are PGV, and SA.

Returns:

Numpy array of amps converted from imt_in to imt_out.

Return type:

array

Raises:

ValueError – If not a valid conversion.

getConversionFactor()[source]

Helper method that returns the conversion factor.

Returns:

Conversion factor.

Return type:

float

getInputIMT(imt_out)[source]

Get valid input IMT types that can be converted to the specified imt_out.

Parameters:

imt_out (str) – OQ intensity measure type.

Returns:

List of valid input IMT types. If not available types

None is returned.

Return type:

list