shakelib.utils.imt_string

shakelib.utils.imt_string.oq_to_file(oqimt)[source]

Convert openquake IMT nomenclature to filename friendly form.

Examples: SA(1.0) (Spectral Acceleration at 1 second) -> psa1p0 SA(0.3) (Spectral Acceleration at 0.3 second) -> psa0p3 SA(15.0) (Spectral Acceleration at 15 seconds) -> psa15p0 SA(3) (Spectral Acceleration at 3 seconds) -> psa3p0 SA(.5) (Spectral Acceleration at 0.5 seconds) -> psa0p5

Parameters:

oqimt (str) – Openquake IMT nomenclature string.

Returns:

Filename friendly IMT string.

Return type:

str

Raises:

ValueError – when there is no corresponding filename-friendly IMT representation.

shakelib.utils.imt_string.file_to_oq(fileimt)[source]

Convert filename friendly IMT form to openquake form.

Examples: psa1p0 (Spectral Acceleration at 1 second) -> SA(1.0) psa0p3 (Spectral Acceleration at 0.3 second) -> SA(0.3) psa15p0 (Spectral Acceleration at 15 seconds) -> SA(15.0)

Parameters:

fileimt (str) – Filename friendly IMT string.

Returns:

Openquake IMT nomenclature string.

Return type:

str