GrainSizeData

petrophys.interpretation.core_analysis.GrainSizeData

class GrainSizeData(depth, d50, d13=None, d87=None, metadata=<factory>)[source]

Grain size distribution measurements along a core depth.

Parameters:
  • depth (np.ndarray) – Measured depth (m or ft).

  • d50 (np.ndarray) – Median grain diameter P50 (µm).

  • d13 (np.ndarray, optional) – 13th percentile grain diameter (µm).

  • d87 (np.ndarray, optional) – 87th percentile grain diameter (µm).

  • metadata (dict) – Additional header information.

Examples

>>> gs = GrainSizeData.from_las("grain_size.las", d50_mnemonic="GS_P50")
>>> cls = gs.wentworth()           # per-sample class names
>>> k = gs.kozeny_carman_perm(porosity=0.25)  # mD estimate

Attributes

Methods

filter_by_depth

Return a new GrainSizeData filtered to [top, bottom].

from_dataframe

Create GrainSizeData from a pandas DataFrame.

from_las

Load grain size data from a LAS file.

kozeny_carman_perm

Estimate permeability using the Kozeny-Carman equation.

phi_scale

Convert d50 to phi units (φ = -log₂(d_mm)).

pore_throat_radius

Estimate pore throat radius from median grain size.

skewness

Grain size skewness from percentiles.

sorting_coefficient

Sorting as half the spread between the 13th and 87th percentiles, in phi.

to_dataframe

Export to a pandas DataFrame.

wentworth

Return the Wentworth class name for each depth sample.

depth: ndarray
d50: ndarray
d13: ndarray | None = None
d87: ndarray | None = None
metadata: Dict[str, Any]
property n_samples: int
property top: float | None
property bottom: float | None
classmethod from_las(
filepath,
d50_mnemonic='GS_P50',
d13_mnemonic='GS_P13',
d87_mnemonic='GS_P87',
null_value=-999.25,
)[source]

Load grain size data from a LAS file.

Depth is read via lasio’s las.index property (always the first column, regardless of mnemonic name).

Parameters:
  • filepath (str or Path)

  • d50_mnemonic (str) – Mnemonic for the P50 (median) grain size curve.

  • d13_mnemonic (str, optional) – Mnemonic for the P13 grain size curve.

  • d87_mnemonic (str, optional) – Mnemonic for the P87 grain size curve.

  • null_value (float)

Return type:

GrainSizeData

classmethod from_dataframe(
df,
depth_col='DEPTH',
d50_col='D50',
d13_col=None,
d87_col=None,
)[source]

Create GrainSizeData from a pandas DataFrame.

Parameters:
Return type:

GrainSizeData

wentworth()[source]

Return the Wentworth class name for each depth sample.

Return type:

np.ndarray of str

phi_scale()[source]

Convert d50 to phi units (φ = -log₂(d_mm)).

Return type:

ndarray

sorting_coefficient()[source]

Sorting as half the spread between the 13th and 87th percentiles, in phi.

(phi13 - phi87) / 2. Folk and Ward’s (1957) inclusive graphic standard deviation needs phi5, phi16, phi84 and phi95, which these data do not carry; for a normal distribution in phi this spread is 1.126 standard deviations, so divide by 1.126 before comparing with Folk and Ward’s classes (sigma in phi): < 0.35 very well sorted, 0.35–0.50 well sorted, 0.50–0.71 moderately well sorted, 0.71–1.00 moderately sorted, 1.00–2.00 poorly sorted, 2.00–4.00 very poorly sorted, > 4.00 extremely poorly sorted.

Requires d13 and d87. Returns NaN where either is missing, with a warning when neither is loaded: other percentiles (P10/P90, P20/P80) do not substitute in these formulas.

Returns:

Sorting in phi units.

Return type:

np.ndarray

skewness()[source]

Grain size skewness from percentiles.

(phi13 + phi87 - 2 phi50) / (phi13 - phi87). Requires d13, d50 and d87; returns NaN, with a warning, when d13 or d87 is not loaded. Positive = fine-skewed (more fines), negative = coarse-skewed.

Return type:

ndarray

kozeny_carman_perm(porosity)[source]

Estimate permeability using the Kozeny-Carman equation.

\[k = \frac{d_{50}^2 \cdot \phi^3}{180 \cdot (1 - \phi)^2}\]

for packed spheres (Carman, 1937), with k in µm² when d₅₀ is in µm. In mD, with 1 µm² = 1013.25 mD:

\[k = 5.63 \cdot \frac{d_{50}^2 \cdot \phi^3}{(1 - \phi)^2}\]
Parameters:

porosity (float or np.ndarray) – Porosity as a fraction (0–1). Can be a scalar or a depth array matching self.depth.

Returns:

Estimated permeability (mD) for a clean pack of equal spheres; cementation, clay and poor sorting usually make real rock less permeable. NaN where porosity is outside (0, 1) or d50 is missing; a warning says which when no sample gives a value.

Return type:

np.ndarray

Notes

Conversion factor: 1 µm² = 1013.25 mD, so 1013.25 / 180 = 5.63.

pore_throat_radius()[source]

Estimate pore throat radius from median grain size.

Uses the rule of thumb r_pt ≈ d₅₀ / 10, one fifth of the grain radius, which lies between the throat radii of rhombohedral (0.155 R) and cubic (0.414 R) packings of equal spheres. It suits well-sorted, uncemented sands only; for cemented or poorly sorted material the actual r_pt will be significantly smaller.

Returns:

Estimated pore throat radius (µm).

Return type:

np.ndarray

filter_by_depth(top, bottom)[source]

Return a new GrainSizeData filtered to [top, bottom].

Parameters:
Return type:

GrainSizeData

to_dataframe()[source]

Export to a pandas DataFrame.

Return type:

DataFrame