#! /usr/bin/env python
#Concatenate and compress files

import subprocess

#Edit range to select the flights to process.
#Sometimes disk constraints mean that only some of the flight
#data can be converted at once.
for i in range(8,10):
  s = str(i)
  concat = './concat csv{0} . 687_flt{0}.csv'.format(s)
  
  # pigz is a multi-threaded compression utility. 
  # You can use tar or zip instead
  zip = 'pigz -K 687_flt{0}.csv'.format(s)
  cmd = '( {0} && {1} ) &'.format(concat, zip)
  print cmd
  subprocess.call(cmd, shell=True)

