示例#1
0
def test_read():
    cpt = CPT()
    cpt.read("./tests/testdata/in/cpt.gef")

    assert (cpt.name == "DKM-227")
    assert (cpt.x == 139081.7)
    assert (cpt.y == 446328.1)
    assert (cpt.z_top == 0.73)
    assert (cpt.z_min == -14.48)
示例#2
0
def test_filter():
    cpt = CPT()
    cpt.read("./tests/testdata/in/cpt.gef")

    layers = cpt.filter(0.2)
    assert (layers.shape == (76, 6))

    layers = cpt.filter(0.1)
    assert (layers.shape == (153, 6))
示例#3
0
def test_pre_excavated_depth():
    cpt = CPT()
    cpt.read("./tests/testdata/in/cpt_preexcavated_depth.gef")
    assert cpt.pre_excavated_depth == 2.0
示例#4
0
def test_plot():
    cpt = CPT()
    cpt.read("./tests/testdata/in/cpt.gef")
    cpt.convert()
    cpt.plot(filepath="./tests/testdata/out")
示例#5
0
from geoprofielen.objects.cpt import CPT, ConversionType
from geoprofielen.objects.borehole import Borehole

MAX_DIST = 20

if __name__ == "__main__":
    # first let's create a file with matches in x,y coords
    f = open(os.path.join(ROOT_DIR, "data/machinelearning/matches.csv"), 'w')
    sonderingen, boringen = [], []
    sfiles = case_insensitive_glob(os.path.join(ROOT_DIR, "data/sonderingen"),
                                   ".gef")
    bfiles = case_insensitive_glob(os.path.join(ROOT_DIR, "data/boringen"),
                                   ".gef")

    for sfile in tqdm(sfiles):
        cpt = CPT()
        cpt.read(sfile)
        sonderingen.append(cpt)

    for bfile in tqdm(bfiles):
        borehole = Borehole()
        borehole.read(bfile)

        for cpt in sonderingen:
            dx = cpt.x - borehole.x
            dy = cpt.y - borehole.y
            dl = math.sqrt(dx**2 + dy**2)
            if dl < MAX_DIST:
                f.write(
                    f"{dl},{cpt.filename},{cpt.x},{cpt.y},{borehole.filename},{borehole.x},{borehole.y}\n"
                )
示例#6
0
from helpers import case_insensitive_glob

boreholegefs = case_insensitive_glob(EXISTING_GEF_BOREHOLE_DIR, ".gef")
cptgefs = case_insensitive_glob(EXISTING_GEF_CPT_DIR, ".gef")

boreholes = []
cpts = []

print("Reading existing boreholes...")
for fborehole in tqdm(boreholegefs):
    borehole = Borehole.from_file(fborehole)
    boreholes.append(borehole)

print("Reading existing cpts...")
for fcpt in tqdm(cptgefs):
    cpt = CPT.from_file(fcpt)
    cpts.append(cpt)

# save some stuff for easy checks, might need more characteristics if double entries are found
# but if not this should be fine
cptcoords = [(c.x, c.y, c.z_top) for c in cpts]
boreholecoords = [(b.x, b.y, b.z_top) for b in boreholes]

# read new stuff
print("Checking for double entries...")
for f in tqdm(case_insensitive_glob(NEW_GEF_DIR, ".gef")):
    # is this a cpt or borehole? only one way to find out..
    iscpt, skip = True, False
    lines = open(f, 'r').readlines()
    for line in lines:
        if line.find('#REPORTCODE') > -1 and line.find('GEF-BORE') > -1:
示例#7
0
# achterhalen van alle gebruikte grondsoortnamen in de boringen
from pathlib import Path
from geoprofielen.helpers import case_insensitive_glob
from geoprofielen.objects.cpt import CPT, ConversionType
from tqdm import tqdm

if __name__ == "__main__":
    f = open("./data/sonderingen/cptcoords.csv", 'w')
    sfiles = case_insensitive_glob("./data/sonderingen", ".gef")

    for sfile in tqdm(sfiles):
        cpt = CPT()
        try:
            cpt.read(str(sfile))
            cpt.convert()
            cpt.plot(filepath="./data/sonderingen",
                     filename=f"{sfile.stem}.png")
            #cpt.convert(conversion_type=ConversionType.NEN_5104)
            #cpt.plot(filepath="./data/sonderingen", filename=f"{sfile.stem}_nen.png")
            f.write(f"{cpt.x},{cpt.y},{Path(cpt.filename).stem}\n")

        except Exception as e:
            print(f"Error reading {sfile} with error {e}.")

    f.close()