示例#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)
示例#2
0
# Make sure output file has a proper value. Input file will be handled by the Parser
if outputFile == "":
    """
    Give it the same name as the logFile

    Also, remove the path (if) trailing
    the logFile by splicing from the last
    occurence from '/'
    """
    outputFile = logFile[logFile.rfind("/") + 1:-4] + ".kml"
elif outputFile[-4:] != ".kml":
    outputFile += ".kml"

print "Input :", logFile
print "Output:", outputFile

# Initialize the KML File
if widthText == "":
    KMLWriter.initKML ()
else:
    KMLWriter.initKML (widthText)

# Map the data obtained from the log file
Mapper.mapData (data)

# Write all the data to the KML file
KMLWriter.endKML (outputFile)

""" END - Script Execution """