/******************************************************** * 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 . * * 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 main(int argc, char *argv[]) { gctl::SAC sac1("/Users/zhangyi/Desktop/GX_XC/MERGED.2016.121.15.59.58.7600.GX.BBX.00.SHZ.D.SAC"); sac1.info(); //sac1.plot("tmp.eps"); //sac1.save("tmp.SAC_ASC"); /* gctl::SIG_UNIT sig; gctl::UTC_TIME t("2016-10-17T20:00:00.000"); sac1.signal.cut_section(sig, t, 3600); sig.remove_outliers(2.5); sig.remove_mean(); sig.plot(); */ /* gctl::SAC sac2("exam/data/2016.291.15.59.59.5900.GX.BBX.00.SHZ.D.SAC"); sac2.info(); gctl::array sac1_fragments, sac2_fragments; sac1.signal.cut_multiple_sections(gctl::Mintue, 120, sac1_fragments); sac2.signal.cut_multiple_sections(gctl::Mintue, 120, sac2_fragments); std::map xc_list; std::map::iterator iter; for (size_t i = 0; i < sac1_fragments.size(); i++) { for (size_t j = 0; j < sac2_fragments.size(); j++) { if ((sac1_fragments[i].t0 == sac2_fragments[j].t0) && (sac1_fragments[i].val.size() == sac2_fragments[j].val.size()) && fabs(sac1_fragments[i].delta - sac2_fragments[j].delta) < 1e-6 && fabs(sac1_fragments[i].rt0 - sac2_fragments[j].rt0) < 1e-6) { xc_list[i] = j; } } } //sac1_fragments[0].remove_mean(); //sac2_fragments[0].remove_mean(); //sac1_fragments[0].normalize(); //sac2_fragments[0].normalize(); //sac1_fragments[0].plot(); //sac2_fragments[0].plot(); //gctl::SIG_UNIT s; //s.linear_cross_correlation(sac1_fragments[0], sac2_fragments[0]); //s.plot(); std::cout << xc_list.size() << "\n"; int c = 0; gctl::array xcs(xc_list.size()); for (iter = xc_list.begin(); iter != xc_list.end(); ++iter) { sac1_fragments[iter->first].remove_mean(); sac2_fragments[iter->second].remove_mean(); sac1_fragments[iter->first].down_sampling(100); sac2_fragments[iter->second].down_sampling(100); sac1_fragments[iter->first].normalize(); sac2_fragments[iter->second].normalize(); xcs[c].linear_cross_correlation(sac1_fragments[iter->first], sac2_fragments[iter->second]); xcs[c].remove_mean(); xcs[c].normalize(); c++; } gctl::SIG_UNIT x; x.stack_sig_units(xcs); x.plot("xc.eps"); */ /* gctl::SAC sac2; gctl::UTC_TIME c("2015-6-9T0:10:00.000"); sac1.cut_section(sac2, c, 60.0); sac2.down_sampling(100); sac2.remove_mean(); sac2.normalize(); sac2.info(); sac2.plot("exam/data/segment.eps"); sac2.save("exam/data/segment.SAC"); */ return 0; }