Exemple #1
0
def mapData(data):
	"""
	Segments the path into mini-paths of varying colors
	(color dependent on radiation levels)

	Parameters:
	data 	(List): A list of parsed log entries
	"""


	while len(data) > 1:
		# Make a new path
		path = []

		# Set the initial points
		path.append(data[0])
		del data[0]
		path.append(data[0])

		# Verify that the points are from a consecutive time interval
		if compareTimes(path[0][0], path[1][0]) != 5:
			# If not, continue from the next possible path
			continue

		# Verify GPS validity flag
		if path[0][8] == 'V' or path[1][8] == 'V':
			# If invalid, continue from next possible path
			continue


		# Determine the radiation level of the path in CPM
		radlvl = data[0][1]


		# Calculate the radiation color of the path
		radColor = calcRadColor(data[0])


		# Add additional points to the path, if applicable
		while len(data) > 1:
			if data[0][1] == radlvl and data[0][8] != 'V':
				del data[0]
				path.append(data[0])
			else:
				break

		# Add units and equivalent measurements
		uSvPerHr = CPMTomSvPerHr(int(radlvl))
		Bq = CPMToBq(int(radlvl))
		uRemPerHr = CPMToRemPerHr(int(radlvl))
		radlvl = str(radlvl) + " CPM"
		radlvl = (radlvl, uSvPerHr, Bq, uRemPerHr)

		# Send the path off to be added to the KML
		KMLWriter.makeLine(path, radColor, radlvl)