well-log-toolkit 0.1.121__py3-none-any.whl → 0.1.123__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- well_log_toolkit/well.py +115 -18
- {well_log_toolkit-0.1.121.dist-info → well_log_toolkit-0.1.123.dist-info}/METADATA +1 -1
- {well_log_toolkit-0.1.121.dist-info → well_log_toolkit-0.1.123.dist-info}/RECORD +5 -5
- {well_log_toolkit-0.1.121.dist-info → well_log_toolkit-0.1.123.dist-info}/WHEEL +0 -0
- {well_log_toolkit-0.1.121.dist-info → well_log_toolkit-0.1.123.dist-info}/top_level.txt +0 -0
well_log_toolkit/well.py
CHANGED
|
@@ -335,9 +335,18 @@ class Well:
|
|
|
335
335
|
# Mark source as modified
|
|
336
336
|
self._sources[source_name]['modified'] = True
|
|
337
337
|
|
|
338
|
-
def load_las(
|
|
338
|
+
def load_las(
|
|
339
|
+
self,
|
|
340
|
+
las: Union[LasFile, str, Path, list[Union[str, Path]]],
|
|
341
|
+
path: Optional[Union[str, Path]] = None,
|
|
342
|
+
sampled: bool = False,
|
|
343
|
+
resample_method: Optional[str] = None,
|
|
344
|
+
merge: bool = False,
|
|
345
|
+
combine: Optional[str] = None,
|
|
346
|
+
source_name: Optional[str] = None
|
|
347
|
+
) -> 'Well':
|
|
339
348
|
"""
|
|
340
|
-
Load LAS file into this well, organized by source.
|
|
349
|
+
Load LAS file(s) into this well, organized by source.
|
|
341
350
|
|
|
342
351
|
Properties are grouped by source (LAS file). The source name is derived
|
|
343
352
|
from the filename stem (without extension), sanitized for Python attribute
|
|
@@ -346,8 +355,12 @@ class Well:
|
|
|
346
355
|
|
|
347
356
|
Parameters
|
|
348
357
|
----------
|
|
349
|
-
las : Union[LasFile, str, Path]
|
|
350
|
-
Either a LasFile instance
|
|
358
|
+
las : Union[LasFile, str, Path, list[Union[str, Path]]]
|
|
359
|
+
Either a LasFile instance, path to LAS file, or list of LAS file paths.
|
|
360
|
+
When providing a list, filenames can be relative to the path parameter.
|
|
361
|
+
path : Union[str, Path], optional
|
|
362
|
+
Directory path to prepend to all filenames. Useful when loading multiple
|
|
363
|
+
files from the same directory. If None, filenames are used as-is.
|
|
351
364
|
sampled : bool, default False
|
|
352
365
|
If True, mark all properties from this source as 'sampled' type.
|
|
353
366
|
Use this for core plug data or other point measurements where
|
|
@@ -365,6 +378,15 @@ class Well:
|
|
|
365
378
|
properties into the existing source instead of overwriting it.
|
|
366
379
|
When merging with incompatible depth grids, resample_method must be specified.
|
|
367
380
|
If False (default), existing source is overwritten with warning.
|
|
381
|
+
combine : str, optional
|
|
382
|
+
When loading multiple files (list), combine them into a single source:
|
|
383
|
+
- None (default): Load files as separate sources, no combining
|
|
384
|
+
- 'match': Combine using match method (safest, errors on mismatch)
|
|
385
|
+
- 'resample': Combine using resample method (interpolates to first file)
|
|
386
|
+
- 'concat': Combine using concat method (merges all unique depths)
|
|
387
|
+
source_name : str, optional
|
|
388
|
+
Name for combined source when combine is specified. If not specified,
|
|
389
|
+
uses 'combined_match', 'combined_resample', or 'combined_concat'
|
|
368
390
|
|
|
369
391
|
Returns
|
|
370
392
|
-------
|
|
@@ -381,28 +403,103 @@ class Well:
|
|
|
381
403
|
|
|
382
404
|
Examples
|
|
383
405
|
--------
|
|
384
|
-
>>>
|
|
406
|
+
>>> # Load single file
|
|
385
407
|
>>> well.load_las("36_7-5_B_CorePor.las") # Source name: "CorePor"
|
|
386
|
-
|
|
387
|
-
>>>
|
|
408
|
+
|
|
409
|
+
>>> # Load multiple files as separate sources
|
|
410
|
+
>>> well.load_las(["file1.las", "file2.las", "file3.las"])
|
|
411
|
+
>>> print(well.sources) # ['file1', 'file2', 'file3']
|
|
412
|
+
|
|
413
|
+
>>> # Load and combine multiple files
|
|
414
|
+
>>> well.load_las(
|
|
415
|
+
... ["file1.las", "file2.las", "file3.las"],
|
|
416
|
+
... combine="match",
|
|
417
|
+
... source_name="CombinedLogs"
|
|
418
|
+
... )
|
|
419
|
+
>>> print(well.sources) # ['CombinedLogs']
|
|
420
|
+
|
|
388
421
|
>>> # Load core plug data as sampled
|
|
389
422
|
>>> well.load_las("36_7-5_B_Core.las", sampled=True)
|
|
390
|
-
|
|
391
|
-
>>>
|
|
392
|
-
>>>
|
|
423
|
+
|
|
424
|
+
>>> # Load with resample combining
|
|
425
|
+
>>> well.load_las(
|
|
426
|
+
... ["log1.las", "log2.las"],
|
|
427
|
+
... combine="resample",
|
|
428
|
+
... source_name="CombinedLogs"
|
|
429
|
+
... )
|
|
430
|
+
|
|
431
|
+
>>> # Merge into existing source (legacy behavior)
|
|
393
432
|
>>> well.load_las("CorePor.las") # Load initial properties
|
|
394
|
-
>>> well.load_las("CorePor_Extra.las", merge=True) # Merge new properties
|
|
395
|
-
|
|
396
|
-
>>>
|
|
397
|
-
>>> well.
|
|
398
|
-
|
|
399
|
-
|
|
433
|
+
>>> well.load_las("CorePor_Extra.las", merge=True) # Merge new properties
|
|
434
|
+
|
|
435
|
+
>>> # Load multiple files from same directory
|
|
436
|
+
>>> well.load_las(
|
|
437
|
+
... ["file1.las", "file2.las", "file3.las"],
|
|
438
|
+
... path="data/well_logs",
|
|
439
|
+
... combine="match",
|
|
440
|
+
... source_name="AllLogs"
|
|
441
|
+
... )
|
|
442
|
+
>>> # Loads: data/well_logs/file1.las, data/well_logs/file2.las, etc.
|
|
443
|
+
|
|
444
|
+
>>> # Mix of relative and absolute paths
|
|
445
|
+
>>> well.load_las(
|
|
446
|
+
... ["log1.las", "log2.las"],
|
|
447
|
+
... path="/absolute/path/to/logs"
|
|
448
|
+
... )
|
|
400
449
|
"""
|
|
450
|
+
# Handle list of files
|
|
451
|
+
if isinstance(las, list):
|
|
452
|
+
# Prepend path to all filenames if provided
|
|
453
|
+
if path is not None:
|
|
454
|
+
base_path = Path(path)
|
|
455
|
+
las_files = [base_path / las_file for las_file in las]
|
|
456
|
+
else:
|
|
457
|
+
las_files = las
|
|
458
|
+
|
|
459
|
+
# Load all files as separate sources
|
|
460
|
+
loaded_sources = []
|
|
461
|
+
for las_file in las_files:
|
|
462
|
+
# Recursively call load_las for each file (without merge or combine, path already prepended)
|
|
463
|
+
self.load_las(las_file, path=None, sampled=sampled, resample_method=resample_method, merge=False, combine=None)
|
|
464
|
+
# Get the source name that was just created
|
|
465
|
+
loaded_sources.append(self.sources[-1])
|
|
466
|
+
|
|
467
|
+
# Combine if requested
|
|
468
|
+
if combine in {'match', 'resample', 'concat'}:
|
|
469
|
+
# Determine combined source name
|
|
470
|
+
combined_source_name = source_name or f'combined_{combine}'
|
|
471
|
+
|
|
472
|
+
# Merge all loaded sources
|
|
473
|
+
self.merge(
|
|
474
|
+
method=combine,
|
|
475
|
+
sources=loaded_sources,
|
|
476
|
+
source_name=combined_source_name
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
# Remove original sources
|
|
480
|
+
self.remove_source(loaded_sources)
|
|
481
|
+
|
|
482
|
+
return self
|
|
483
|
+
|
|
484
|
+
# Single file logic below
|
|
485
|
+
# Validate combine parameter for single file
|
|
486
|
+
if combine is not None:
|
|
487
|
+
raise ValueError(
|
|
488
|
+
f"combine='{combine}' is only valid when loading multiple files (list). "
|
|
489
|
+
f"For single file loading, use merge=True to merge into existing source."
|
|
490
|
+
)
|
|
491
|
+
|
|
401
492
|
# Parse if path provided
|
|
402
493
|
filepath = None
|
|
403
494
|
if isinstance(las, (str, Path)):
|
|
404
|
-
|
|
405
|
-
|
|
495
|
+
# Prepend path if provided
|
|
496
|
+
if path is not None:
|
|
497
|
+
las_path = Path(path) / las
|
|
498
|
+
else:
|
|
499
|
+
las_path = Path(las)
|
|
500
|
+
|
|
501
|
+
filepath = las_path
|
|
502
|
+
las = LasFile(las_path)
|
|
406
503
|
elif hasattr(las, 'filepath') and las.filepath:
|
|
407
504
|
filepath = Path(las.filepath)
|
|
408
505
|
|
|
@@ -8,8 +8,8 @@ well_log_toolkit/regression.py,sha256=7D3oI-1XVlFb-mOoHTxTTtUHERFyvQSBAzJzAGVoZn
|
|
|
8
8
|
well_log_toolkit/statistics.py,sha256=_huPMbv2H3o9ezunjEM94mJknX5wPK8V4nDv2lIZZRw,16814
|
|
9
9
|
well_log_toolkit/utils.py,sha256=O2KPq4htIoUlL74V2zKftdqqTjRfezU9M-568zPLme0,6866
|
|
10
10
|
well_log_toolkit/visualization.py,sha256=xb870FG5FghU2gEkqdn1b2NbWNu07oDmFDN1Cx1HIi0,157280
|
|
11
|
-
well_log_toolkit/well.py,sha256=
|
|
12
|
-
well_log_toolkit-0.1.
|
|
13
|
-
well_log_toolkit-0.1.
|
|
14
|
-
well_log_toolkit-0.1.
|
|
15
|
-
well_log_toolkit-0.1.
|
|
11
|
+
well_log_toolkit/well.py,sha256=kIN3Zr0sI3Zt3DeHbxDXADbQfWnVxXCQrHZ4UEMyeqI,103343
|
|
12
|
+
well_log_toolkit-0.1.123.dist-info/METADATA,sha256=gI89Dn-k1W6yy9ODs-5Roj1wiZ2GpMlc7deaBcpq3KA,59810
|
|
13
|
+
well_log_toolkit-0.1.123.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
well_log_toolkit-0.1.123.dist-info/top_level.txt,sha256=BMOo7OKLcZEnjo0wOLMclwzwTbYKYh31I8RGDOGSBdE,17
|
|
15
|
+
well_log_toolkit-0.1.123.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|