def _composite_convolution(field, kernels, weights):
    """
    Compute a localized convolution by applying a set of kernels with the
    given spatial weights. The weights are assumed to be normalized.
    """
    n = len(kernels)
    field_c = 0.0

    for i in range(n):
        field_c += weights[i] * _masked_convolution(field, kernels[i])

    return field_c
Compute a localized convolution by applying a set of kernels with the
given spatial weights. The weights are assumed to be normalized.
pysteps/nowcasts/linda.py