Table Of Contents

Previous topic

Package traces

Next topic

Module tracesParam

This Page

Main functionality: provide a processing of traces.

Module tracesMain

Provide a function treatTracesFromDirectory() in order to make all the treatment of the traces (see Overview of the Package traces).

Before running this function, it is necessary to set the parameters in the module traces.tracesParam and to define the treatment in the module traces.tracesDefineTreatments

Running the module:

For whisper users, suppose you have the directory traces (the package), simply type:

$ cd traces
$ python2.7

Python necessary libraries:

  • python2.7
  • scipy
  • numpy
  • obspy

More precisely we use at the present time:

>>> import numpy
>>> numpy.__version__
>>> import scipy
>>> scipy.__version__
>>> import obspy.core
>>> obspy.core.__version__
>>> import obspy.signal
>>> obspy.signal.__version__
>>> import obspy.sac
>>> obspy.sac.__version__
>>> import obspy.mseed
>>> obspy.mseed.__version__

See the general specification.

General specification


  • A ‘LoadDirectory’.
  • A component.
  • A set of stations.
  • A set of dates.
  • A new sampling rate.
  • A ‘SaveDirectory’.


  1. Extract all the traces from the ‘LoadDirectory’ whose correspond to the component, the set of dates and the set of stations.
  2. For each station and each day, built a trace whose duration is one day by agglomerating the stub of traces (If values are not defined, they are replaced by zero).
  3. Make the treatment of the day-traces before resampling (should be defined by the users).
  4. Make the resampling of the day-traces.
  5. Make the treatment of the day-traces after resampling (should be defined by the users).
  6. Save the day-traces in the ‘SaveDirectory’ with architecture: SaveDirectory -> Component -> Year -> Day -> Station.

Optional functionality:

Before processing the traces, for each day, dictionaries (python type) are made (serialize with cPickle) and contains all necessary metadatas (station, starttime, frequency, component, etc..) for all the traces for ordering and make the processing.

If this operation have been already done, you can skip it by setting to False of a boolean parameter in the module traces.tracesParam.


Very useful if only the treatment is changed.

Main restrictions of the specification

  • Traces durations: Take only account traces whose duration is less than a day. For example, if a trace have a duration of 2 days, only the first day is take account.
  • Traces date: The day associated to a trace is the day corresponding to the second sampling of the trace.
  • Traces frequencies: If, for a given day and a given station, there are traces with différents frequencies, keep only the traces that have the same frequency as the longest traces (the longest duration).
  • Traces overlapping: If, for a given day and a given station, two traces are overlapping, take trace with the oldest starttime for the overlapping section.

Whisper project: FP7 ERC Advanced grant 227507 (WHISPER).
Codes are develop for the Whisper project (Seismic ambient noise).
If you use this code, specify it is provide by: Whisper project FP7 ERC Advanced grant 227507 (WHISPER).
Author: Xavier Briand. For questions, send email to with subject begin exactly with [whisper].