This Page

Classes and methods to load and write the correlations.

Module doubletCorrelationIO

Inheritance diagram of CorrelationIO, LoaderOneCorrelationNpy, LoaderOneCorrelationMat, WriterOneCorrelationNpy, WriterOneCorrelationMat

class doublet.doubletCorrelationIO.CorrelationIO(**kwargs)

Provide a method getDirAndFileCorrelation() to get the path directory and the file name for loading the correlations.

Parameter :

A dictionary with the key:

param: obj

Should have an attribute ‘FormatCorrelation’. Should have an attribute ‘FirstComponent’. Should have an attribute ‘SecondComponent’.

For method getDirAndFileCorrelation(), depend on variable ‘typeCorrelation’

  • ‘stack’

    Should have an attribute ‘PathDirCorrStack’. Should have an attribute ‘SeparatorStackDir’. Should have an attribute ‘SeparatorStackCoupleStations’.

  • ‘mean’

    Should have an attribute ‘PathDirCorrMean’. Should have an attribute ‘SeparatorMeanDir’. Should have an attribute ‘SeparatorMeanCoupleStations’.

  • ‘corr’

    Should have an attribute ‘PathDirCorr’. Should have an attribute ‘SeparatorCorrDir’. Should have an attribute ‘SeparatorCorrCoupleStations’.

getDirAndFileCorrelation(typeCorrelation, FirstStation, SecondStation, Date=None)

Return a path directory dependent of the component and the date and a file name dependent of the station.

tryMakeDirectories(DirSave)

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

Parameter :
DirSave: str

The path directory.

Note

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

loadOneCorrelation(DirCorrelation, FileCorrelation)

Abstract method, not implemented.

writeOneCorrelation(DirCorrelation, FileCorrelation, corr)

Abstract method, not implemented.

class doublet.doubletCorrelationIO.LoaderOneCorrelationNpy(**kwargs)

Class to load correlations with numpy format.

Base class:CorrelationIO Inherits all attibutes of the base class.
Parameter :see class CorrelationIO
loadOneCorrelation(DirCorrelation, FileCorrelation)

Load a correlation with the file path given and the format numpy (.npy).

Parameters :
DirSave: str

Directory name to load the correlation.

FileSave: str

File name of the correlation loaded.

class doublet.doubletCorrelationIO.LoaderOneCorrelationMat(**kwargs)

Class to load correlations with matlab format.

Base class:CorrelationIO Inherits all attibutes of the base class.
Parameter :see class CorrelationIO
loadOneCorrelation(DirCorrelation, FileCorrelation)

Load a correlation with the file path given and the format matlab (.mat).

Parameters :
DirSave: str

Directory name to load the correlation.

FileSave: str

File name of the correlation loaded.

Note

Requirement: The field in the matlab structure for the array of the correlation is ‘corr’.

class doublet.doubletCorrelationIO.WriterOneCorrelationNpy(**kwargs)
Base class:CorrelationIO Inherits all attibutes of the base class.
Parameter :see class CorrelationIO
writeOneCorrelation(DirSave, FileSave, corr)

Save a correlation with the file path given and the format numpy (.npy).

Parameters :
corr: numpy array

The correlation to be saved.

DirSave: str

Directory name to save the trace.

FileSave: str

File name of the trace saved.

(Try twice to save the correlations for concurrency problems.)

class doublet.doubletCorrelationIO.WriterOneCorrelationMat(**kwargs)
Base class:CorrelationIO Inherits all attibutes of the base class.
Parameter :see class CorrelationIO
writeOneCorrelation(DirSave, FileSave, corr)

Save a correlation with the file path given and the format matlab (.mat).

Parameters :
corr: numpy array

The correlation to be saved.

DirSave: str

Directory name to save the trace.

FileSave: str

File name of the trace saved.

(Try twice to save the correlations for concurrency problems.)


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