obspy.core.event.Catalog.write

Catalog.write(filename, format, **kwargs)[source]

Saves catalog into a file.

Parameters:
  • filename (string) The name of the file to write.
  • format (string) The file format to use (e.g. "QUAKEML"). See the Supported Formats section below for a list of supported formats.
  • kwargs Additional keyword arguments passed to the underlying waveform writer method.

Example

>>> from obspy.core.event import readEvents
>>> catalog = readEvents() 
>>> catalog.write("example.xml", format="QUAKEML") 

Writing single events into files with meaningful filenames can be done e.g. using event.id

>>> for ev in catalog: 
...     ev.write(ev.id + ".xml", format="QUAKEML") 

Supported Formats

Additional ObsPy modules extend the parameters of the write() method. The following table summarizes all known formats currently available for ObsPy.

Please refer to the Linked Function Call of each module for any extra options available.

Format Required Module Linked Function Call
JSON obspy.core obspy.core.json.core.writeJSON()
QUAKEML obspy.core obspy.core.quakeml.writeQuakeML()

This Page