shakelib.utils.utils

shakelib.utils.utils.replace_dyfi(stationfile, dyfi_xml, min_nresp=3)[source]

Remove any non-instrumented data from station file, add DYFI.

Parameters:
  • stationfile (str) – Existing station data file, presumed to contain old DYFI data.

  • dyfi_xml (str) – DYFI XML data file, which will be added to instrumented station data.

  • min_nresp (int) – The minimum number of DYFI responses required for an observation to be added to the stationlist. Default = 3.

Returns:

Object containing merged data.

Return type:

StationList

shakelib.utils.utils.get_extent(config, ipe, rupture=None)[source]

Method to compute map extent from rupture. There are numerous methods for getting the extent:

  • It can be specified directly in the config file,

  • it can be hard coded for specific magnitude ranges in the config file, or

  • it can be based on the MultiGMPE for the event.

All methods except for the first require a rupture object.

If no config is provided then a rupture is required and the extent is based on a generic set of active/stable.

Parameters:
  • config (ConfigObj) – ShakeMap config object.

  • ipe (VirtualIPE) – An VirtualIPE instance.

  • rupture (Rupture) – A ShakeMap Rupture instance.

Returns:

lonmin, lonmax, latmin, latmax rounded outward to the nearest 30 arc seconds.

Return type:

tuple

shakelib.utils.utils.thirty_sec_min(coord)[source]

Round a number to the floor of 30 arc-seconds

shakelib.utils.utils.thirty_sec_max(coord)[source]

Round a number to the ceiling of 30 arc-seconds

shakelib.utils.utils.is_stable(lon, lat)[source]

Determine if point is located in the US stable tectonic region. This uses STREC but only makes use of the stable tectonic region. Any location that is not mapped as stable is classified as active.

Parameters:
  • lon (float) – Lognitude.

  • lat (float) – Latitude.

Returns:

Is the point classified as tectonically stable.

Return type:

bool