obspy.core.util.base.get_example_file

get_example_file(filename)[source]

Function to find the absolute path of a data file

The ObsPy modules are installed to a custom installation directory. That is the path cannot be predicted. This functions searches for all installed ObsPy modules and checks whether the file is in any of the “tests/data/” or “data/” subdirectories.

Parameters:

filename – A test file name to which the path should be returned.

Returns:

Full path to file.

Example

>>> get_example_file('slist.ascii')  
/custom/path/to/obspy/io/ascii/tests/data/slist.ascii
>>> get_example_file('does.not.exists')  
Traceback (most recent call last):
...
OSError: Could not find file does.not.exists ...