Data and depth¶
A Well holds one depth index, a set of
Curve objects, header values and any attached
geology. This page takes the bundled 30/6-5 well apart: 22,176 depth samples
0.152 m apart, from 176.6 m to 3556.1 m. The header values the interpretation
reads are the bottom-hole temperature (degC), the formation-water resistivity and
its temperature (degF), and the mud-filtrate resistivity:
import pandas as pd
import petrophys as pp
well = pp.read(pp.sample("30_6-5"))
well.describe()["header_parameters"]
{'BHT': 126.0, 'RW': 0.07, 'RWT': 230.0, 'RMF': 0.08, 'CLFL': 20366.0}
The well at a glance¶
To get |
Use |
|---|---|
Curve names |
|
One curve |
|
Depths and their unit |
|
Header values |
|
A depth window |
|
A table |
|
A new curve |
|
Files |
|
Curves, units and statistics¶
Every curve keeps the mnemonic, unit and values found in the file.
well.describe() lists them, with the fraction of depths each one covers:
pd.DataFrame(well.describe()["curves"])
| mnemonic | unit | description | valid_fraction | |
|---|---|---|---|---|
| 0 | LITHOLOGY_GEOLINK | _ | Lithology_geolink | 0.484 |
| 1 | CALI | in | CALI | 0.996 |
| 2 | DRHO | g/cm3 | DRHO | 0.786 |
| 3 | NPHI | m3/m3 | NPHI | 0.786 |
| 4 | RHOB | g/cm3 | RHOB | 1.000 |
| 5 | PEF | b/e | PEF | 0.116 |
| 6 | GR | gAPI | GR | 1.000 |
| 7 | DTC | us/ft | DTC | 0.996 |
| 8 | DTE | us/ft | DTE | 0.996 |
| 9 | RDEP | ohm.m | RDEP | 1.000 |
| 10 | SP | mV | SP | 1.000 |
| 11 | RSHA | ohm.m | RSHA | 0.996 |
| 12 | RMED | ohm.m | RMED | 1.000 |
| 13 | BS | in | BIT SIZE | 1.000 |
| 14 | PHIC | v/v | Core porosity | 0.009 |
| 15 | GDEN | g/c3 | Grain density | 0.009 |
| 16 | KH_CORE | mD | Horizontal permeability Klinkenberg-corrected | 0.009 |
| 17 | KV_CORE | mD | Vertical permeability Klinkenberg-corrected | 0.009 |
| 18 | SWC | frac | Core water saturation | 0.003 |
| 19 | SOC | frac | Core oil saturation | 0.002 |
Core samples (PHIC to SOC) fill 1% of depths or less. SWC and SOC say
frac but hold percentages; see Core saturation units.
One curve¶
A curve carries its data, its depths and its metadata.
well["GR"]
Curve(GR, unit=gAPI, samples=22176)
well["GR"].describe()
{'count': 22176,
'null_count': 0,
'min': -12.59262,
'max': 238.0,
'mean': 59.768001958423525,
'std': 29.75386649831589,
'median': 53.299405,
'p25': 38.781935000000004,
'p75': 72.44039}
The raw gamma ray reaches -12.6 API, a value no formation gives; pp.interpret
screens implausible values before it uses a curve (Implausible inputs and bad hole).
Arrays and tables¶
well.depth and curve.data are NumPy arrays of the same length, so any
plotting or numerical library can use them. depth_slice cuts a depth window
into a new well, and to_dataframe gives a table with one row per depth:
brent = well.depth_slice(2841, 2958) # the Brent Group, in metres
brent.to_dataframe(curves=["GR", "RHOB", "NPHI", "RDEP"]).head()
| DEPTH | GR | RHOB | NPHI | RDEP | |
|---|---|---|---|---|---|
| 0 | 2841.019 | 130.875 | 2.596 | 0.284 | 5.313 |
| 1 | 2841.172 | 105.750 | 2.601 | 0.273 | 5.004 |
| 2 | 2841.324 | 81.438 | 2.577 | 0.248 | 4.820 |
| 3 | 2841.477 | 65.375 | 2.535 | 0.222 | 4.969 |
| 4 | 2841.629 | 58.625 | 2.501 | 0.212 | 5.262 |
Add a curve¶
add_curve puts an array on the well’s depth index, for example a curve from
another source on the same depths. Here the effective porosity of an
interpretation goes back on the raw well:
result = pp.interpret(well, rw=0.07, rw_meas_temp="230 degF")
well.add_curve("PHIE", result.well["PHIE"].data, unit="v/v", description="Effective porosity")
well["PHIE"]
Curve(PHIE, unit=v/v, samples=22176)
The array must have one value per depth sample: an array of any other length is
refused with a ValueError that gives both lengths.
try:
well.add_curve("TOO_SHORT", result.well["PHIE"].data[:10])
except ValueError as error:
print(error)
Depth length (22176) must match data length (10)
pp.interpret adds its curves the same way, on a copy of the well.
run_dynamic_workflow() adds them to the well you pass.
Depth units and windows¶
Depths stay in the file’s unit. A CSV must declare it, since the file does not
record it. Convert values with UnitConverter.
from petrophys.model import UnitConverter
brent.top, brent.bottom, brent.depth_unit
(2841.01929, 2957.91016, 'm')
UnitConverter.depth(brent.depth[[0, -1]], "m", "ft")
array([9320.92942913, 9704.42965879])
Input |
Depth behaviour |
|---|---|
LAS, CSV, delimited ASCII |
Curves stay on the file’s depth samples |
Duplicate or reversing LAS depths |
A warning for review; nothing is corrected silently |
Formation, lithology and core tables |
Converted between metres and feet when their unit is declared; a different reference or datum is rejected |
DLIS with several frames |
Compatible channels are linearly resampled onto one grid: grid resampling, not depth matching |
DLIS image and spectra arrays |
Read by the specialist readers, not flattened into the well |
Independent arrays |
Resample explicitly with |
Log-depth matching |
Not performed: no tool-offset estimation, pass correlation or stretch-and-squeeze |
Readers¶
Input |
Reader |
What it builds |
|---|---|---|
LAS |
Scalar curves, header, parameters and the file’s depth index |
|
DLIS ( |
Compatible scalar channels from the selected frames, on one depth grid |
|
CSV, TSV |
One well from a wide table sharing a depth column |
|
Excel |
The same, from a sheet of a workbook |
|
Multiwell CSV |
One well per identifier in a long table |
|
Delimited ASCII |
A table with a chosen separator, header row, depth column and null value |
pp.read picks the reader from the file extension.
Curve names and units¶
Vendor mnemonics are recognized and supported units converted. The Teapot Dome
well 17-WX-21 is logged under its contractor’s mnemonics (GRD, CALD, ILD,
…) and units (G/C3, DEC, US/F):
from petrophys.preprocessing.standardization import standardize_curves
teapot = pp.read(pp.sample("teapot_17-wx-21"))
standard = standardize_curves(pp.read(pp.sample("teapot_17-wx-21")), rename_curves=True)
pd.DataFrame({"In the file": teapot.curves, "Unit": [teapot[name].unit for name in teapot.curves],
"Standard": standard.curves, "Standard unit": [standard[name].unit for name in standard.curves]})
| In the file | Unit | Standard | Standard unit | |
|---|---|---|---|---|
| 0 | GRD | GAPI | GR | API |
| 1 | NPHI | DEC | NPHI | v/v |
| 2 | CALD | IN | CALI | in |
| 3 | RHOB | G/C3 | RHOB | g/cm3 |
| 4 | DRHO | G/C3 | DRHO | g/cm3 |
| 5 | SPR | MV | SPR | MV |
| 6 | SFL | OHMM | RSHA | ohm.m |
| 7 | ILM | OHMM | RMED | ohm.m |
| 8 | ILD | OHMM | RDEP | ohm.m |
| 9 | TENR | LBS | TENR | LBS |
| 10 | DT | US/F | DTC | us/ft |
Unknown mnemonics and units are kept, never guessed. pp.interpret keeps
vendor names and adds the standard names beside them; set
rename_input_curves=True to rename instead.
Bundled samples¶
The package installs small public datasets: well logs, NMR, formation-pressure
tests and core measurements, with geology tables and input templates.
pp.list_samples(kind) lists one kind, or one collection such as "costa":
from petrophys.datasets import SAMPLE_KINDS
pd.Series({kind: pp.list_samples(kind) for kind in SAMPLE_KINDS})
logs [1046123714, 15_9-14, 16_7-1, 25_5-1, 30_6-5, HW-10, HW-24, HW-25, HW-26, HW-27, HW-28, HW-29, HW-3, HW-30, HW-31, HW-32, HW-4, HW-5, HW-6, HW-7, HW-8, HW-9, cheal-1, ede_01_composite, teapot_17-wx-21, teapot_44-mdx-10, tuhua-7]
nmr [daydream1_cmr, daydream1_cmr_shallow, phillips_cmr_log, phillips_gulfcoast_nmr, phillips_nmr_bins]
pressure [319-C0009A_MDT_059LTP, 319-C0009A_MDT_067LTP, 319-C0009A_MDT_078LTP, 35_11_10_mdt, 35_11_13_mdt, c0009a_mdt_059, c0009a_mdt_067, c0009a_mdt_078]
core [costa_core_pc, costa_thomeer_fits, epslog_ede_01_scanner, phillips_cmr_core]
geology [1046123714_formation_tops, formations_30_6-5, formations_cheal-1, formations_costa, formations_tuhua-7, lithology_30_6-5]
templates [formation_intervals_template, formation_tops_template, lithology_codes_template, lithology_intervals_template]
dtype: object
The Daydream CMR logs are installed as LAS and hold scalar NMR curves only, from 3755 m to 4145 m:
pp.read(pp.sample("daydream1_cmr")).curves
['BS',
'CDF',
'CMFF',
'CMR_TEMP',
'CMRP_3MS',
'GR_EDTC',
'HD1_PPC1',
'HD2_PPC1',
'KSDR',
'KTIM',
'STIT',
'T2CUTOFF',
'TCMR',
'TENS']
The large native Daydream DLIS files are not installed:
integration_fixture() downloads one on first use,
checks its SHA-256, keeps it in petrophys.datasets.data_dir() (set
PETROPHYS_DATA_DIR to choose the folder) and returns its path. A source
checkout with git lfs pull uses its own copies instead. Reading DLIS needs
pip install "petrophys[dlis]"; the inventory and checksums are in
src/petrophys/datasets/daydream/README.md.
from petrophys.datasets import list_integration_fixtures
list_integration_fixtures()
['daydream1_deep_pex_aps_ppc_ecs.dlis',
'daydream1_fmi_processed_dynamic_image.dlis',
'daydream1_shallow_aps_pex_hngs.las']
Go deeper¶
Headers, curves, coverage and first plots.
Aliases, unit fixes, plausibility screens and core units.
The Daydream CMR curves in use.