def corr_cluster(trace_list, thresh=<NUM_LIT>):
stack = stacking.linstack([Stream(tr) for tr in trace_list])[<NUM_LIT:0>]<EOL>output = np.array([False] * len(trace_list))<EOL>group1 = []<EOL>array_xcorr = get_array_xcorr()<EOL>for i, tr in enumerate(trace_list):<EOL><INDENT>if array_xcorr(<EOL>np.array([tr.data]), stack.data, [<NUM_LIT:0>])[<NUM_LIT:0>][<NUM_LIT:0>][<NUM_LIT:0>] > <NUM_LIT>:<EOL><INDENT>output[i] = True<EOL>group1.append(tr)<EOL><DEDENT><DEDENT>if not group1:<EOL><INDENT>warnings.warn('<STR_LIT>')<EOL>return output<EOL><DEDENT>stack = stacking.linstack([Stream(tr) for tr in group1])[<NUM_LIT:0>]<EOL>group2 = []<EOL>for i, tr in enumerate(trace_list):<EOL><INDENT>if array_xcorr(<EOL>np.array([tr.data]), stack.data, [<NUM_LIT:0>])[<NUM_LIT:0>][<NUM_LIT:0>][<NUM_LIT:0>] > thresh:<EOL><INDENT>group2.append(tr)<EOL>output[i] = True<EOL><DEDENT>else:<EOL><INDENT>output[i] = False<EOL><DEDENT><DEDENT>return output<EOL>
Group traces based on correlations above threshold with the stack.

Will run twice, once with a lower threshold to remove large outliers that
would negatively affect the stack, then again with your threshold.

:type trace_list: list
:param trace_list:
    List of :class:`obspy.core.stream.Trace` to compute similarity between
:type thresh: float
:param thresh: Correlation threshold between -1-1

:returns:
    :class:`numpy.ndarray` of bool of whether that trace correlates well
    enough (above your given threshold) with the stack.

.. note::
    We recommend that you align the data before computing the clustering,
    e.g., the P-arrival on all templates for the same channel should
    appear at the same time in the trace.  See the
    :func:`eqcorrscan.utils.stacking.align_traces` function for a way to do
    this.