Use raw strings for regular expressions

master
Dan Howe 6 years ago
parent a8f558079f
commit d07a3b4a6d

@ -265,7 +265,7 @@ def extract_records(input_dir, output_dir, clean_up=False):
for zip_name in tqdm(zip_names): for zip_name in tqdm(zip_names):
# Skip duplicate downloads # Skip duplicate downloads
if re.search('\([0-9]+\)', zip_name): if re.search(r'\([0-9]+\)', zip_name):
continue continue
# Rename '.part' file if zip was not correctly downloaded # Rename '.part' file if zip was not correctly downloaded
@ -285,11 +285,11 @@ def extract_records(input_dir, output_dir, clean_up=False):
# Get bore specifics # Get bore specifics
meta = df.iloc[1, -1] meta = df.iloc[1, -1]
lat = float(re.search('(?<=Lat:)\S+', meta).group()) lat = float(re.search(r'(?<=Lat:)\S+', meta).group())
lon = float(re.search('(?<=Long:)\S+', meta).group()) lon = float(re.search(r'(?<=Long:)\S+', meta).group())
elev = float(re.search('(?<=Elev:).+(?=m)', meta).group()) elev = float(re.search(r'(?<=Elev:).+(?=m)', meta).group())
address = re.search('(?<=\d\.\d\.\d - ).+(?=\sLat)', meta).group() address = re.search(r'(?<=\d\.\d\.\d - ).+(?=\sLat)', meta).group()
bore_id = re.search('^\S+', meta).group() bore_id = re.search(r'^\S+', meta).group()
site, hole, pipe = bore_id.split('.') site, hole, pipe = bore_id.split('.')
# FIXME: detect basin automatically # FIXME: detect basin automatically

Loading…
Cancel
Save