Previous topic

Module tracesGetParam

Next topic

Module tracesGeneratorPath

This Page

Make the dictionaries of traces before processing.

Module tracesDictOfTraces

traces.tracesDictOfTraces

  • Provide a class DictOfTraces in order make the dictionaries of traces before treat them.
  • Dictionaries contains all the metadata of the traces whose corresponding files are contained in a directory defined by the attribute LoadDirectory and these files are classical format for seismogram: they are open by the obspy.core.read() function of the obspy library (see http://docs.obspy.org/packages/autogen/obspy.core.stream.read.html).
  • Each dictionary, one for each date, contains all the necessary informations (metadata), particularly for classify traces with their station and their starttime.
class traces.tracesDictOfTraces.DictOfTraces(**kwargs)

Provides methods in order to make dictionaries of all the “metadata” of traces contained in a directory.

The methods permits to built a dictionary for each date of the form:

{Station{Component{List of files with the indexes of traces and the metadata}}}.
Attributes :
SaveDirectory: str

Defined in the module tracesParamIO

LoadDirectory: str

Defined in the module tracesParamIO

ListOfStations: list

Defined in the module tracesParamIO

ListOfDates: lis

Defined in the module tracesParamIO

PrefixNameFileDictsOfTraces: str

Defined in the module tracesParamIO

PathDirDictsOfTraces: str

Defined in the module tracesParamIO

PathDirectoryTemp: str

The directory for saving temporary file.

NumberMaxTracesOneDictOfTraces: int

The maximum number of traces in one dictionary of traces.

writeDirectory(pathDir)

Write all the directories defined in the path directory with right 755 if they do not exist.

Parameter :
pathDir: str

The path directory.

Note

If it is not possible, catch the exception and print a message. (Try twice for concurrency problems.)

removeTemporaryDirectory()

Remove temporary directory and all the temporary files (made in order to create the dictionaries of traces). If it is not possible, just print a message.

makeTempPickleFilesOfDictOfTraces()

Built temporary dictionaries of the form:

{year{JulianDay{Station{Component{List of files with the indexes of traces and the metadata}}}}}.

Note

Each dictionary contains at most NumberMaxTracesOneDictOfTraces traces.

giveJulianDayTraceFromDateTime(DateTime, FreqSamplingRate)

Return a string of 3 characters ‘ccc’ that correspond to the julian day, e.g. ‘024’, of the second sampling induced by the date and the frequency of the sampling.

Parameter :
DateTime: datetime.datetime object or obspy.core.utcdatetime.UTCDateTime object

DateTime is a date.

FreqSamplingRate: float

The frequency sampling in Hz. FreqSamplingRate must be greater than 1.0.

Example :
>>> x=datetime.datetime(2007, 12, 6, 23, 59, 59, 995000)
>>> print giveJulianDayTraceFromDateTime(x, 90)
341
>>> x=datetime.datetime(2007, 12, 6, 23, 59, 59, 985000)
>>> print giveJulianDayTraceFromDateTime(x, 90)
340
makeDictOfTraceOfOneDayFromTempFilesDictOfTraces()

For each date, built dictionaries of the form:

{Station{Component{List of files with the indexes of traces and the metadata}}}.

The directory where dictinorary are serialize (with cPickle) is defined by the method getDirAndFileDictOfDoublet in the module traces.tracesGetParam.


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 xav.briand.whisper@gmail.com with subject begin exactly with [whisper].