Previous topic

Welcome to Whisper code’s documentation

Next topic

Overview of the Package correlations

This Page

Overview of the Package traces

General workflow

The package traces provides some tools in order to extract traces from a directory and treat them:

digraph structs {
    node [shape=Mrecord];
    Load [label="<LoadDirectory> LoadDirectory |Should contain files with format: \n sac, mseed, wav, etc... "];
    Save [label="<SaveDirectory> SaveDirectory |Architecture of traces treated: \n Component/Year/JulianDay/Station"];
    ModuleMain [shape=record, label="<ModuleMain> Module \n   traces.tracesMain| Extract all traces of seismograms \nand make the processing."];
    Load:LoadDirectory -> ModuleMain:ModuleMain ->Save:SaveDirectory


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.

General architecture

Architecture of modules (prefix “traces” is omitted):

digraph structs {
    Main [color="red", shape=tab, label="Main"];
    Param [color="green", shape=tab, label="Param"];
    GetParam [shape=tab, label="GetParam"];
    DictOfTraces [shape=tab, label="DictOfTraces"];
    GeneratorPath [shape=tab, label="GeneratorPath"];
    TestParam [shape=tab, label="TestParam"];
    Treatment [shape=tab, label="Treatment"];
    DefineTreatments [color="green", shape=tab, label="DefineTreatments"];
    Functions [color="blue", shape=tab, label="Functions"];
    Writer [shape=tab, label="Writer"];
    Util [shape=tab, label="Util"];
    Exceptions [shape=tab, label="Exceptions"];

    Main -> GetParam
    Main -> GeneratorPath
    Main -> Exceptions
    Main -> Writer
    Main -> Treatment
    Main -> DictOfTraces

    GetParam -> Param
    GetParam -> TestParam
    GetParam -> Util
    GetParam -> Exceptions

    DictOfTraces -> Exceptions

    GeneratorPath -> Exceptions

    Treatment -> DefineTreatments

    DefineTreatments -> Functions

    Writer -> Exceptions

    TestParam -> Util

    Exceptions -> Param


See also the tutorial

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].