tidy script

This commit is contained in:
Ed Chalstrey 2022-03-18 11:08:33 +00:00
parent 3653e30362
commit dfe48da577

View File

@ -14,27 +14,11 @@ csv.field_size_limit(sys.maxsize)
def main(mastermap_path): def main(mastermap_path):
mm_paths = sorted(glob.glob(os.path.join(mastermap_path, "*.gml.csv"))) mm_paths = sorted(glob.glob(os.path.join(mastermap_path, "*.gml.csv")))
# toid_paths = sorted(glob.glob(os.path.join(ab_path, "ab_toids_*.txt")))
# try:
# assert len(mm_paths) == len(toid_paths)
# except AssertionError:
# print(mm_paths)
# print(toid_paths)
# zipped_paths = zip(mm_paths, toid_paths)
# parallel map over tiles
# with Pool() as p:
# p.starmap(filter, zipped_paths)
for mm_path in mm_paths: for mm_path in mm_paths:
filter(mm_path) filter(mm_path)
def filter(mm_path):
# with open(toid_path, 'r') as fh:
# r = csv.reader(fh)
# toids = set(line[0] for line in r)
def filter(mm_path)
output_path = "{}.filtered.csv".format(str(mm_path).replace(".gml.csv", "")) output_path = "{}.filtered.csv".format(str(mm_path).replace(".gml.csv", ""))
alt_output_path = "{}.filtered_not_building.csv".format(str(mm_path).replace(".gml.csv", "")) alt_output_path = "{}.filtered_not_building.csv".format(str(mm_path).replace(".gml.csv", ""))
output_fieldnames = ('WKT', 'fid', 'descriptiveGroup') output_fieldnames = ('WKT', 'fid', 'descriptiveGroup')
@ -50,10 +34,6 @@ def filter(mm_path):
if 'Building' in line['descriptiveGroup']: if 'Building' in line['descriptiveGroup']:
w.writerow(line) w.writerow(line)
# elif line['fid'] in toids:
# alt_w.writerow(line)
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) != 2: if len(sys.argv) != 2: