import csv


def file_to_position_depths(file_path):
    """Get the position and depths from one file. Read into memory as a dictionary with (lat, lon) as the key and depth
    as the value."""

    # create the dictionary
    result = {}

    # read the position and depth data from the input csv file
    with open(file_path) as csvfile:
        contents = csv.reader(csvfile)

        next(contents)

        count = 1

        # print progress
        for line in contents:
            if count % 100_000 == 0:
                print(count)

            count += 1

            # get the latitude, longitude and depth from the row in the file
            _, lat, long, depth = line
            lat_long = (float(lat), float(long))

            # if the depth is empty, then continue
            if depth == '':
                continue

            result[lat_long] = float(depth)

    return result