code: def angle_to_cartesian(lon, lat):
      
      theta = np.array(np.pi / 2. - lat)
      return np.vstack((np.sin(theta) * np.cos(lon),
                        np.sin(theta) * np.sin(lon),
                        np.cos(theta))).T
docs: Convert spherical coordinates to cartesian unit vectors.