def _correct_phase_wrap(ha):
    """Ensure hour angle is between -180 and 180 degrees.

    Parameters
    ----------
    ha : np.ndarray or float
        Hour angle in degrees.

    Returns
    -------
    out : same as ha
        Hour angle between -180 and 180 degrees.
    """
    return ((ha + 180.0) % 360.0) - 180.0