4.6. pre_processing

Utilities module for the EQcorrscan package written by Calum Chamberlain of Victoria University Wellington. These functions are designed to do the basic processing of the data using obspy modules (which also rely on scipy and numpy).

Copyright 2015 Calum Chamberlain

This file is part of EQcorrscan.

EQcorrscan is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

EQcorrscan is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with EQcorrscan. If not, see <http://www.gnu.org/licenses/>.

pre_processing._check_daylong(tr)[source]

Function to check the data quality of the daylong file - check to see that the day isn’t just zeros, with large steps, if it is then the resampling will hate it.

Parameters:tr (obspy.Trace) – Trace to check if the data are daylong.
Return qual:bool
pre_processing.dayproc(tr, lowcut, highcut, filt_order, samp_rate, debug, starttime)[source]

Basic function to bandpass, downsample and check headers and length of trace to ensure files start at the start of a day and are daylong.

Works in place on data. This is employed to ensure all parts of the data are processed in the same way.

Parameters:
  • tr (obspy.Trace) – Trace to process
  • highcut (float) – High cut in Hz for bandpass
  • filt_order (int) – Corners for bandpass
  • samp_rate (float) – Desired sampling rate in Hz
  • debug (int) – Debug output level from 0-5, higher numbers = more output
  • starttime (obspy.UTCDateTime) – Desired start of trace
Returns:

obspy.Stream

Note

Will convert channel names to two charecters long.

pre_processing.shortproc(st, lowcut, highcut, filt_order, samp_rate, debug=0)[source]

Basic function to bandpass and downsample.

Works in place on data. This is employed to ensure all parts of the data are processed in the same way.

Parameters:
  • st (obspy.Stream) – Stream to process
  • highcut (float) – High cut for bandpass in Hz
  • lowcut (float) – Low cut for bandpass in Hz
  • filt_order (int) – Number of corners for bandpass filter
  • samp_rate (float) – Sampling rate desired in Hz
  • debug (int) – Debug flag from 0-5, higher numbers = more output
Returns:

obspy.Stream

Note

Will convert channel names to two charecters long.