Mercurial Hosting > traffic-intelligence
view python/offset-trajectories.py @ 251:4978b5baf8f1
Win32 version for traffic intelligence. Use the README-Win32.txt to know how to
fetch the dependencies. A batch file is included to automate most of the process
author | Jeep-Tour@Jeep-Tour-PC |
---|---|
date | Mon, 23 Jul 2012 12:27:50 -0400 |
parents | 41a5853ec495 |
children |
line wrap: on
line source
#! /usr/bin/env python import sys import ubc_utils import utils if len(sys.argv) < 3: print("Usage: %s filename offsetframes") sys.exit() nFrames = int(sys.argv[2]) def modifyLines(objectNum, lines): result = lines tmp = lines[0].split(" ") firstInstant = int(tmp[1])+nFrames lastInstant = int(tmp[2])+nFrames tmp[1] = str(firstInstant) tmp[2] = str(lastInstant) result[0] = " ".join(tmp) return result ubc_utils.modifyTrajectoryFile(modifyLines, sys.argv[1], sys.argv[1]+".new")