import math


def sunset_hour_angle(lat, dec):
    """
    Calculate the sunset hour angle for a given latitude and solar declination
    (Allen et al. 1998).

    Parameters
    ----------
    lat : float
        Latitude (rad).
    dec : float
        Solar declination (rad).

    Returns
    -------
    float
        Sunset hour angle (rad).

    """
    return math.acos(-math.tan(lat) * math.tan(dec))