Read Data from File
Module for reading seismic data from file.
Public API
- read(fnames, obspy_read_kwargs=None, degrees_from_north=None, verbose=False)
Read seismic data file(s).
- Parameters:
fnames (iterable of iterable of str or iterable of str) – Collection of file name(s) to be read. All entries should be readable by the function
hvsrpy.read_single().obspy_read_kwargs (dict or iterable of dicts, optional) – Keyword arguments to be passed directly to
hvsrpy.read_single().If
dict, keyword argument will be repeated for all file names provided.If
iterable of dictseach keyword arguments will be provided in order.Default is
Noneindicating standard read behavior will be used.degrees_from_north (float or iterable of floats, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive.
If
float, it will be repeated for all file names provided.If
iterable of floatseachfloatwill be provided in order.Default is
Noneindicating either the metadata in the file denoting the sensor’s orientation is correct and should be used or (if the sensor’s orientation is not listed in the file) the sensor’s north component is aligned with magnetic north (i.e.,degrees_from_north=0).verbose (bool, optional) – If
Trueinformation is provided about the attempts to read the file and the associated error(s). Can we useful for debugging a file that cannot be read. Default isFalse.
- Returns:
list – Of initialized
SeismicRecording3Cobjects, one for each each iterable entry provided.
- read_single(fnames, obspy_read_kwargs=None, degrees_from_north=None, verbose=False)
Read file(s) associated with a single recording.
- Parameters:
fnames ({list, str}) – File name(s) to be read.
If
str, name of file to be read, may include a relative or the full path. The file should contain all three components (2 horizontal and 1 vertical).If
list, names of files to be read, each may be a relative or the full path. Each file should contain only one component.obspy_read_kwargs (dict, optional) – Keyword arguments to be passed directly to
obspy.read, in general this should not be needed, default isNoneindicating no custom arguments will be passed toobspy.read.degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is
Noneindicating either the metadata in the file denoting the sensor’s orientation is correct and should be used or (if the sensor’s orientation is not listed in the file) the sensor’s north component is aligned with magnetic north (i.e.,degrees_from_north=0).verbose (bool, optional) – If
Trueinformation is provided about the attempts to read the file and the associated error(s). Can we useful for debugging a file that cannot be read. Default isFalse.
- Returns:
SeismicRecording3C – Initialized three-component seismic recording object.
Private API
- _read_mseed(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in miniSEED format.
Warning
Private API is subject to change without warning.
- Parameters:
fnames ({str, list}) – If
strthenfnamesis the name of the miniSEED file, full path may be used if desired. The file should contain three traces with the appropriate channel names. Refer to the SEED Manual. for specifics. Iflistthenfnamesis a list of length three with the names of miniSEED files for each component.obspy_read_kwargs (dict, optional) – For passing arguments to the
obspy.readfunction to customize its behavior, default isNoneindicating not keyword arguments will be passed.degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.
- _read_saf(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in SESAME ASCII format (SAF).
Warning
Private API is subject to change without warning.
- Parameters:
fnames (str) – Name of the SESAME ASCII format file, full path may be used if desired. The file should contain three traces with the appropriate channel names. See SESAME standard.
obspy_read_kwargs (dict, optional) – Ignored, kept only to maintain consistency with other read functions.
degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.
- _read_minishark(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in MiniShark format.
Warning
Private API is subject to change without warning.
- Parameters:
fnames (str) – Name of the MiniShark format file, full path may be used if desired. The file should contain three traces with the appropriate channel names.
obspy_read_kwargs (dict, optional) – Ignored, kept only to maintain consistency with other read functions.
degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.
- _read_sac(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in Seismic Analysis Code format.
Warning
Private API is subject to change without warning.
- Parameters:
fnames (list) – List of length three with the names of the Seismic Analysis Code (SAC) format files; one per component. Files can be little endian or big endian. Each file should the appropriate channel names. See SAC manual.
obspy_read_kwargs (dict, optional) – For passing arguments to the
obspy.readfunction to customize its behavior, default isNoneindicating no keyword arguments will be passed.degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.
- _read_gcf(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in Guralp Compressed Format (GCF).
Warning
Private API is subject to change without warning.
- Parameters:
fnames (str) – Name of the MiniShark Guralp Compressed Format (GCF) file, full path may be used if desired. The file should contain three traces with the appropriate channel names.
obspy_read_kwargs (dict, optional) – For passing arguments to the
obspy.readfunction to customize its behavior, default isNoneindicating no keyword arguments will be passed.degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.
- _read_peer(fnames, obspy_read_kwargs=None, degrees_from_north=None)
Read seismic data from file(s) in PEER format.
Warning
Private API is subject to change without warning.
- Parameters:
fnames (list) – List of length three with the names of the Pacific Earthquake Engineering Research (PEER) format files; one per component. Each file should have appropriate channel names. Some information on the PEER format is provided by SCEC.
obspy_read_kwargs (dict, optional) – Ignored, kept only to maintain consistency with other read functions.
degrees_from_north (float, optional) – Rotation in degrees of the sensor’s north component relative to magnetic north; clock wise positive. Default is 0.0 indicating the sensor’s north component is aligned with magnetic north.
- Returns:
SeismicRecording3C – Initialized 3-component seismic recording object.