Set elevation to NaN if value is missing

master
Dan Howe 6 years ago
parent 2d2006b530
commit dd749ca0d9

@ -9,6 +9,7 @@ import shutil
import logging import logging
import warnings import warnings
import requests import requests
import numpy as np
import pandas as pd import pandas as pd
from tqdm import tqdm from tqdm import tqdm
from selenium import webdriver from selenium import webdriver
@ -299,7 +300,10 @@ def extract_definitions(input_dir, output_dir):
site_data = meta['Sites:'][0] site_data = meta['Sites:'][0]
lat = float(re.search(r'(?<=Lat:)\S+', site_data).group()) lat = float(re.search(r'(?<=Lat:)\S+', site_data).group())
lon = float(re.search(r'(?<=Long:)\S+', site_data).group()) lon = float(re.search(r'(?<=Long:)\S+', site_data).group())
elev = float(re.search(r'(?<=Elev:).+(?=m)', site_data).group()) try:
elev = float(re.search(r'(?<=Elev:).+(?=m)', site_data).group())
except AttributeError:
elev = np.nan
address = re.search(r'(?<=\d\.\d\.\d - ).+(?=\sLat)', address = re.search(r'(?<=\d\.\d\.\d - ).+(?=\sLat)',
site_data).group() site_data).group()
bore_id = re.search(r'^\S+', site_data).group() bore_id = re.search(r'^\S+', site_data).group()

Loading…
Cancel
Save