gctl_seismic/exam/check_xc.cpp

75 lines
2.7 KiB
C++
Raw Normal View History

2024-09-10 20:22:53 +08:00
/********************************************************
* Copyright (c) 2023 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* ANT is distributed under a dual licensing scheme. You can redistribute
* it and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either version 2
* of the License, or (at your option) any later version. You should have
* received a copy of the GNU Lesser General Public License along with this
* program. If not, see <http://www.gnu.org/licenses/>.
*
* If the terms and conditions of the LGPL v.2. would prevent you from using
* the ANT, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the ANT's original author. As a rule,
* licenses are provided "as-is", unlimited in time for a one time fee. Please
* send corresponding requests to: yizhang-geo@zju.edu.cn. Please do not forget
* to include some description of your company and the realm of its activities.
* Also add information on how to contact you by electronic and paper mail.
******************************************************/
#include "../lib/seismic.h"
int before_processing(gctl::SIG_UNIT &sig)
{
//int factor = round(1/sig.delta);
if (sig.resampling(0.1, gctl::Second)) return -1;
return 0;
}
int after_processing(gctl::SIG_UNIT &sig)
{
return 0;
}
int sig1_processing(gctl::SIG_UNIT &sig)
{
//sig.remove_outliers(2);
sig.remove_mean();
//sig.normalize();
sig.spectral_whitening(20);
return 0;
}
int sig2_processing(gctl::SIG_UNIT &sig)
{
//sig.remove_outliers(2);
sig.remove_mean();
//sig.normalize();
sig.spectral_whitening(20);
return 0;
}
int main(int argc, char const *argv[]) try
{
gctl::seismic::Xcorrelation a;
//a.create_stations("/Users/zhangyi/Desktop/GX_XC/seed_info.md", gctl::SBHZ);
//a.save_stations("/Users/zhangyi/Desktop/GX_XC/station_info.md");
//a.create_station_sac("/Users/zhangyi/Desktop/GX_XC", "/Users/zhangyi/Desktop/GX_XC", before_processing, after_processing);
std::string s1 = "BBX";
std::string s2 = "TLX";
gctl::SIG_UNIT xc;
a.Xcorrelation_two_stations("/Users/zhangyi/Desktop/GX_XC/station_sac_list.txt", s1, s2, xc,
gctl::Mintue, 3600, 0.75, 5, sig1_processing, sig2_processing);
//xc.filter(gctl::HighPass, gctl::Butterworth, 5, 1.0/5.0);
xc.save("/Users/zhangyi/Desktop/GX_XC/xc_" +s1 + "_" + s2 + ".txt");
//a.Xcorrelation_all_stations("/Users/zhangyi/Desktop/TestOut", "/Users/zhangyi/Desktop/TestOut", gctl::Mintue, 180);
return 0;
}
catch(std::exception &e)
{
GCTL_ShowWhatError(e.what(), GCTL_ERROR_ERROR, 0, 0, 0);
}