NormalizationModule

petrophys.preprocessing.normalization.NormalizationModule

Also available as petrophys.preprocessing.NormalizationModule

class NormalizationModule(method='linear')[source]

Log normalization for multi-well consistency.

This class provides methods for normalizing well logs to ensure consistency when comparing or combining data from multiple wells.

The linear normalization equation is: Norm = logmin + (logmax - logmin) * (Log - loglow) / (loghigh - loglow)

Parameters:

method (str, optional) – Normalization method. Only linear normalization is implemented (“linear”, or “percentile” for the same linear mapping between percentile anchors); other methods raise ValueError. Default: “linear”

Examples

>>> normalizer = NormalizationModule()
>>> normalized_gr = normalizer.normalize(
...     gr_curve,
...     log_min=0, log_max=150,
...     log_low=20, log_high=120
... )

Methods

calculate_shift

Calculate shift and scale to match reference.

normalize

Normalize log data to target range.

normalize_curve

Normalize a Curve object.

normalize_to_reference

Normalize curve using stored reference parameters.

set_reference

Set reference parameters for a curve type.

normalize(
data,
log_min,
log_max,
log_low=None,
log_high=None,
percentile_low=5,
percentile_high=95,
)[source]

Normalize log data to target range.

Parameters:
  • data (np.ndarray or Curve) – Log data to normalize

  • log_min (float) – Target minimum value

  • log_max (float) – Target maximum value

  • log_low (float, optional) – Source minimum (auto-detect if not provided)

  • log_high (float, optional) – Source maximum (auto-detect if not provided)

  • percentile_low (float, optional) – Percentile for auto-detecting low (default: 5)

  • percentile_high (float, optional) – Percentile for auto-detecting high (default: 95)

Returns:

Normalized log data

Return type:

np.ndarray

normalize_curve(
curve,
log_min,
log_max,
log_low=None,
log_high=None,
)[source]

Normalize a Curve object.

Parameters:
  • curve (Curve) – Curve to normalize

  • log_min (float) – Target minimum

  • log_max (float) – Target maximum

  • log_low (float, optional) – Source minimum

  • log_high (float, optional) – Source maximum

Returns:

Normalized curve

Return type:

Curve

set_reference(mnemonic, log_min, log_max, log_low, log_high)[source]

Set reference parameters for a curve type.

Parameters:
  • mnemonic (str) – Curve mnemonic

  • log_min (float) – Target range

  • log_max (float) – Target range

  • log_low (float) – Reference source range

  • log_high (float) – Reference source range

normalize_to_reference(curve)[source]

Normalize curve using stored reference parameters.

Parameters:

curve (Curve) – Curve to normalize

Returns:

Normalized curve

Return type:

Curve

Raises:

KeyError – If no reference is set for this curve type

calculate_shift(data, reference_data)[source]

Calculate shift and scale to match reference.

Parameters:
  • data (np.ndarray) – Data to shift

  • reference_data (np.ndarray) – Reference data to match

Returns:

(shift, scale) values

Return type:

tuple