code: def dist_calc(loc1, loc2):
      
      R = 6371.009  # Radius of the Earth in km
      dlat = np.radians(abs(loc1[0] - loc2[0]))
      dlong = np.radians(abs(loc1[1] - loc2[1]))
      ddepth = abs(loc1[2] - loc2[2])
      mean_lat = np.radians((loc1[0] + loc2[0]) / 2)
      dist = R * np.sqrt(dlat ** 2 + (np.cos(mean_lat) * dlong) ** 2)
      dist = np.sqrt(dist ** 2 + ddepth ** 2)
      return dist
docs: 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