import math from tqdm import tqdm from dbfread import DBF from model_data.utils import setup_logger logger = setup_logger() class BoreholeClient: """ Data dictionary: This description is based on the information presented in the following Geological articles: https://nora.nerc.ac.uk/id/eprint/509366/1/IR04115.pdf https://shop.bgs.ac.uk/Resources/Shop/doc/info/Borehole_Abbreviations.pdf?_ga=2.246788941.895115819.1686912089 -542796874.1686912089 https://core.ac.uk/download/63732.pdf QS - Borehole identifier information NUMB - Borehole identifier information BSUFF - Borehole identifier information REGNO RT - Borehole identifier information GRID_REFER EASTING - British National Grid coordinates NORTHING - British National Grid coordinates X - British National Grid coordinates - same as EASTING but has a float typing Y - British National Grid coordinates - same as NORTHING but has a float typing CONFIDENTI STRTHEIGHT NAME LENGTH BGS_ID DATE_KNOWN DATE_K_TYP DATE_ENTER AGS_LOG_UR """ def __init__(self, path): self.path: str = path self.data = None def read(self): logger.info("Reading in borehole data") table = DBF(self.path) borehole_data = [x for x in tqdm(table, total=len(table))] self.data = borehole_data @staticmethod def distance_between_bng_coords(x1_bng, y1_bng, x2_bng, y2_bng): # Calculate the Euclidean distance between the points distance_m = math.sqrt((x2_bng - x1_bng) ** 2 + (y2_bng - y1_bng) ** 2) distance_km = distance_m / 1000 # convert meters to kilometers return distance_m, distance_km