-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMerge.py
executable file
·44 lines (30 loc) · 1.29 KB
/
Merge.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
===============================================================================
Co-ReSyF Research Application - SAR_Bathymetry
===============================================================================
===============================================================================
"""
import os
import argparse
########## Input arguments
parser = argparse.ArgumentParser(description='Co-ReSyF: Sar Bathymetry merging tool')
parser.add_argument('-i', '--input', nargs='+', help='List of Input text files...', required=True)
parser.add_argument('-o', '--output', help='Output file text file... ', required=True)
args = parser.parse_args()
files_list=args.input
output_file = open(args.output, 'w')
output_buffer = []
for i in range (0, len(files_list)):
input_file = open(files_list[i], 'r')
output_buffer.append(input_file.readline().replace(' ', ','))
input_file.close()
output_buffer.sort()
output_file.write("ID,Longitude,Latitude,CDO_mean,DIR_mean,Depth\n") #output_file.write("ID\tLongitude\tLatitude\tCDO_mean\tDIR_mean\tDepth\n")
for j in range (0, len(output_buffer)):
output_file.write(output_buffer[j])
output_file.close()
# Delete the input .txt files
for i in range (0, len(files_list)):
os.remove(files_list[i])