'''
Reassign sensor IDs
'''
fdIn = open('SReadings.txt', 'r')
fdOut = open('SReadings_final.txt', 'w')
newSID = {}

for line in fdIn:
    l = line.split()
    if l[0] not in newSID: newSID[l[0]] = len(newSID)
    sID = newSID[l[0]]
    tmpStr = str(sID)
    for i in range(1, len(l)): tmpStr += '\t' + l[i]
    fdOut.write(tmpStr + '\n')
fdIn.close()
fdOut.close()

