class Parser(data=None, debug=False, strict=False, compact=False)[source]

Bases: object

Class parsing dataless and full SEED, X-SEED, and RESP files.

See also

The SEED file format description can be found at https://www.fdsn.org/seed_manual/SEEDManual_V2.4.pdf .

The XML-SEED format was proposed in [Tsuboi2004].

The IRIS RESP format can be found at http://ds.iris.edu/ds/nodes/dmc/data/formats/resp/

Public Methods


Return coordinates (from blockette 52) of a channel.


Function returning a dictionary about whats actually in the Parser object.


Return PAZ.


Returns a RESP representation of the current Parser object.


Create an ObsPy response object from all blockettes of a channel.


Returns a SEED representation of the current Parser object.


Returns a XSEED representation of the current Parser object.


General parser method for XML-SEED, Dataless SEED, and RESP files.



Rotates the three components of a Stream to ZNE.


Writes for each channel a RESP file within a given folder.


Writes a dataless SEED file with given name.


Writes a XML-SEED file with given name.

Private Methods


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


Checks if all blockettes necessary for creating a SEED String are available.

Parser._compare_blockettes(blkt1, blkt2)[source]

Compares two blockettes.


Creates blockettes 11 and 12 for SEED writing and XSEED version 1.1 writing.

Parser._create_cut_and_flush_record(blockettes, record_type)[source]

Takes all blockettes of a record and return a list of finished records.

If necessary it will cut the record and return two or more flushed records.

The returned records also include the control header type code and the record continuation code. Therefore the returned record will have the length self.record_length - 6. Other methods are responsible for writing the sequence number.

It will always return a list with records.


Deletes blockette 11 and 12.


Helper function returning the abbreviation for the given identifier code.

Parser._get_resp_string(resp, blockettes, station)[source]

Takes a file like object and a list of blockettes containing all blockettes for one channel and writes them RESP like to the BytesIO.

Parser._parse_merged_data(data, record_type)[source]

This method takes any merged SEED record and writes its blockettes in the corresponding dictionary entry of self.temp.


Reads RESP files.

Reads IRIS RESP formatted data as produced with ‘rdseed -f seed.test -R’.


Parses through a whole SEED volume.

It will always parse the whole file and skip any time span data.

Parser._parse_xml_blockette(xml_blockette, record_type, xseed_version)[source]

Takes the lxml tree of any blockette and returns a blockette object.


Parse a XML-SEED string.

Parser._repr_pretty_(p, cycle)[source]
Parser._select(seed_id, datetime=None)[source]

Selects all blockettes related to given SEED id and datetime.


Takes everything in the self.temp dictionary and writes it into the volume, abbreviations and stations attributes of the class.

The self.temp dictionary can only contain one seed volume with a correct structure.

This method will try to merge everything, discard double entries and adjust abbreviations.

It will also discard unnecessary blockettes that will be created again when writing SEED or XSEED.

Parser._update_temporary_stations(blkt_id, index_nr)[source]

Loops over all stations, finds the corresponding blockettes and changes all abbreviation lookup codes.

Special Methods

Parser.__delattr__(name, /)

Implement delattr(self, name).


Default dir() implementation.

Parser.__eq__(value, /)

Return self==value.

Parser.__format__(format_spec, /)

Default object formatter.

Parser.__ge__(value, /)

Return self>=value.

Parser.__getattribute__(name, /)

Return getattr(self, name).

Parser.__gt__(value, /)

Return self>value.


Return hash(self).

Parser.__init__(data=None, debug=False, strict=False, compact=False)[source]

Initializes the SEED parser.

  • data (str, bytes, io.BytesIO or file) – Filename, URL, XSEED/SEED/RESP string, file pointer or BytesIO.

  • debug (bool) – Enables a verbose debug log during parsing of SEED file.

  • strict (bool) – Parser will raise an exception if SEED files does not stay within the SEED specifications.

  • compact (bool) – SEED volume will contain compact data strings. Missing time strings will be filled with 00:00:00.0000 if this option is disabled.


This method is called when a class is subclassed.

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

Parser.__le__(value, /)

Return self<=value.

Parser.__lt__(value, /)

Return self<value.

Parser.__ne__(value, /)

Return self!=value.


Helper for pickle.

Parser.__reduce_ex__(protocol, /)

Helper for pickle.


Return repr(self).

Parser.__setattr__(name, value, /)

Implement setattr(self, name, value).


Size of object in memory, in bytes.


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).