from math import sin, cos, asin, sqrt

def hav(lona, lonb, lata, latb):
	# ported from latlontools
	# assume latitude and longitudes are in radians
	diff_lat = lata - latb
	diff_lon = lona - lonb

	a = sin(diff_lat/2)**2 + cos(lona) * cos(latb) * sin(diff_lon/2)**2
	c = 2 * asin(sqrt(a)) 
	r = 6371 # radius of earth in km
	return c * r
from math import sin, cos, asin, sqrt

def hav(lonlata, lonlatb):
	# ported from latlontools
	# assume latitude and longitudes are in radians
	lona = lonlata[0]
	lata = lonlata[1]

	lonb = lonlatb[0]
	latb = lonlatb[1]
	
	diff_lat = lata - latb
	diff_lon = lona - lonb

	a = sin(diff_lat/2)**2 + cos(lona) * cos(latb) * sin(diff_lon/2)**2
	c = 2 * asin(sqrt(a)) 
	r = 6371 # radius of earth in km
	return c * r
Change call signature of hav to 2 pairs
Change call signature of hav to 2 pairs

  from math import sin, cos, asin, sqrt
  
- def hav(lona, lonb, lata, latb):
+ def hav(lonlata, lonlatb):
  	# ported from latlontools
  	# assume latitude and longitudes are in radians
+ 	lona = lonlata[0]
+ 	lata = lonlata[1]
+ 
+ 	lonb = lonlatb[0]
+ 	latb = lonlatb[1]
+ 	
  	diff_lat = lata - latb
  	diff_lon = lona - lonb
  
  	a = sin(diff_lat/2)**2 + cos(lona) * cos(latb) * sin(diff_lon/2)**2
  	c = 2 * asin(sqrt(a)) 
  	r = 6371 # radius of earth in km
  	return c * r
Change call signature of hav to 2 pairs
## Code Before:
from math import sin, cos, asin, sqrt

def hav(lona, lonb, lata, latb):
	# ported from latlontools
	# assume latitude and longitudes are in radians
	diff_lat = lata - latb
	diff_lon = lona - lonb

	a = sin(diff_lat/2)**2 + cos(lona) * cos(latb) * sin(diff_lon/2)**2
	c = 2 * asin(sqrt(a)) 
	r = 6371 # radius of earth in km
	return c * r
## Instruction:
Change call signature of hav to 2 pairs
## Code After:
from math import sin, cos, asin, sqrt

def hav(lonlata, lonlatb):
	# ported from latlontools
	# assume latitude and longitudes are in radians
	lona = lonlata[0]
	lata = lonlata[1]

	lonb = lonlatb[0]
	latb = lonlatb[1]
	
	diff_lat = lata - latb
	diff_lon = lona - lonb

	a = sin(diff_lat/2)**2 + cos(lona) * cos(latb) * sin(diff_lon/2)**2
	c = 2 * asin(sqrt(a)) 
	r = 6371 # radius of earth in km
	return c * r