obspy.io.quakeml.core.Unpickler

class Unpickler(xml_doc=None)[source]

Bases: object

De-serializes a QuakeML string into an ObsPy Catalog object.

Attributes

xml_root

Public Methods

load

Reads QuakeML file into ObsPy catalog object.

loads

Parses QuakeML string into ObsPy catalog object.

Private Methods

Warning

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

Unpickler._amplitude(element)[source]

Converts an etree.Element into a Amplitude object.

Return type

Amplitude

Unpickler._arrival(element)[source]

Converts an etree.Element into an Arrival object.

Return type

Arrival

Unpickler._axis(parent, name)[source]

Converts an etree.Element into an Axis object.

Parameters

name (str) – tag name of axis

Return type

Axis

Unpickler._comments(parent)[source]
Unpickler._composite_times(parent)[source]
Unpickler._confidence_ellipsoid(element)[source]
Unpickler._creation_info(parent)[source]
Unpickler._data_used(parent)[source]

Converts an etree.Element into a list of DataUsed objects.

Return type

list of DataUsed

Unpickler._deserialize()[source]
Unpickler._event_description(parent)[source]
Unpickler._extra(element, obj)[source]

Add information stored in custom tags/attributes in obj.extra.

Unpickler._float_value(element, name)[source]
Unpickler._focal_mechanism(element)[source]

Converts an etree.Element into a FocalMechanism object.

Return type

FocalMechanism

Example

>>> from lxml import etree
>>> XML = b'''<?xml version="1.0" encoding="UTF-8"?>
... <focalMechanism>
...   <methodID>smi:ISC/methodID=Best_double_couple</methodID>
... </focalMechanism>'''
>>> xml_doc = etree.fromstring(XML)
>>> unpickler = Unpickler(xml_doc)
>>> fm = unpickler._focal_mechanism(xml_doc)
>>> print(fm.method_id)
smi:ISC/methodID=Best_double_couple
Unpickler._int_value(element, name)[source]
Unpickler._magnitude(element)[source]

Converts an etree.Element into a Magnitude object.

Return type

Magnitude

Example

>>> from lxml import etree
>>> XML = b'''<?xml version="1.0" encoding="UTF-8"?>
... <magnitude>
...   <mag><value>3.2</value></mag>
... </magnitude>'''
>>> xml_doc = etree.fromstring(XML)
>>> unpickler = Unpickler(xml_doc)
>>> magnitude = unpickler._magnitude(xml_doc)
>>> print(magnitude.mag)
3.2
Unpickler._moment_tensor(parent)[source]

Converts an etree.Element into an MomentTensor object.

Return type

MomentTensor

Unpickler._nodal_plane(parent, name)[source]

Converts an etree.Element into an NodalPlane object.

Parameters

name (str) – tag name of sub nodal plane

Return type

NodalPlane

Unpickler._nodal_planes(parent)[source]

Converts an etree.Element into an NodalPlanes object.

Return type

NodalPlanes

Unpickler._origin(element, arrivals)[source]

Converts an etree.Element into an Origin object.

Return type

Origin

Example

>>> from lxml import etree
>>> XML = b'''<?xml version="1.0" encoding="UTF-8"?>
... <origin>
...   <latitude><value>34.23</value></latitude>
... </origin>'''
>>> xml_doc = etree.fromstring(XML)
>>> unpickler = Unpickler(xml_doc)
>>> origin = unpickler._origin(xml_doc, arrivals=[])
>>> print(origin.latitude)
34.23
Unpickler._origin_quality(parent)[source]
Unpickler._origin_uncertainty(parent)[source]
Unpickler._pick(element)[source]

Converts an etree.Element into a Pick object.

Return type

Pick

Unpickler._principal_axes(parent)[source]

Converts an etree.Element into an PrincipalAxes object.

Return type

PrincipalAxes

Unpickler._set_enum(xpath, element, obj, key)[source]
Unpickler._source_time_function(parent)[source]

Converts an etree.Element into an SourceTimeFunction object.

Return type

SourceTimeFunction

Unpickler._station_magnitude(element)[source]

Converts an etree.Element into a StationMagnitude object.

Return type

StationMagnitude

Example

>>> from lxml import etree
>>> XML = b'''<?xml version="1.0" encoding="UTF-8"?>
... <stationMagnitude>
...   <mag><value>3.2</value></mag>
... </stationMagnitude>'''
>>> xml_doc = etree.fromstring(XML)
>>> unpickler = Unpickler(xml_doc)
>>> station_mag = unpickler._station_magnitude(xml_doc)
>>> print(station_mag.mag)
3.2
Unpickler._station_magnitude_contributions(parent)[source]
Unpickler._tensor(parent)[source]

Converts an etree.Element into an Tensor object.

Return type

Tensor

Unpickler._time_value(element, name)[source]
Unpickler._time_window(element)[source]

Converts an etree.Element into a TimeWindow object.

Return type

TimeWindow

Unpickler._value(parent, name, quantity_type=<class 'float'>)[source]
Unpickler._waveform_id(parent)[source]
Unpickler._waveform_ids(parent)[source]
Unpickler._xpath(xpath, element=None, namespace=None)[source]
Unpickler._xpath2obj(xpath, element=None, convert_to=<class 'str'>, namespace=None)[source]

Special Methods

Unpickler.__delattr__(name, /)

Implement delattr(self, name).

Unpickler.__dir__()

Default dir() implementation.

Unpickler.__eq__(value, /)

Return self==value.

Unpickler.__format__(format_spec, /)

Default object formatter.

Unpickler.__ge__(value, /)

Return self>=value.

Unpickler.__getattribute__(name, /)

Return getattr(self, name).

Unpickler.__gt__(value, /)

Return self>value.

Unpickler.__hash__()

Return hash(self).

Unpickler.__init__(xml_doc=None)[source]
Unpickler.__init_subclass__()

This method is called when a class is subclassed.

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

Unpickler.__le__(value, /)

Return self<=value.

Unpickler.__lt__(value, /)

Return self<value.

Unpickler.__ne__(value, /)

Return self!=value.

Unpickler.__new__(**kwargs)
Unpickler.__reduce__()

Helper for pickle.

Unpickler.__reduce_ex__(protocol, /)

Helper for pickle.

Unpickler.__repr__()

Return repr(self).

Unpickler.__setattr__(name, value, /)

Implement setattr(self, name, value).

Unpickler.__sizeof__()

Size of object in memory, in bytes.

Unpickler.__str__()

Return str(self).

Unpickler.__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).