obspy.core.event.magnitude.Magnitude

class Magnitude(force_resource_id=True, *args, **kwargs)[source]

Bases: AbstractEventTypeWithResourceID

Describes a magnitude which can, but does not need to be associated with an origin.

Association with an origin is expressed with the optional attribute originID. It is either a combination of different magnitude estimations, or it represents the reported magnitude for the given event.

Parameters:
  • resource_id (ResourceIdentifier) – Resource identifier of Magnitude.

  • force_resource_id (bool, optional) – If set to False, the automatic initialization of resource_id attribute in case it is not specified will be skipped.

  • mag (float) – Resulting magnitude value from combining values of type StationMagnitude. If no estimations are available, this value can represent the reported magnitude.

  • mag_errors (QuantityError) – AttribDict containing error quantities.

  • magnitude_type (str, optional) –

    Describes the type of magnitude. This is a free-text field because it is impossible to cover all existing magnitude type designations with an enumeration. Possible values are:

    • unspecified magnitude ('M'),

    • local magnitude ('ML'),

    • body wave magnitude ('Mb'),

    • surface wave magnitude ('MS'),

    • moment magnitude ('Mw'),

    • duration magnitude ('Md')

    • coda magnitude ('Mc')

    • 'MH', 'Mwp', 'M50', 'M100', etc.

  • origin_id (ResourceIdentifier, optional) – Reference to an origin’s resource_id if the magnitude has an associated Origin.

  • method_id (ResourceIdentifier, optional) – Identifies the method of magnitude estimation. Users should avoid to give contradictory information in method_id and magnitude_type.

  • station_count (int, optional) – Number of used stations for this magnitude computation.

  • azimuthal_gap (float, optional) – Azimuthal gap for this magnitude computation. Unit: deg

  • evaluation_mode (str, optional) – Evaluation mode of Magnitude. See EvaluationMode for allowed values.

  • evaluation_status (str, optional) – Evaluation status of Magnitude. See EvaluationStatus for allowed values.

  • comments (list of Comment, optional) – Additional comments.

  • station_magnitude_contributions (list of StationMagnitudeContribution.) – StationMagnitudeContribution instances associated with the Magnitude.

  • creation_info (CreationInfo, optional) – Creation information used to describe author, version, and creation time.

Note

For handling additional information not covered by the QuakeML standard and how to output it to QuakeML see the ObsPy Tutorial.

Attributes

defaults

do_not_warn_on

item

key

readonly

warn_on_non_default_key

Public Methods

clear

Clear the class :return:

copy

get

items

keys

pop

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem

as a 2-tuple; but raise KeyError if D is empty.

setdefault

update

values

Private Methods

Warning

Private methods are mainly for internal/developer use and their API might change without notice.

Magnitude._cast_type(key, value)

Cast type of value to type required in _types dict.

Parameters:
  • key (str) – The key from __setattr__.

  • value – The value being set to key.

Returns:

value cast to correct type.

Magnitude._pretty_str(priorized_keys=[], min_label_length=16)

Return better readable string representation of AttribDict object.

Parameters:
  • priorized_keys (list[str], optional) – Keywords of current AttribDict which will be shown before all other keywords. Those keywords must exists otherwise an exception will be raised. Defaults to empty list.

  • min_label_length (int, optional) – Minimum label length for keywords. Defaults to 16.

Returns:

String representation of current AttribDict object.

Magnitude._repr_pretty_(p, cycle)

Special Methods

Magnitude.__bool__()
Magnitude.__contains__(key)
Magnitude.__delattr__(name)
Magnitude.__delitem__(name)
Magnitude.__dir__()

Default dir() implementation.

Magnitude.__eq__(other)

Two instances are considered equal if all attributes and all lists are identical.

Magnitude.__format__(format_spec, /)

Default object formatter.

Magnitude.__ge__(value, /)

Return self>=value.

Magnitude.__getattr__(name, default=None)

Py3k hasattr() expects an AttributeError no KeyError to be raised if the attribute is not found.

Magnitude.__getattribute__(name, /)

Return getattr(self, name).

Magnitude.__getitem__(name, default=None)
Magnitude.__gt__(value, /)

Return self>value.

Magnitude.__init__(force_resource_id=True, *args, **kwargs)
Magnitude.__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

Magnitude.__iter__()
Magnitude.__le__(value, /)

Return self<=value.

Magnitude.__len__()
Magnitude.__lt__(value, /)

Return self<value.

Magnitude.__ne__(other)
Magnitude.__new__(**kwargs)
Magnitude.__nonzero__()
Magnitude.__reduce__()

Helper for pickle.

Magnitude.__reduce_ex__(protocol, /)

Helper for pickle.

Magnitude.__repr__()
Magnitude.__setattr__(name, value)

Custom property implementation that works if the class is inheriting from AttribDict.

Magnitude.__setitem__(key, value)
Magnitude.__sizeof__()

Size of object in memory, in bytes.

Magnitude.__str__(force_one_line=False)

Fairly extensive in an attempt to cover several use cases. It is always possible to change it in the child class.

classmethod Magnitude.__subclasshook__(C)