well-log-toolkit 0.1.137__tar.gz → 0.1.138__tar.gz

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.
Files changed (20) hide show
  1. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/PKG-INFO +1 -1
  2. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/pyproject.toml +1 -1
  3. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/manager.py +41 -19
  4. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/property.py +6 -0
  5. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit.egg-info/PKG-INFO +1 -1
  6. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/README.md +0 -0
  7. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/setup.cfg +0 -0
  8. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/__init__.py +0 -0
  9. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/exceptions.py +0 -0
  10. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/las_file.py +0 -0
  11. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/operations.py +0 -0
  12. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/regression.py +0 -0
  13. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/statistics.py +0 -0
  14. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/utils.py +0 -0
  15. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/visualization.py +0 -0
  16. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit/well.py +0 -0
  17. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit.egg-info/SOURCES.txt +0 -0
  18. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit.egg-info/dependency_links.txt +0 -0
  19. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit.egg-info/requires.txt +0 -0
  20. {well_log_toolkit-0.1.137 → well_log_toolkit-0.1.138}/well_log_toolkit.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: well-log-toolkit
3
- Version: 0.1.137
3
+ Version: 0.1.138
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "well-log-toolkit"
7
- version = "0.1.137"
7
+ version = "0.1.138"
8
8
  description = "Fast LAS file processing with lazy loading and filtering for well log analysis"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -384,11 +384,18 @@ class _ManagerPropertyProxy:
384
384
 
385
385
  @labels.setter
386
386
  def labels(self, value: dict):
387
- """Set labels for this property in all wells."""
387
+ """Set labels for this property in all wells.
388
+
389
+ Also sets property type to 'discrete' if not already set,
390
+ since labels are only meaningful for discrete properties.
391
+ """
388
392
  count = 0
389
393
  for well_name, well in self._manager._wells.items():
390
394
  try:
391
395
  prop = well.get_property(self._property_name)
396
+ # Auto-set type to discrete if labels are being set
397
+ if prop.type != 'discrete':
398
+ prop.type = 'discrete'
392
399
  prop.labels = value
393
400
  count += 1
394
401
  except (AttributeError, PropertyNotFoundError):
@@ -2481,37 +2488,52 @@ class WellDataManager:
2481
2488
  if well.name in self._name_mapping:
2482
2489
  del self._name_mapping[well.name]
2483
2490
 
2491
+ def add_template(self, template: 'Template') -> None:
2492
+ """
2493
+ Store a template using its built-in name.
2494
+
2495
+ Parameters
2496
+ ----------
2497
+ template : Template
2498
+ Template object (uses template.name as the key)
2499
+
2500
+ Examples
2501
+ --------
2502
+ >>> from well_log_toolkit import Template
2503
+ >>>
2504
+ >>> template = Template("reservoir")
2505
+ >>> template.add_track(track_type="continuous", logs=[...])
2506
+ >>> manager.add_template(template) # Stored as "reservoir"
2507
+ >>>
2508
+ >>> # Use in WellView
2509
+ >>> view = well.WellView(template="reservoir")
2510
+ """
2511
+ from .visualization import Template
2512
+
2513
+ if not isinstance(template, Template):
2514
+ raise TypeError(f"template must be Template, got {type(template).__name__}")
2515
+
2516
+ self._templates[template.name] = template
2517
+
2484
2518
  def set_template(self, name: str, template: Union['Template', dict]) -> None:
2485
2519
  """
2486
- Store a display template in the manager.
2520
+ Store a template with a custom name (overrides template.name).
2487
2521
 
2488
- Templates can be referenced by name when creating WellView displays.
2522
+ Use add_template() for the simpler case where the template's
2523
+ built-in name should be used.
2489
2524
 
2490
2525
  Parameters
2491
2526
  ----------
2492
2527
  name : str
2493
- Template name for reference
2528
+ Template name for reference (overrides template.name)
2494
2529
  template : Union[Template, dict]
2495
2530
  Template object or dictionary configuration
2496
2531
 
2497
2532
  Examples
2498
2533
  --------
2499
- >>> from well_log_toolkit.visualization import Template
2500
- >>>
2501
- >>> # Create and store template
2534
+ >>> # Store with a different name than the template's built-in name
2502
2535
  >>> template = Template("reservoir")
2503
- >>> template.add_track(
2504
- ... track_type="continuous",
2505
- ... logs=[{"name": "GR", "x_range": [0, 150], "color": "green"}]
2506
- ... )
2507
- >>> manager.set_template("reservoir", template)
2508
- >>>
2509
- >>> # Use template in WellView
2510
- >>> from well_log_toolkit.visualization import WellView
2511
- >>> view = manager.well_36_7_5_A.WellView(
2512
- ... depth_range=[2800, 3000],
2513
- ... template="reservoir"
2514
- ... )
2536
+ >>> manager.set_template("reservoir_v2", template)
2515
2537
  """
2516
2538
  from .visualization import Template
2517
2539
 
@@ -357,12 +357,18 @@ class Property(PropertyOperationsMixin):
357
357
  """
358
358
  Set the label mapping and mark source as modified.
359
359
 
360
+ Also sets property type to 'discrete' if not already set,
361
+ since labels are only meaningful for discrete properties.
362
+
360
363
  Parameters
361
364
  ----------
362
365
  value : Optional[dict[int, str]]
363
366
  Mapping of numeric values to label strings
364
367
  """
365
368
  if value != self._labels:
369
+ # Auto-set type to discrete if labels are being set
370
+ if value is not None and self._type != 'discrete':
371
+ self.type = 'discrete' # Use setter to trigger value rounding
366
372
  self._labels = value
367
373
  self._mark_source_modified()
368
374
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: well-log-toolkit
3
- Version: 0.1.137
3
+ Version: 0.1.138
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