'''
Extract time series of given node
'''
import sys

nID = int(sys.argv[1])
startTime = 86400 * 6
#startTime = 86400 * 3
endTime = startTime + 86400 * 3

fdIn = open('selectedAttribs.txt', 'r')
fdOut = open('node' + sys.argv[1] + '.txt', 'w')
firstLine = True

for line in fdIn:
    if firstLine == True:
        fdOut.write(line)
        firstLine = False
        continue
    tmp = line.split('\t')
    if int(float(tmp[1])) > endTime: break
    if int(float(tmp[1])) < startTime: continue
    if int(tmp[0]) == nID:
        fdOut.write(line)
fdIn.close()
fdOut.close()
