def getGeoData(data): if "geo" in data and data["geo"] != None: return ("geo", data["geo"]["coordinates"]) elif "place" in data: point = getCenterOfMass(data["place"]["bounding_box"]["coordinates"][0]) return ("bb", [point[1], point[0]])
def ParseGeoData(data): if 'geo' in data and data['geo']!=None: return ('geo', data['geo']['coordinates']) elif 'place' in data: point = getCenterOfMass(data['place']['bounding_box']['coordinates'][0]) return ('bb', [point[1], point[0]])
def reducer(self, user, occurrences): points = list(occurrences) yield user, {'u': user, 'c': len(points), 'cm': list(getCenterOfMass(points)), 'rog': getRadiusOfGyration(points)}
def getMeanDistanceBetweenLids(_, llids): meanLid = getCenterOfMass(llids,accuracy=ACCURACY) return getMeanDistanceFromSource(meanLid, llids)
def getRadius(locations): meanLid = getCenterOfMass(locations,accuracy=LATTICE_ACCURACY) distances = [getHaversineDistance(meanLid, p) for p in locations] _, upperBoundForDistance = getOutliersRangeUsingIRQ(distances) return np.mean(filter(lambda d: d<=upperBoundForDistance, distances))