def dist_calc(loc1, loc2):
R = <NUM_LIT>  <EOL>dlat = np.radians(abs(loc1[<NUM_LIT:0>] - loc2[<NUM_LIT:0>]))<EOL>dlong = np.radians(abs(loc1[<NUM_LIT:1>] - loc2[<NUM_LIT:1>]))<EOL>ddepth = abs(loc1[<NUM_LIT:2>] - loc2[<NUM_LIT:2>])<EOL>mean_lat = np.radians((loc1[<NUM_LIT:0>] + loc2[<NUM_LIT:0>]) / <NUM_LIT:2>)<EOL>dist = R * np.sqrt(dlat ** <NUM_LIT:2> + (np.cos(mean_lat) * dlong) ** <NUM_LIT:2>)<EOL>dist = np.sqrt(dist ** <NUM_LIT:2> + ddepth ** <NUM_LIT:2>)<EOL>return dist<EOL>
Function to calculate the distance in km between two points.

Uses the flat Earth approximation. Better things are available for this,
like `gdal <http://www.gdal.org/>`_.

:type loc1: tuple
:param loc1: Tuple of lat, lon, depth (in decimal degrees and km)
:type loc2: tuple
:param loc2: Tuple of lat, lon, depth (in decimal degrees and km)

:returns: Distance between points in km.
:rtype: float