def extract_rxp(filename, tmpDir, sbet=None): ''' Extract pointcloud data from raw RXP file to ascii GZ file for further processing ''' print "\n#{}: Opening rxp file {}".format(time.strftime('%X %x'), filename) rxp = RXPFile() if sbet is None: print "\n#{}: Opening rxp file {}".format(time.strftime('%X %x'), filename) rxp.open(filename) else: print "\n#{}: Opening rxp file {} with sbet {}".format(time.strftime('%X %x'), filename, sbet) rxp.open_w_sbet(filename, sbet) results = [] while True: args = rxp.read(SKIP, FILTER) if(args == 0): break results.append(write_extracted(args[0], args[1], args[2], tmpDir)) return [filename, results]
from scanifc import RXPFile import sys import os if __name__ == '__main__': # Get command line arguments, else fail if(len(sys.argv) != 3): print "{} takes two arguments".format(sys.argv[0]) print "Usage: python rxpSplitter.py *.rxp seconds" exit(0) # The rxp file to process filename = sys.argv[1] sec_split = sys.argv[2] # Create directory for split files # inDir/basename_split/ -split rxp files inDir, basename = os.path.split(filename) # Check if split directory exists, if not make it splitDir = os.path.join(inDir, "{}_split".format(basename)) if not os.path.exists(splitDir): os.makedirs(splitDir) rxp = RXPFile() rxp.open(filename) rxp.split_rxp(1, splitDir, True) rxp.close()