Key functions
Here we list key functions used in the SeisMonitoring.jl
. You can find the use of the functions in the tutorial of SeisMonitoring_Example.
SeisMonitoring.init_project
— Functioninit_project((
;
project_name::String = "project",
project_inputdir::String = "./",
project_outputdir::String = "./",
gui::String = true;
force::Bool=false
)
Initiate project directory where data is output. You can output data to local machine, external HDD, scratch, etc.
Arguments
project_name::String
: project name used as directory name [default: "project"]project_inputdir::String
: absolute/relative path to make new input project directory [default: "."]project_outputdir::String
: absolute/relative path to make new output project directory [default: "."]gui::Bool
: true if you want to use gui (you can use this to initiate case studies)force::Bool=false
: true if you want to remove existing file and init project.
Input and output directories can be separated for the use on local/HDD/cloud/scratch file system.
Examples
- run project on your local machine
init_project(project_name="project_test",
project_inputdir=".",
project_outputdir=".")
- run project with external drive
init_project(project_name="project_external_drive",
project_inputdir=".",
project_outputdir="/path-to-directory-in-your-external-drive")
SeisMonitoring.set_parameter
— Functionset_parameter(inputfilename::String, key::String, value::String)
Set parameter of input dictionary in the inputfile.
SeisMonitoring.get_parameter
— Functionget_parameter(inputfilename::String, parametername::String)
get parameter from input file.
SeisMonitoring.run_job
— Functionrun_job(inputfile::String="";
seisdownload::Bool=true,
seisremoveeq::Bool=true,
seisxcorrelation::Bool=true,
seisstack::Bool=true,
)
running job in the project folder.
Arguments
inputfile::String
: absolute/relative path to input file (e.g. "./project/inputfile/input.jl")
Options
- 'seisdownload::Bool' : run seisdownload if true [default:true]
- 'seisremoveeq::Bool' : run seisremoveeq if true [default:true]
- 'seisxcorrelation::Bool' : run seisxcorrelation if true [default:true]
- 'seisstack::Bool' : run seisstack if true [default:true]
SeisMonitoring.assemble_seisdata
— Functionassemble_seisdata(C::SeisChannel)
Assemble seisdata from starttime to endtime (target time window), importing data from jld2 with SeisMonitoring.jl format.
SeisNoise.phase_shift!(SeisChannel) is NOT applied during this process.
Arguments
netstachan::String
: net.sta.loc.chan to be assembledfileio::JLD2.JLDFile
: JLD2.JLDFile io of input jld2 filestarttime::DateTime
: starttime to be assembledendtime::DateTime
: endtime to be assembleddata_contents_fraction::Float64=0.8
: if data exists more than data-contents-fraction within target window, return S.
Return
S::SeisChannel
: SeisChannel which contains data from starttime to endtime
Note
This assemble function aims to realize robust input formats in different time scale and data situation.
Warning: When marging the original data, tapering is applied to make the data continuous. This might cause an issue when The original data chunk is too small comparing with target window.
Bad example: save the data chunk every half an hour, and assemble the data into one day.
To avoid that, please set close enough between cc_time_unit
(unit of target window length) and data chunk;
Good example: save the data chunk every day, and assemble the data into one day or harf a day.
SeisMonitoring.assemble_corrdata
— Functionassemble_corrdata(C::SeisChannel)
Assemble corrdata from starttime to endtime (target time window) within a frequency band, importing data from jld2 with SeisMonitoring.jl format.
Arguments
fileio::JLD2.JLDFile
: JLD2.JLDFile io of input jld2 file
- stationpair::String
: NOTE: This is deprecated because of the change of corrdata jld2 format. stationpair to be assembled
starttime::DateTime
: starttime to be assembledendtime::DateTime
: endtime to be assembledfreqkey::String
: Frequency band key used to decompose frequency contents of cc.min_cc_datafraction::Float64
: minimum data fraction of cc within the request time.CorrData_Buffer::Dict
: Dictionary of CorrData to optimize File IO.MAX_MEM_USE::AbstractFloat=4.0
: Maximum memory use; throw warning if the memory use exceeds this number.rename::Bool=true
: true if rename C.name to nochan_stationpair.
Return
C::CorrData
: CorrData which contains data from starttime to endtime
Note: 2021.06.07 adding "rename::Bool=true" to assemble corrdate with channel change. Rename to nochan_stationpair.
SeisMonitoring.cc_medianmute!
— Functioncc_medianmute(C::CorrData, cc_medianmute_max::Float64 = 10.0, cc_medianmute_min::Float64 = 0.0)
Mute cross-correlation function whose maximum amplitude is more than cc_medianmute_max*median(maximum(abs.(cross-correlation functions)))
and less than cc_medianmute_min*median((maximum(abs.(cross-correlation functions)))
SeisMonitoring.compute_frequency_decomposition
— Functioncompute_frequency_decomposition(C::CorrData, freqency_band::Array{Float64,1}; cc_bpfilt_method::String="Butterworth",
dj::Float64 = 1 / 12, α0::AbstractFloat = 0.0, αmax::AbstractFloat = 0.25)
compute frequency decomposition of cross-correlation function in corrdata
Argument
C::CoreData
: CorrData contains broadband frequency contents.cc_bpfilt_method::String
: Bandpass filtering method. "Butterworth" or "Wavelet"dj::AbstractFloat
: Spacing between discrete scales. Default value is 1/12.α0::AbstractFloat=0.0
: Lowest tapering fraction for frequency adaptive tapering.αmax::AbstractFloat=0.25
: Highest tapering fraction for frequency adaptive tapering.
Return
C_all::Array{CorrData, 1}
: CorrData contains narrow frequency bandfreqband::Array{Array{Float64,1},1}
: frequency band used in the C_all.
SeisMonitoring.const_slice_codawindow
— Functionconst_slice_codawindow!(A, maxlag, fm, fs, dist, background_vel,
min_ballistic_twin, max_coda_length; zeropad=false)
Slicing coda window based on prescribed velocity, maximum coda length and maximum coda length.
Author: Kurama Okubo (https://github.com/kura-okubo) 2021.03.15
const_slice_codawindow!(A, maxlag, fm, fs, dist, background_vel,
min_ballistic_twin, max_coda_length; zeropad=false)
Slicing coda window based on prescribed velocity, maximum coda length and maximum coda length.
Author: Kurama Okubo (https://github.com/kura-okubo) 2021.03.15