obspy.core.inventory.inventory.read_inventory

read_inventory(path_or_file_object=None, format=None, level='response', *args, **kwargs)[source]

Function to read inventory files.

Parameters
  • path_or_file_object (str, pathlib.Path, or file-like object, optional) – String containing a file name or a URL, a Path object, or a open file-like object. Wildcards are allowed for a file name. If this attribute is omitted, an example Inventory object will be returned.

  • format (str) – Format of the file to read (e.g. "STATIONXML"). See the Supported Formats section below for a list of supported formats.

  • level (str) – Level of detail to read from file. One of 'response', 'channel', 'station' or 'network'. Lower level of detail can result in much shorter reading times for some file formats.

Return type

Inventory

Returns

An ObsPy Inventory object.

Additional args and kwargs are passed on to the underlying _read_X() methods of the inventory plugins.

Supported Formats

Additional ObsPy modules extend the functionality of the read_inventory() function. The following table summarizes all known file formats currently supported by ObsPy.

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

Format

Used Module

Linked Function Call

INVENTORYXML

obspy.io.arclink

obspy.io.arclink.inventory._read_inventory_xml()

RESP

obspy.io.xseed

obspy.io.xseed.core._read_resp()

SC3ML

obspy.io.seiscomp

obspy.io.seiscomp.inventory._read_sc3ml()

SEED

obspy.io.xseed

obspy.io.xseed.core._read_seed()

STATIONTXT

obspy.io.stationtxt

obspy.io.stationtxt.core.read_fdsn_station_text_file()

STATIONXML

obspy.io.stationxml

obspy.io.stationxml.core._read_stationxml()

XSEED

obspy.io.xseed

obspy.io.xseed.core._read_xseed()

Note

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