phir = phi * pi / 180.  # change from degrees to radians