Skip to content

Commit 146ed27

Browse files
authored
Merge pull request #115 from MiraGeoscience/GEOPY-1800
GEOPY-1800
2 parents 508ea7b + cae27f4 commit 146ed27

8 files changed

Lines changed: 25 additions & 13 deletions

File tree

las_geoh5/export_las.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ def add_curve_data(file: LASFile, drillhole: Drillhole, group):
8282
file.append_curve(datum.name, datum.values)
8383

8484
if isinstance(datum, ReferencedData) and datum.value_map is not None:
85-
for k, v in datum.value_map().items(): # pylint: disable=invalid-name
85+
for name, value in datum.value_map().items():
8686
file.params.append(
8787
HeaderItem(
88-
mnemonic=f"{datum.name} ({k})", value=v, descr="REFERENCE"
88+
mnemonic=f"{datum.name} ({name})",
89+
value=value,
90+
descr="REFERENCE",
8991
)
9092
)
9193

@@ -164,8 +166,8 @@ def write_curves(
164166
subpath = basepath
165167

166168
filename = f"{drillhole.name}_{group.name}.las"
167-
with open(subpath / filename, "a", encoding="utf8") as io: # pylint: disable=invalid-name
168-
file.write(io)
169+
with open(subpath / filename, "a", encoding="utf8") as output:
170+
file.write(output)
169171

170172

171173
def write_survey(
@@ -195,8 +197,8 @@ def write_survey(
195197
basepath.mkdir()
196198

197199
filename = f"{drillhole.name}_survey.las"
198-
with open(basepath / filename, "a", encoding="utf8") as io: # pylint: disable=invalid-name
199-
file.write(io)
200+
with open(basepath / filename, "a", encoding="utf8") as output:
201+
file.write(output)
200202

201203

202204
def drillhole_to_las(

las_geoh5/import_directories/uijson.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
from geoh5py.ui_json.constants import default_ui_json
1414

1515

16+
# pylint: disable=duplicate-code
17+
1618
ui_json = dict(
1719
deepcopy(default_ui_json),
1820
**{

las_geoh5/import_files/uijson.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from geoh5py.ui_json.constants import default_ui_json
1414

1515

16-
# pylint: disable=duplicate-code
17-
1816
ui_json = dict(
1917
deepcopy(default_ui_json),
2018
**{

las_geoh5/import_las.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def create_or_append_drillhole(
324324
)
325325

326326
collar = get_collar(lasfile, translator, logger)
327-
drillhole = drillhole_group.get_entity(name)[0] # type: ignore
327+
drillhole = drillhole_group.get_entity(name)[0]
328328

329329
if not isinstance(drillhole, Drillhole):
330330
name = find_copy_name(drillhole_group.workspace, name)

las_geoh5/scripts/las_to_geoh5.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
from las_geoh5.import_files import driver
1717

1818

19+
# pylint: disable=duplicate-code
20+
1921
_logger = logging.getLogger(__package__ + "." + Path(__file__).stem)
2022

2123

las_geoh5/uijson/write_uijson.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def main(args):
6363
"import_files",
6464
"import_directories",
6565
"export_files",
66-
]: # pylint: disable=invalid-name
66+
]:
6767
write_uijson(args.path, mode)
6868
else:
6969
write_uijson(args.path, args.mode)

tests/geoh5_to_las_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def test_collocation_tolerance(tmp_path: Path):
348348

349349
dh1 = add_data(dh1, lasfile, group_name, collocation_tolerance=0.1)
350350

351+
assert dh1.property_groups is not None
351352
assert dh1.property_groups[0].name == group_name
352353

353354
lasfile = lasio.LASFile()
@@ -356,6 +357,7 @@ def test_collocation_tolerance(tmp_path: Path):
356357

357358
dh1 = add_data(dh1, lasfile, group_name, collocation_tolerance=0.01)
358359

360+
assert dh1.property_groups is not None
359361
assert len(dh1.property_groups) == 2
360362
assert all(
361363
k.name in ["my_property_group", "my_property_group (1)"]

tests/import_las_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ def test_add_data_increments_property_group(tmp_path: Path):
324324

325325
drillhole = add_data(drillhole, file, "my group")
326326

327+
assert drillhole.property_groups is not None
327328
assert len(drillhole.property_groups) == 2
328329
assert [k.name in ["my group", "my group (1)"] for k in drillhole.property_groups]
329330

@@ -334,11 +335,12 @@ def test_add_data_increments_property_group(tmp_path: Path):
334335

335336
drillhole = add_data(drillhole, file, "my group")
336337

338+
assert drillhole.property_groups is not None
337339
assert len(drillhole.property_groups) == 3
338-
assert [
340+
assert all(
339341
k.name in ["my group", "my group (1)", "my group (2)"]
340342
for k in drillhole.property_groups
341-
]
343+
)
342344

343345

344346
def test_add_data_increments_data_name(tmp_path: Path):
@@ -362,8 +364,11 @@ def test_add_data_increments_data_name(tmp_path: Path):
362364

363365
drillhole = add_data(drillhole, file, "my group")
364366

367+
assert drillhole.property_groups is not None
365368
assert len(drillhole.property_groups) == 2
366-
assert [k.name in ["my group", "my group (1)"] for k in drillhole.property_groups]
369+
assert all(
370+
k.name in ["my group", "my group (1)"] for k in drillhole.property_groups
371+
)
367372
assert all(
368373
k in [c.name for c in drillhole.children] for k in ["my data", "my data (1)"]
369374
)
@@ -375,6 +380,7 @@ def test_add_data_increments_data_name(tmp_path: Path):
375380

376381
drillhole = add_data(drillhole, file, "my group")
377382

383+
assert drillhole.property_groups is not None
378384
assert len(drillhole.property_groups) == 3
379385
assert [
380386
k.name in ["my group", "my group (1)", "my group (2)"]

0 commit comments

Comments
 (0)