def _read(filename, format=None, **kwargs): """ Reads a single event file into a ObsPy Catalog object. """ inventory, format = _read_from_plugin('inventory', filename, format=format, **kwargs) return inventory
def read_inventory(path_or_file_object=None, format=None): """ Function to read inventory files. :param path_or_file_object: File name or file like object. If this attribute is omitted, an example :class:`Inventory` object will be returned. :type format: str, optional :param format: Format of the file to read (e.g. ``"STATIONXML"``). .. note:: For handling additional information not covered by the StationXML standard and how to output it to StationXML see the :ref:`ObsPy Tutorial <stationxml-extra>`. """ if path_or_file_object is None: # if no pathname or URL specified, return example catalog return _create_example_inventory() elif isinstance(path_or_file_object, (str, native_str)) and \ "://" in path_or_file_object: # some URL # extract extension if any suffix = \ os.path.basename(path_or_file_object).partition('.')[2] or '.tmp' with NamedTemporaryFile(suffix=suffix) as fh: download_to_file(url=path_or_file_object, filename_or_buffer=fh) return read_inventory(fh.name, format=format) return _read_from_plugin("inventory", path_or_file_object, format=format)[0]
def read_inventory(path_or_file_object=None, format=None, *args, **kwargs): """ Function to read inventory files. :param path_or_file_object: File name or file like object. If this attribute is omitted, an example :class:`Inventory` object will be returned. :type format: str :param format: Format of the file to read (e.g. ``"STATIONXML"``). See the `Supported Formats`_ section below for a list of supported formats. :rtype: :class:`~obspy.core.inventory.inventory.Inventory` :return: An ObsPy :class:`~obspy.core.inventory.inventory.Inventory` object. Additional args and kwargs are passed on to the underlying ``_read_X()`` methods of the inventory plugins. .. rubric:: _`Supported Formats` Additional ObsPy modules extend the functionality of the :func:`~obspy.core.inventory.inventory.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. %s .. note:: For handling additional information not covered by the StationXML standard and how to output it to StationXML see the :ref:`ObsPy Tutorial <stationxml-extra>`. """ if path_or_file_object is None: # if no pathname or URL specified, return example catalog return _create_example_inventory() elif isinstance(path_or_file_object, (str, native_str)) and \ "://" in path_or_file_object: # some URL # extract extension if any suffix = \ os.path.basename(path_or_file_object).partition('.')[2] or '.tmp' with NamedTemporaryFile(suffix=sanitize_filename(suffix)) as fh: download_to_file(url=path_or_file_object, filename_or_buffer=fh) return read_inventory(fh.name, format=format) return _read_from_plugin("inventory", path_or_file_object, format=format, *args, **kwargs)[0]
def read_inventory(path_or_file_object=None, format=None): """ Function to read inventory files. :param path_or_file_object: File name or file like object. If this attribute is omitted, an example :class:`Inventory` object will be returned. :type format: str, optional :param format: Format of the file to read (e.g. ``"STATIONXML"``). """ if path_or_file_object is None: # if no pathname or URL specified, return example catalog return _createExampleInventory() return _read_from_plugin("inventory", path_or_file_object, format=format)[0]
def read_inventory(path_or_file_object=None, format=None): """ Function to read inventory files. :param path_or_file_object: File name or file like object. If this attribute is omitted, an example :class:`Inventory` object will be returned. :type format: str, optional :param format: Format of the file to read (e.g. ``"STATIONXML"``). """ if path_or_file_object is None: # if no pathname or URL specified, return example catalog return _create_example_inventory() elif isinstance(path_or_file_object, (str, native_str)) and "://" in path_or_file_object: # some URL # extract extension if any suffix = os.path.basename(path_or_file_object).partition(".")[2] or ".tmp" with NamedTemporaryFile(suffix=suffix) as fh: download_to_file(url=path_or_file_object, filename_or_buffer=fh) return read_inventory(fh.name, format=format) return _read_from_plugin("inventory", path_or_file_object, format=format)[0]