def clean_array(array_pp, value_min, value_max, param_=()):
    """
    Function that replace with nan, the values of array_pp that
    are outside the interval value_min - value_max

    Optionally, you can give one o more list or numpy.arrays to
    remove the same indices of array_pp
    """
    copy_app = array_pp[:]
    len_pp = len(copy_app)
    param_ = param_[:]
    if param_ and type(param_) is not tuple:
        param_ = [param_]
    elif type(param_) is tuple:
        param_ = list(param_)
    for i, value in enumerate(copy_app):
        if value < value_min or value > value_max:
            copy_app[i] = float('nan')
            if param_:
                for array in param_:
                    if len(array) != len_pp:
                        raise ValueError(
                            'Invalid inputs: input arrays has                                          not the same lenght'
                            )
                    else:
                        array[i] = float('nan')
    if param_:
        return copy_app, param_
    else:
        return copy_app
