import math


def dir_to_angle(direction):
    """Converts a direction vector into an angle.
  Args:
    direction: A (dx, dy) direction vector.
  Returns:
    An angle in degrees clockwise from up (0-360).
  """
    dx, dy = direction
    return (math.degrees(math.atan2(dy, dx)) + 90) % 360