import functools


def cast_to_float(original_func):
    """
    Cast a function's argument to float before the function operates on it, like:

    Examples
    --------
    >>> @cast_to_float
    ... def stla_to_lat(stla):
    ...     return stla
    >>> lat = stla_to_lat(numpy.float32(12.3))
    >>> type(lat)
    float
    # not numpy.float32

    """
    @functools.wraps(original_func)
    def converter(hdr):
        return original_func(float(hdr))
    return converter