gctl_seismic/lib/seismic/xcorrelation.h
2024-09-10 20:22:53 +08:00

83 lines
3.6 KiB
C++

/********************************************************
* ██████╗ ██████╗████████╗██╗
* ██╔════╝ ██╔════╝╚══██╔══╝██║
* ██║ ███╗██║ ██║ ██║
* ██║ ██║██║ ██║ ██║
* ╚██████╔╝╚██████╗ ██║ ███████╗
* ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
* Geophysical Computational Tools & Library (GCTL)
*
* Copyright (c) 2022 Yi Zhang (yizhang-geo@zju.edu.cn)
*
* GCTL 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 GCTL, please consider the option to obtain a commercial license for a
* fee. These licenses are offered by the GCTL'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.
******************************************************/
#ifndef _GCTL_SEISMIC_XC_H
#define _GCTL_SEISMIC_XC_H
#include "station.h"
#include "sac.h"
#include "map"
namespace gctl
{
namespace seismic
{
struct seed_info
{
std::string dir_file;
std::string stn_name;
std::string nwk_name;
double lon, lat, elev;
UTC_TIME stn_t0, stn_te;
std::vector<UTC_TIME> sac_t0;
std::vector<UTC_TIME> sac_te;
std::vector<double> sac_freq;
std::vector<int> sac_len;
std::vector<SIG_CHANNEL> sac_chl;
std::string get_sac_filename(int id);
};
/**
* @brief Callback interface for customed processing sequence for a signle signal unit.
*
*/
typedef int (*sig_unit_process_ptr)(SIG_UNIT &sig);
class Xcorrelation
{
public:
Xcorrelation(/* args */);
virtual ~Xcorrelation();
void create_stations(std::string info_list, SIG_CHANNEL working_chl); // Read seed info generated by the script 'sort_seed_sheet.sh'
void save_stations(std::string stn_file);
void create_station_sac(std::string working_dir, std::string out_dir, sig_unit_process_ptr pre_merge_func, sig_unit_process_ptr after_merge_func);
void Xcorrelation_two_stations(std::string stn_sac_list, std::string stn1_name, std::string stn2_name,
SIG_UNIT &out_xc, time_unit roundup, double frag_sec, double over_lap, double sigma,
sig_unit_process_ptr sig1_func, sig_unit_process_ptr sig2_func);
void Xcorrelation_all_stations(std::string working_dir, std::string out_dir, time_unit roundup, double frag_sec);
public:
std::vector<seed_info> seeds_;
std::vector<station> stations_;
std::map<std::string, std::string> stn_sacs_;
};
}
}
#endif // _GCTL_SEISMIC_ANT_H