shakemap.utils.probs

shakemap.utils.probs.get_weights(origin, config)[source]

Get list of GMPEs and their weights for a given earthquake.

Parameters:
  • origin (Origin object) – ShakeMap Origin object, containing earthquake info.

  • config (dict-like) – Configuration information regarding earthquake type.

Returns:

Tuple with elements that are:
  • list of strings indicating the GMPEs selected for this earthquake.

  • ndarray (float) of GMPE weights.

  • Pandas series containing STREC output.

Return type:

tuple

shakemap.utils.probs.get_probs(origin, config)[source]

Calculate probabilities for each earthquake type.

The results here contain probabilities that can be rolled up in many ways:
  • The probabilities of acr, scr, volcanic, and subduction should sum to one.

  • The probabilities of acr_X,scr_X,volcanic_X, crustal, interface and intraslab should sum to 1.

  • The probabilities of acr_X should sum to acr, and so on.

Parameters:
  • origin (Origin object) – ShakeMap Origin object, containing earthquake info.

  • config (dict-like) – Configuration information regarding earthquake type.

Returns:

Probabilities for each earthquake type, with fields:
  • acr Probability that the earthquake is in an active region.

  • acr_X Probability that the earthquake is in a depth layer of ACR, starting from the top.

  • scr Probability that the earthquake is in a stable region.

  • scr_X Probability that the earthquake is in a depth layer of SCR, starting from the top.

  • volcanic Probability that the earthquake is in a volcanic region.

  • volcanic_X Probability that the earthquake is in a depth layer of Volcanic, starting from the top.

  • subduction Probability that the earthquake is in a subduction zone.

  • crustal Probability that the earthquake is in the crust above an interface.

  • interface Probability that the earthquake is on the interface.

  • intraslab Probability that the earthquake is in the slab below interface.

STREC results

Return type:

(dict, dict)

shakemap.utils.probs.get_region_probs(eid, depth, strec_results, config)[source]

Calculate the regional probabilities (not including subduction interface etc).

Parameters:
  • eid (str) – Earthquake ID (i.e., us1000cdn0)

  • depth (float) – Depth of earthquake.

  • strec_results (Series) – Pandas series containing STREC output.

  • config (dict-like) – Configuration information regarding earthquake type.

Returns:

Probabilities for each earthquake type, with fields:
  • acr Probability that the earthquake is in an active region.

  • acr_X Probability that the earthquake is in a depth layer of ACR, starting from the top.

  • scr Probability that the earthquake is in a stable region.

  • scr_X Probability that the earthquake is in a depth layer of SCR, starting from the top.

  • volcanic Probability that the earthquake is in a volcanic region.

  • volcanic_X Probability that the earthquake is in a depth layer of Volcanic, starting from the top.

  • subduction Probability that the earthquake is in a subduction zone.

Return type:

dict

shakemap.utils.probs.get_subduction_probs(strec_results, depth, mag, config, above_slab)[source]

Get probabilities of earthquake being crustal, interface or intraslab.

Parameters:
  • strec_results (Series) – Pandas series containing STREC output.

  • depth (float) – Depth of earthquake.

  • mag (float) – Earthquake magnitude.

  • config (dict-like) – Configuration information regarding earthquake type.

  • above_slab (bool) – Is earthquake above a defined slab?

Returns:

Probabilities for each earthquake type, with fields:
  • crustal Probability that the earthquake is in the crust above an interface.

  • interface Probability that the earthquake is on the interface.

  • intraslab Probability that the earthquake is in the slab below interface.

Return type:

dict

shakemap.utils.probs.get_probability(x, x1, p1, x2, p2)[source]

Calculate probability using a ramped function.

The subsections and parameters below reflect a series of ramp functions we use to calculate various probabilities.

p1  |----+
    |               |                |             p2  |        +-------
    |
    +-----------------
         x1  x2
Parameters:
  • x (float) – Quantity for which we want corresponding probability.

  • x1 (float) – Minimum X value.

  • p1 (float) – Probability at or below minimum X value.

  • x2 (float) – Maximum X value.

  • p2 (float) – Probability at or below maximum X value.

Returns:

Probability at input x value.

Return type:

float