From 13e1966e689f8bdb755f84e933157f7b22a881b3 Mon Sep 17 00:00:00 2001 From: Matteo Quintiliani Date: Thu, 30 Aug 2007 07:43:06 +0000 Subject: [PATCH] Fixed bug: set x0 to zero for mini seed when a gap or overlap occurs. git-svn-id: file:///home/quintiliani/svncopy/nmxptool/trunk@207 3cd66e75-5955-46cb-a940-c26e5fc5497d --- src/nmxptool.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/nmxptool.c b/src/nmxptool.c index 6cc0bcf..a689382 100644 --- a/src/nmxptool.c +++ b/src/nmxptool.c @@ -31,13 +31,17 @@ typedef struct { #define GAP_TOLLERANCE 0.001 -void nmxptool_check_and_log_gap(double time1, double time2, const double gap_tollerance, const char *station, const char *channel) { +int nmxptool_check_and_log_gap(double time1, double time2, const double gap_tollerance, const char *station, const char *channel) { + int ret = 0; double gap = time1 - time2 ; if(gap > gap_tollerance) { nmxp_log(1, 0, "Gap %.2f sec. for %s.%s from %.2f to %.2f!\n", gap, station, channel, time1, time2); + ret = 1; } else if (gap < -gap_tollerance) { nmxp_log(1, 0, "Overlap %.2f sec. for %s.%s from %.2f to %.2f!\n", gap, station, channel, time2, time1); + ret = 1; } + return ret; } static void clientShutdown(int sig); @@ -319,7 +323,10 @@ int main (int argc, char **argv) { channelListSeq[cur_chan].significant = 1; } else { if(channelListSeq[cur_chan].significant) { - nmxptool_check_and_log_gap(pd->time, channelListSeq[cur_chan].last_time, GAP_TOLLERANCE, pd->station, pd->channel); + if(nmxptool_check_and_log_gap(pd->time, channelListSeq[cur_chan].last_time, GAP_TOLLERANCE, pd->station, pd->channel)) { + channelListSeq[cur_chan].x_1 = 0; + nmxp_log(0, 0, "Warning: x0 set to zero!\n"); + } } } if(channelListSeq[cur_chan].significant && pd->nSamp > 0) { @@ -496,7 +503,10 @@ int main (int argc, char **argv) { channelListSeq[cur_chan].significant = 1; } else { if(channelListSeq[cur_chan].significant) { - nmxptool_check_and_log_gap(pd->time, channelListSeq[cur_chan].last_time, GAP_TOLLERANCE, pd->station, pd->channel); + if(nmxptool_check_and_log_gap(pd->time, channelListSeq[cur_chan].last_time, GAP_TOLLERANCE, pd->station, pd->channel)) { + channelListSeq[cur_chan].x_1 = 0; + nmxp_log(0, 0, "Warning: x0 set to zero!\n"); + } } } if(channelListSeq[cur_chan].significant && pd->nSamp > 0) { -- GitLab