eqcorrscan / EQcorrscan

Earthquake detection and analysis in Python.
https://eqcorrscan.readthedocs.io/en/latest/
Other
166 stars 86 forks source link

Annoying output from multi_corr.c #482

Closed dr-glenn closed 2 years ago

dr-glenn commented 2 years ago

EqCorrscan version 0.4.2 in Python 3.7

Describe the bug When running Tribe.detect I am seeing a huge number (> 300K) reports of "SETTING TO ZERO". These messages originate from function set_ncc. There is a mistake in the error message itself and it would be nice to make the message more compact, The error message looks like this: _SETTING TO ZERO.WARNING: Correlation out of range at: nccindex: 416899819 template: 120 channel: 0 index: 2199735 value: 1.545099

  1. There should be \n after "SETTING TO ZERO.", because "WARNING" actually starts a new message.
  2. It would be nice if the debug info was printed on one line.
  3. I am unable to intercept stdout and stderr with Python logging, probably nothing to be done about that.

To Reproduce I don't know what's causing it. I am finding matches, but don't know if these messages mean I am missing many more possibilities..

Additional Context My Tribe has 140 templates and I am searching a one month span with up to 65 stations (most templates have fewer than 20) at 40 samples/sec, so perhaps the number of messages is not crazy, but the number of lines is. I wish I knew what this report means. I can see that it occurs when fabs(value) > 1.05, but why is it happening so often?

calum-chamberlain commented 2 years ago

This is usually caused by zeros or spikes in your continuous data or templates. You should check (in this case) template 120 (when sorted in the order used internally), and the zeroth channel. This can be a little painful, but it is worth it to make sure that you are not getting spurious results. It may be stemming from the channels that are not matched with continuous data.

Agree on the newline character needed, if you want to make a PR that does that and prints all the debug info on one line that would be helpful.

calum-chamberlain commented 2 years ago

I think this was fixed in 0.4.3 and the warning message is now:

printf("WARNING: Correlation value=%f:\tncc_index: %ld\ttemplate: %ld\tchannel: %i\tindex: %ld\nSETTING TO ZERO.\n",
                   value, ncc_index, t, chan, i);

Please reopen if you need to.