Handle NTBP flags in raw data.

This works by matching a regular expression against
the full path name (not just the file name). If it
matches, the NTBP flag is set to true.
This commit is contained in:
D. Berge
2020-08-31 13:04:46 +02:00
parent c32c408d12
commit 5363ce8bab
3 changed files with 20 additions and 6 deletions

View File

@@ -40,6 +40,9 @@ if __name__ == '__main__':
pattern = raw_p111["pattern"]
rx = re.compile(pattern["regex"])
if "ntbp" in survey["raw"]:
ntbpRx = re.compile(survey["raw"]["ntbp"])
for fileprefix in raw_p111["paths"]:
print(f"Path prefix: {fileprefix}")
@@ -59,6 +62,10 @@ if __name__ == '__main__':
continue
file_info = dict(zip(pattern["captures"], match.groups()))
if ntbpRx:
ntbp = ntbpRx.match(filepath) is not None
else:
ntbp = False
p111_data = p111.from_file(filepath)
@@ -66,7 +73,7 @@ if __name__ == '__main__':
p111_records = p111.p111_type("S", p111_data)
db.save_raw_p111(p111_records, file_info, filepath, survey["epsg"])
db.save_raw_p111(p111_records, file_info, filepath, survey["epsg"], ntbp=ntbp)
else:
print("Already in DB")