#NEWLINE# def arc_distance_python_nested_for_loops( a , b ) : #NEWLINE# #INDENT# '\n    Calculates the pairwise arc distance between all points in vector a and b.\n    ' #NEWLINE# a_nrows = a . shape [ 0 ] #NEWLINE# b_nrows = b . shape [ 0 ] #NEWLINE# distance_matrix = np . zeros ( ( a_nrows , b_nrows ) ) #NEWLINE# for i in range ( a_nrows ) : #NEWLINE# #INDENT# theta_1 = a [ ( i , 0 ) ] #NEWLINE# phi_1 = a [ ( i , 1 ) ] #NEWLINE# for j in range ( b_nrows ) : #NEWLINE# #INDENT# theta_2 = b [ ( j , 0 ) ] #NEWLINE# phi_2 = b [ ( j , 1 ) ] #NEWLINE# temp = ( pow ( sin ( ( ( theta_2 - theta_1 ) / 2 ) ) , 2 ) + ( ( cos ( theta_1 ) * cos ( theta_2 ) ) * pow ( sin ( ( ( phi_2 - phi_1 ) / 2 ) ) , 2 ) ) ) #NEWLINE# distance_matrix [ ( i , j ) ] = ( 2 * atan2 ( sqrt ( temp ) , sqrt ( ( 1 - temp ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# return distance_matrix