From c9cae9130ad604ec00f5233461e3e64b5dc4f566 Mon Sep 17 00:00:00 2001 From: nzkarit Date: Sun, 6 May 2018 19:04:15 +1200 Subject: [PATCH] Fix the issue where was only the one split file in the CSV generator stuff --- ADSB_Encoder.py | 7 +++---- generateAllICAO.py | 7 +++---- generateAllLat.py | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/ADSB_Encoder.py b/ADSB_Encoder.py index 41c149d..7e1e12a 100755 --- a/ADSB_Encoder.py +++ b/ADSB_Encoder.py @@ -168,15 +168,14 @@ def threadingCSV(csv): global cfg cfg = configparser.ConfigParser() cfg.read('config.cfg') - arguments = argParser() - arguments.csvfile = csv[0] - arguments.outputfilename = csv[1] + arguments.csvfile = csv['csv'] + arguments.outputfilename = csv['out'] global logger logging.config.fileConfig('logging.cfg') logger = logging.getLogger(__name__) logger.info('Starting ADSB Encoder threadingCSV entry point') - logger.debug('Being called with the following CSV file: %s' % (csv[0])) + logger.debug('Being called with the following CSV file: %s' % (arguments.csvfile)) logger.debug('The arguments: %s' % (arguments)) data = None if arguments.csvfile == '': diff --git a/generateAllICAO.py b/generateAllICAO.py index 1561d9a..0254b8d 100755 --- a/generateAllICAO.py +++ b/generateAllICAO.py @@ -12,7 +12,7 @@ def writeFile(directory, filename, filenameExtension, data, count): for row in data: output.writerow([row]) csvfile.close() - return "['%s', '%s-%s.iq8s'],"%(csvFilename, filename, count) + return "{'csv':'%s', 'out':'%s-%s.iq8s'},"%(csvFilename, filename, count) def main(): directory = 'generated' @@ -23,8 +23,7 @@ def main(): minICAO = 0x0 maxICAO = 0x3E8 - # If the number of planes is less than the split it doesn't work - splitNumber = 100 + splitNumber = 1000 try: os.stat(directory) @@ -63,7 +62,7 @@ def main(): k += 1 j = 0 files = files[:-1] - script.write('files = (%s)\n' % (files)) + script.write('files = [%s]\n' % (files)) script.write('for file in files:\n') script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n') script.write(' t.start()\n') diff --git a/generateAllLat.py b/generateAllLat.py index 94fcd21..7865e4c 100755 --- a/generateAllLat.py +++ b/generateAllLat.py @@ -12,7 +12,7 @@ def writeFile(directory, filename, filenameExtension, data, count): for row in data: output.writerow([row]) csvfile.close() - return "['%s', '%s-%s.iq8s'],"%(csvFilename, filename, count) + return "{'csv':'%s', 'out':'%s-%s.iq8s'},"%(csvFilename, filename, count) def main(): directory = 'generated' @@ -24,7 +24,7 @@ def main(): minLat = -90 maxLat = 90 # If the number of lat is less than the split it doesn't work - splitNumber = 100 + splitNumber = 1000 step = 0.1 try: @@ -64,7 +64,7 @@ def main(): k += 1 j = 0 files = files[:-1] - script.write('files = (%s)\n' % (files)) + script.write('files = [%s]\n' % (files)) script.write('for file in files:\n') script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n') script.write(' t.start()\n')