Skip to content

Instantly share code, notes, and snippets.

@Grazfather
Created July 14, 2014 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Grazfather/1b10a6aa683a2ac2d56c to your computer and use it in GitHub Desktop.
Save Grazfather/1b10a6aa683a2ac2d56c to your computer and use it in GitHub Desktop.
# This script is designed to extract CUPTs from a truth file
# Want to ignore all '#' from truth file
#
# Objective is to extract:
# 1. GPS time (double, column 1)
# 2. Latitude (double, column 3)
# 3. Longitude (double, column 4)
# 4. Height (double, column 5)
#
# Output file called CUPTs.txt
# 1. Number, starting at 1 for first line
# 2. Extracted items (see objective)
# 3. Append 3 lever arm parameters per line
# 4. Append 3 standard deviations per line
#
# Example output lines (must be in this format):
# 1 489347.000 51.1165232471 -114.0375469958 1042.192 0 0 0 0.5 0.5 0.5
# 2 489348.000 51.1165232859 -114.0375469742 1042.191 0 0 0 0.5 0.5 0.5
truth = open('.\ISA100C_truth.export', 'r')
start = 489347 # 1st CUPT epoch (seconds)
duration = 3600 # duration from start when CUPTs are extracted (seconds)
rate = 30 # how many CUPTs extracted per interval
interval = 300 + rate # duration between 1st CUPT from an interval to the 1st CUPT from next interval (seconds)
# The script should output 30 lines (30 seconds, ie. 489347 - 489377) then jump ahead 5 minutes later (300 seconds
# after the last output time [489377], ie. to epoch 489977) and output the next 30 lines (30 seconds, ie. 489977 - 490007).
# This pattern continutes for the duration (3600 seconds).
#
# What ever I already have may probably go to shit.
temp = []
lines = truth.readlines()
count = 1
for line in lines:
if not line.startswith("#"):
#print "DEBUG: Got line " + line
cols = line.split()
print "%d %s %s %s %s" % (count, cols[0], cols[1], cols[2], cols[3])
count +=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment