well-log-toolkit 0.1.121__py3-none-any.whl → 0.1.122__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 CHANGED
@@ -335,9 +335,17 @@ class Well:
335
335
  # Mark source as modified
336
336
  self._sources[source_name]['modified'] = True
337
337
 
338
- def load_las(self, las: Union[LasFile, str, Path], sampled: bool = False, resample_method: Optional[str] = None, merge: bool = False) -> 'Well':
338
+ def load_las(
339
+ self,
340
+ las: Union[LasFile, str, Path, list[Union[str, Path]]],
341
+ sampled: bool = False,
342
+ resample_method: Optional[str] = None,
343
+ merge: bool = False,
344
+ combine: Optional[str] = None,
345
+ source_name: Optional[str] = None
346
+ ) -> 'Well':
339
347
  """
340
- Load LAS file into this well, organized by source.
348
+ Load LAS file(s) into this well, organized by source.
341
349
 
342
350
  Properties are grouped by source (LAS file). The source name is derived
343
351
  from the filename stem (without extension), sanitized for Python attribute
@@ -346,8 +354,8 @@ class Well:
346
354
 
347
355
  Parameters
348
356
  ----------
349
- las : Union[LasFile, str, Path]
350
- Either a LasFile instance or path to LAS file
357
+ las : Union[LasFile, str, Path, list[Union[str, Path]]]
358
+ Either a LasFile instance, path to LAS file, or list of LAS file paths
351
359
  sampled : bool, default False
352
360
  If True, mark all properties from this source as 'sampled' type.
353
361
  Use this for core plug data or other point measurements where
@@ -365,6 +373,15 @@ class Well:
365
373
  properties into the existing source instead of overwriting it.
366
374
  When merging with incompatible depth grids, resample_method must be specified.
367
375
  If False (default), existing source is overwritten with warning.
376
+ combine : str, optional
377
+ When loading multiple files (list), combine them into a single source:
378
+ - None (default): Load files as separate sources, no combining
379
+ - 'match': Combine using match method (safest, errors on mismatch)
380
+ - 'resample': Combine using resample method (interpolates to first file)
381
+ - 'concat': Combine using concat method (merges all unique depths)
382
+ source_name : str, optional
383
+ Name for combined source when combine is specified. If not specified,
384
+ uses 'combined_match', 'combined_resample', or 'combined_concat'
368
385
 
369
386
  Returns
370
387
  -------
@@ -381,23 +398,70 @@ class Well:
381
398
 
382
399
  Examples
383
400
  --------
384
- >>> well = manager.well_36_7_5_B
401
+ >>> # Load single file
385
402
  >>> well.load_las("36_7-5_B_CorePor.las") # Source name: "CorePor"
386
- >>> well.load_las("36_7-5_B_Log.las") # Source name: "Log"
387
- >>> well.load_las("formation_tops.las") # Source name: "formation_tops"
403
+
404
+ >>> # Load multiple files as separate sources
405
+ >>> well.load_las(["file1.las", "file2.las", "file3.las"])
406
+ >>> print(well.sources) # ['file1', 'file2', 'file3']
407
+
408
+ >>> # Load and combine multiple files
409
+ >>> well.load_las(
410
+ ... ["file1.las", "file2.las", "file3.las"],
411
+ ... combine="match",
412
+ ... source_name="CombinedLogs"
413
+ ... )
414
+ >>> print(well.sources) # ['CombinedLogs']
415
+
388
416
  >>> # Load core plug data as sampled
389
417
  >>> well.load_las("36_7-5_B_Core.las", sampled=True)
390
- >>> # Load data with incompatible depths
391
- >>> well.load_las("interpreted.las", resample_method='linear')
392
- >>> # Merge additional properties into existing source
418
+
419
+ >>> # Load with resample combining
420
+ >>> well.load_las(
421
+ ... ["log1.las", "log2.las"],
422
+ ... combine="resample",
423
+ ... source_name="CombinedLogs"
424
+ ... )
425
+
426
+ >>> # Merge into existing source (legacy behavior)
393
427
  >>> well.load_las("CorePor.las") # Load initial properties
394
- >>> well.load_las("CorePor_Extra.las", merge=True) # Merge new properties into "CorePor"
395
- >>> # Access by source
396
- >>> well.CorePor.PHIE
397
- >>> well.Log.GR
398
- >>> # Access directly if unique
399
- >>> well.PHIE # Error if both CorePor and Log have PHIE
428
+ >>> well.load_las("CorePor_Extra.las", merge=True) # Merge new properties
400
429
  """
430
+ # Handle list of files
431
+ if isinstance(las, list):
432
+ # Load all files as separate sources
433
+ loaded_sources = []
434
+ for las_file in las:
435
+ # Recursively call load_las for each file (without merge or combine)
436
+ self.load_las(las_file, sampled=sampled, resample_method=resample_method, merge=False, combine=None)
437
+ # Get the source name that was just created
438
+ loaded_sources.append(self.sources[-1])
439
+
440
+ # Combine if requested
441
+ if combine in {'match', 'resample', 'concat'}:
442
+ # Determine combined source name
443
+ combined_source_name = source_name or f'combined_{combine}'
444
+
445
+ # Merge all loaded sources
446
+ self.merge(
447
+ method=combine,
448
+ sources=loaded_sources,
449
+ source_name=combined_source_name
450
+ )
451
+
452
+ # Remove original sources
453
+ self.remove_source(loaded_sources)
454
+
455
+ return self
456
+
457
+ # Single file logic below
458
+ # Validate combine parameter for single file
459
+ if combine is not None:
460
+ raise ValueError(
461
+ f"combine='{combine}' is only valid when loading multiple files (list). "
462
+ f"For single file loading, use merge=True to merge into existing source."
463
+ )
464
+
401
465
  # Parse if path provided
402
466
  filepath = None
403
467
  if isinstance(las, (str, Path)):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: well-log-toolkit
3
- Version: 0.1.121
3
+ Version: 0.1.122
4
4
  Summary: Fast LAS file processing with lazy loading and filtering for well log analysis
5
5
  Author-email: Kristian dF Kollsgård <kkollsg@gmail.com>
6
6
  License: MIT
@@ -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=xPTdVuhlctjinHaFrmLWImAC5JUchXQs9jTazZzdlnU,99609
12
- well_log_toolkit-0.1.121.dist-info/METADATA,sha256=qXxUw5-wiWwTDjeulBwpuZ2vCuwW0X5r22cL1XOi3e4,59810
13
- well_log_toolkit-0.1.121.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
- well_log_toolkit-0.1.121.dist-info/top_level.txt,sha256=BMOo7OKLcZEnjo0wOLMclwzwTbYKYh31I8RGDOGSBdE,17
15
- well_log_toolkit-0.1.121.dist-info/RECORD,,
11
+ well_log_toolkit/well.py,sha256=u2KhhMfXkMPIOKRgH3SB3k-2knotqWdBGY4Lup31Pxc,102017
12
+ well_log_toolkit-0.1.122.dist-info/METADATA,sha256=MxrNyJ2HeEdC6VUmRFSPdVT6te10N5Buy-iJLzwHEFY,59810
13
+ well_log_toolkit-0.1.122.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
14
+ well_log_toolkit-0.1.122.dist-info/top_level.txt,sha256=BMOo7OKLcZEnjo0wOLMclwzwTbYKYh31I8RGDOGSBdE,17
15
+ well_log_toolkit-0.1.122.dist-info/RECORD,,