Skip to content

Commit

Permalink
Merge pull request #64 from MiraGeoscience/GEOPY-1753
Browse files Browse the repository at this point in the history
GEOPY-1753: LAS importer - vertical colocation
  • Loading branch information
domfournier authored Oct 23, 2024
2 parents b78bb73 + ed923ba commit 19a1ed5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
5 changes: 1 addition & 4 deletions las_geoh5/import_las.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,7 @@ def create_or_append_drillhole(
collar = get_collar(lasfile, translator, logger)
drillhole = drillhole_group.get_entity(name)[0] # type: ignore

if not isinstance(drillhole, Drillhole) or (
isinstance(drillhole, Drillhole)
and not np.allclose(collar, drillhole.collar.tolist())
):
if not isinstance(drillhole, Drillhole):
name = find_copy_name(drillhole_group.workspace, name)
kwargs = {
"name": name,
Expand Down
11 changes: 0 additions & 11 deletions tests/geoh5_to_las_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,6 @@ def test_create_or_append_drillhole(tmp_path: Path):
Path(tmp_path / f"dh1_{drillhole_a.property_groups[0].name}.las"),
mnemonic_case="preserve",
)
file.well["X"] = 10.0
drillhole = create_or_append_drillhole(
file,
drillhole_group,
"test",
translator=LASTranslator(NameOptions()),
)

# New data should be placed in a new drillhole object with augmented name
assert drillhole.uid != drillhole_a.uid
assert drillhole.name == "dh1 (1)"

file.well["WELL"] = "dh2"
drillhole = create_or_append_drillhole(
Expand Down
18 changes: 17 additions & 1 deletion tests/import_las_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_import_las_new_drillholes(tmp_path: Path):
assert dh1.collar["y"] == 0.0
assert dh1.collar["z"] == 10.0
assert dh1.surveys.shape == (2, 3)
assert dh1.surveys[1, 0] == 10.0
assert np.allclose(dh1.surveys, np.array([[0, 0, -90], [10, 0, -90]]))
assert dh1.end_of_hole == 10.0
assert dh1.parent.uid == dh_group.uid
assert all(dh1.get_data("my_property")[0].values == 0.0)
Expand Down Expand Up @@ -447,3 +447,19 @@ def test_handle_numeric_well_name(tmp_path: Path):
with workspace.open():
dh_group = workspace.get_entity("dh_group")[0]
assert "123" in [k.name for k in dh_group.children]


def test_existing_drillhole_new_collar_location(tmp_path):
ws = Workspace.create(tmp_path / "test.geoh5")
dh_group = DrillholeGroup.create(ws, name="dh_group")
dh = Drillhole.create(ws, name="dh", parent=dh_group, collar=[0, 0, 0])
lasfile = generate_lasfile(
well="dh",
collar={"X": 0.0, "Y": 0.0, "ELEV": 10.0},
depths=np.arange(0, 11, 1),
properties={"my_property": np.zeros(11)},
)
lasfile = lasio.read(write_lasfile(tmp_path, lasfile))
dh_compare = create_or_append_drillhole(lasfile, dh_group, "test")

assert dh.uid == dh_compare.uid

0 comments on commit 19a1ed5

Please sign in to comment.