1. At a glance
A question needs no configuration file: the data settings are built from the LAS. Each part of a run has one place it is set, and a default.
flowchart LR
policy["Policy<br/>reference_v2.yaml"] --> data["Data settings<br/>(the data: section)"]
las["LAS file<br/>--tops, --formation"] --> data
file["Settings file<br/>--settings, PETROHARNESS_DATA"] --> data
interp["Interpretation settings<br/>field notes, interpretation=, /set"] --> data
data --> run["One question"]
model["Model card and endpoints<br/>--model-card, --model-url<br/>(default: K2-Horizon-7B card)"] ---> run
skills["Skill library<br/>--skills, PETROHARNESS_SKILLS<br/>(default: skills/researched)"] ---> run
| What | Where it is set | Default | Read by | Defined in |
|---|---|---|---|---|
Data config (data: and eval:) |
--settings FILE, PETROHARNESS_DATA, or configs/ |
none for a question (built from the LAS); required for benchmark mode | every question | config.py DataPaths, EvalPaths |
Interpretation settings (m, rw, cutoffs, zone rule, ...) |
field notes, interpretation=, /set, Conversation.adopt, the web UI |
the policy's for the zone rule and net-pay cutoffs, Petrophys's for the rest | Petrophys and the zoning | well/settings.py |
| Field notes | --field-notes FILE, field_notes= |
none | a question or a conversation | well/notes.py |
| Model card | --model-card, --model |
the K2-Horizon-7B card | every model call | models.py, config.ModelConfig |
| Model endpoints | --model-url, PETROHARNESS_ |
none (benchmark mode: http://) |
every model call | models.env_urls, agent. |
| Skill library | --skills, PETROHARNESS_ |
skills/researched (packaged) |
the investigation | config., agent. |
| Interpretation policy | resources/ (ResourcePaths.) |
cutoffs VCL 0.30 and SW 0.70, zone minimum 2.0 m, VCL bands 0.3 and 0.6, depth unit m | interpretation and zoning | well. |
| Step cap | --max-steps, max_steps= |
8 (agent/) |
the investigation | agent.state |
2. How it works
For a question (petroharness, petroharness chat, the web UI, ask(), Conversation.start), interval._settings and
interval.prepare build the data settings per LAS file: a settings file's data: section as the base, the LAS's folder,
the run's cache, the policy's net-pay cutoffs under any Petrophys options, then the user's interpretation settings.
flowchart TB
file["Settings file: data section<br/>(--settings, else PETROHARNESS_DATA)"] --> base["Data settings"]
las["The LAS file<br/>las_dir, cache_dir"] --> base
flags["--lithology-curve, --profile"] --> base
policy["Policy cutoffs<br/>vcl_cutoff 0.3, sw_cutoff 0.7"] --> interp["data.interpret<br/>(petrophys.interpret options)"]
base --> interp
notes["Field notes settings"] --> settings["Interpretation settings<br/>validate, split"]
given["interpretation= / web UI"] --> settings
settings --> interp
settings --> zones["data.zone_* keys"]
interp --> run["given_settings(...)<br/>every question"]
zones --> run
base --> run
Example: a question on GeoLink 30/6-5, Brent Group, with a small settings file.
# brent.yaml
data:
interpret: {gr_min: 30, gr_max: 120}
zone_min_thickness_m: 1.0
petroharness --las $LAS --tops $TOPS --formation "BRENT GP." --settings brent.yaml \
--question "Which zone has the best reservoir quality?"
The data settings built for it (real output of interval.prepare; the two folders shortened):
{"interpret": {"gr_min": 30, "gr_max": 120, "vcl_cutoff": 0.3, "sw_cutoff": 0.7},
"zone_min_thickness_m": 1.0,
"las_dir": ".../petrophys/datasets/geolink", "cache_dir": "<the run's cache folder>", "depth_unit": "las"}
The policy's cutoffs joined the file's options, the LAS's folder and the run's cache were filled in, and the answer's
unit is the LAS's own. Petrophys applied gr_min 30.0 and gr_max 120.0 (its vclay step), and the 1.0 m minimum
gave 31 zones.
The seven steps, in code
- The base is a settings file:
--settings(settings=), else the filePETROHARNESS_DATAnames, else none. Only itsdata:section is read. las_dirdefaults to the LAS file's folder andcache_dirto the run's cache folder:<out>/.cachefor the question command,<session>/.for a conversation, a temporary folder forcache ask()withoutout.--lithology-curvereplaceslithology_curve.--profile NAMEsetsinterpret: {context_. Otherwise, unlessprofile: NAME} interpreteris set,interpretkeeps the file's options and adds the policy's net-pay cutoffs where they are not set:vcl_cutoff: 0.3andsw_cutoff: 0.7(interval., from the policy'sPOLICY_ CUTOFFS cutoffs.vcl_maxandcutoffs.sw_max). Options with acontext_profileget no cutoffs.- The interpretation settings in force (the field notes' settings, overlaid by
interpretation=) are checked bywell.and split bysettings. validate well.: Petrophys's go oversettings. split interpret, the zone rule (zone_,min_ thickness_ m zone_vcl_bands,zone_layout) onto the data section. - The interval is resolved, and
depth_unitis set: from--depth-unitwhen it is given (over the file's value), else only when the file does not set it;laswhen the answer's unit is the LAS's own, elsemorft. - Every question then runs inside
config., which stands in for the data config file and, whengiven_ settings({"data": ..., "eval": {}, "skills": ...}) skillsis given, forPETROHARNESS_.SKILLS
For benchmark mode and for HarnessConfig() in Python, config. reads the data config file found by
config.data_file() (PETROHARNESS_DATA, else configs/ in the repository), and HarnessConfig.load
overlays the model card on the defaults.
3. Finding the data config
A question reads --settings, else PETROHARNESS_DATA, else nothing. Benchmark mode and HarnessConfig() read
PETROHARNESS_DATA, else configs/, and stop without one.
cp configs/data.example.yaml configs/data.local.yaml # untracked; fill it in
export PETROHARNESS_DATA=/path/to/data.yaml # or point at another file
petroharness --las $LAS --tops $TOPS --formation "BRENT GP." --question "..." --settings brent.yaml # from this file
Where each entry point looks
| Entry point | File read | With no file | Defined in |
|---|---|---|---|
petroharness, petroharness chat, petroharness ui, ask(), Conversation.start |
--settings (settings=), else PETROHARNESS_DATA; the data: section only |
built from the LAS alone | interval._settings |
petroharness setup |
--settings, else PETROHARNESS_DATA; the data: section is hashed, and with --las the settings are built from the LAS as for a question |
{data: {las_; with --las, built from the LAS alone |
core., core. |
petroharness benchmark, HarnessConfig(), cli.answer |
PETROHARNESS_DATA, else <repository root>/; sections data: and eval: |
ValueError: WHAT: no data settings at <path> ... |
config.data_file, config. |
Code inside config. |
none: the given dict | not applicable | config. |
Notes:
<repository root>isconfig.REPO_ROOT, two folders abovesrc/: the checkout in a source install.petroharness/ config. py - A file read through
config.may hold onlyuser_ settings dataandevalsections; any other is an error. The question path readsdata:and ignores the other sections. - When
PETROHARNESS_DATAis set in your shell for other work, everypetroharnessquestion starts from that file; the summary the command prints on stderr ends withsettings: <path>. user_settingscaches each file by its path and modification time, so an edited file is read again.
4. The data section
The data: section is DataPaths (src/); a misspelt key is an error (extra="forbid"). A
question needs none of it; the keys most often set are interpret (Petrophys's options), lithology_curve,
depth_unit and the zone rule.
Example: a tops table of many wells, with a well column, on COSTA HW-3 (logs and tops in feet). Data: Costa Gomes, Geiger and Arnold (2022), COSTA model, Heriot-Watt University, CC BY.
# costa.yaml: formations_costa.csv has the columns well, formation_name, top_depth, bottom_depth, ...
data:
tops_csv: formations_costa.csv
tops_columns: {well: well, name: formation_name, top: top_depth}
tops_depth_unit: ft
petroharness --las HW-3.las --formation KHARAIB-2 --settings costa.yaml --question "..."
The rows of HW-3 are picked by the well column, and the interval is 7805-8020 ft (431 samples; the settings' tops table formations_. HW-3 lists one top, so the interval runs from 7805 ft to the end of the log. On a well
the table does not list (30/6-5), the same settings stop with FormationNotFound: no tops for well '30_ (real runs). Given with --tops instead, the file's own base is read: 7805-8020 ft (431 samples; tops file formations_.
data keys
| Key | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
las_dir |
path | required (a question: the LAS file's folder) | One LAS file per well, named <well>.las. Benchmark mode reads each question's LAS from here by file name. |
DataPaths.las_dir |
tops_csv |
path or null | null | The tops table for an interval given by a formation name only (a benchmark row, or --formation without --tops). The named top runs down to the next deeper top of any rank. |
DataPaths.tops_csv, well. |
tops_columns |
mapping | {well: uwi, name: form, top: top} |
The tops_csv column names for the well, the top name and the top depth. |
DataPaths. |
top_name_pattern |
regex or null | null (every top counts) | Which top names count, matched on the upper-cased name. | DataPaths. |
tops_depth_unit |
m, ft or null |
null (the LAS's own unit) | The unit of tops_csv, which records none. |
DataPaths. |
interpret |
mapping or null | null; a question sets it (step 4 of section 2) | Options for petrophys., which then interprets each LAS: {} for the library's defaults, {context_, workflow settings such as {gr_ or {sw_, or curve_aliases (a mapping, or a CSV path with curve,standard columns). |
DataPaths., well. |
interpreter |
text or null | null | A Petrophys batch interpreter that interprets the data instead: module:function or /, with the contract of Petrophys's process_ ((input_, one BatchLasResult per well). Excludes interpret. |
DataPaths., well. |
engines_dir |
path or null | null | The folder of pinned interpretation engines, one folder per engine name, used when the policy names an engine and neither interpret nor interpreter is set. |
DataPaths., well. |
depth_unit |
m, ft, las or null |
null (the policy's m); a question sets it |
The unit depths, thicknesses and zone limits are shown in; las is each file's own unit. |
DataPaths., well.view |
lithology_curve |
text, list of text, or null | null (detected) | The lithology log's mnemonic, or several (the first a well has with data is used). Null: the LAS curve whose mnemonic or description names a lithology or facies log and holds integer codes; with none, the lithology Petrophys's mineral solver wrote (its domain is the lithology_domain setting); with neither, shale-volume bands. |
DataPaths., well. |
lithology_ |
path or null | null (the library's table) | A workbook mapping lithology codes to labels; the library's table fills any code it lacks. | DataPaths. |
lithology_columns |
mapping | {code: code, label: lithology} |
The workbook's code column and label column (LithologyColumns, also strict). |
config. |
zone_layout |
lithology_runs or formation |
lithology_runs |
Runs of one lithology (thin runs dropped), or the whole interval as one zone labelled by the majority lithology. | DataPaths., well.view |
zone_ |
number or null | null (the policy's 2.0) | A run no thicker than this (metres) is not a zone. | DataPaths., well. |
zone_vcl_bands |
two numbers or null | null (the policy's [0.3, 0.6]) |
The VCL edges of the clean, shaly and shale-prone bands that zone a well with neither a lithology log nor a solved lithology. | DataPaths. |
reach |
well or focus |
well |
What a question can reach. well: any stretch of the well (a unit of the tops file, the user's zones, a depth range) through a tool's zones, a verb's run under where, and the question's scope; intervals listed uncut by zones. focus: the interval only, as a benchmark frames its answers (every welllogbench config sets it). |
DataPaths.reach, agent.selection |
units |
list | []; a question sets it |
The tops file's units over the whole well (name, top, base), selectable by name under reach: well. Set by interval.prepare from the tops file. |
DataPaths.units, interval._units |
zones |
list | []; --zones sets it |
The user's zones (name, top, base), which frame the question in place of the lithology zones; read from a zones file by well.. |
DataPaths.zones, well. |
zones_source |
text or null | null | The zones file's name, as the map names it. | DataPaths. |
basis |
all or zones |
all |
The tools' statistics: each zone, the zones pooled and the whole interval (all), or the zones only (zones; the record keeps all three). |
DataPaths.basis |
analyzer_ |
text or null | null (the policy's analyzers., current: the library's own tables) |
The class-table set the Petrophys analyzers classify with: a set a Petrophys context package ships, for data that package's context interprets. | DataPaths., well. |
conventions |
list of text | [] |
The data's reporting conventions, one sentence each, shown in every step prompt and to the writer. Empty: no prompt changes. | DataPaths. |
cache_dir |
path | <repository root>/.; a question uses its own .cache |
Where interpreted wells are cached. | DataPaths., well. |
Notes:
- How each LAS is interpreted: with
interpret,petrophys.with those options; withinterpret interpreter, that function; with neither, the engine the policy names, fromengines_dir(an error whenengines_diris not set), run in a subprocess, or, when the policy names none,petrophys.with the library's settings and the policy's cutoffs. A question always setsinterpret interpretunless the file setsinterpreter. - The cache key is the LAS content, the policy's interpretation keys (
name,engine,cutoffs,value_range_qc), the interpretation code's version (prepare.), the Petrophys build, and theINTERPRETATION_ VERSION interpretoptions orinterpreter(with the content of files they name). Delete the folder to interpret again. basis: zonesandconventionsare a dataset's reporting settings, used for a benchmark's data (Architecture).
An annotated data config with every key
data:
las_dir: /data/las # one LAS per well, <well>.las (a question: the LAS file's folder)
tops_csv: /data/formation_tops.csv # the tops table for intervals named only by formation
tops_columns: {well: uwi, name: form, top: top} # its columns: well, top name, top depth
top_name_pattern: null # a regex on upper-cased top names; null keeps every top
tops_depth_unit: null # m or ft; null: the LAS file's own unit
interpret: # petrophys.interpret options ({} for the library's defaults)
gr_min: 30 # gamma-ray clean endpoint, API
gr_max: 120 # gamma-ray shale endpoint, API
curve_aliases: {RESM: RMED} # your mnemonic: the standard one
# interpreter: /path/adapter.py:interpret_all # instead of interpret, never with it
engines_dir: null # pinned engines, when the policy names one and nothing above is set
depth_unit: m # m, ft or las; null: the policy's (m)
lithology_curve: null # a mnemonic, a list of them, or null (detected)
lithology_nomenclature: null # a workbook of lithology codes and labels
lithology_columns: {code: code, label: lithology}
zone_layout: lithology_runs # or formation: the interval is one zone
zone_min_thickness_m: null # null: the policy's 2.0 m
zone_vcl_bands: null # null: the policy's [0.3, 0.6]
basis: all # or zones
analyzer_class_tables: null # a context package's class-table set; null: the policy's (current)
conventions: [] # reporting conventions, one sentence each
cache_dir: /data/cache/wells # default <repository root>/.cache/wells
5. Interpretation settings
The interpretation settings are Petrophys's workflow settings, read from the installed library
(petrophys.), and the harness's zone rule: 65 in 11 groups, which
well. lists. Give them by name with interpretation= (ask(), Conversation.start), a field
notes file's settings:, /set or Conversation.adopt, or the web UI's settings panel. Each in detail, with how it
is checked and merged: Interpretation settings.
from petroharness.well import settings as T
[g["title"] for g in T.schema()["groups"]]
# ['Zones', 'Clay volume', 'Porosity and matrix', 'Formation water', 'Water saturation', 'Permeability',
# 'Net reservoir and pay', 'Temperature', 'Mud', 'Lithology', 'Input handling']
The settings
Every setting as settings.schema() gives it with the pinned Petrophys build (3.0.0); the Meaning column is
Petrophys's own first sentence. "From the data" means unset: Petrophys reads the value from the LAS header or derives
it from the data.
| Setting | Kind | Default | Meaning | Group |
|---|---|---|---|---|
zone_ |
number, m | 2.0 (policy) |
A run of one lithology (or one shale-volume band) no thicker than this is not a zone; its samples stay in the whole-interval statistics as samples outside the zones. | Zones |
zone_vcl_bands |
bands, v/v | [0.3, 0.6] (policy) |
For a well with neither a lithology log nor a solved lithology: the VCL edges of the clean, shaly and shale-prone bands that zone it. | Zones |
zone_layout |
lithology_runs, formation |
lithology_runs |
Split the interval into runs of one lithology, or keep it as one zone. | Zones |
gr_method |
linear, larionov_tertiary, larionov_older, steiber, clavier |
linear |
Transform: "linear", "larionov_tertiary", "larionov_older", "stieber" (stored as "steiber") or "clavier". | Clay volume |
gr_min |
number, API | from the data | Clean-rock gamma-ray endpoint, API, used as given. | Clay volume |
gr_max |
number, API | from the data | Shale gamma-ray endpoint, API, used as given. | Clay volume |
sp_min |
number, mV | from the data | Shale SP baseline, mV: the line of least SP deflection. | Clay volume |
sp_max |
number, mV | from the data | Clean-sand SP line (static SP), mV: the line of greatest deflection. | Clay volume |
rho_cl |
number, g/cm³ | from the data | Clay density, g/cm3, used by the carbonate mineral solve and the neutron-density hydrocarbon correction. | Clay volume |
matrix_type |
auto or a mineral name (23 values, such as sandstone, limestone, dolomite) |
from the data | "auto" (resolved from lithology evidence) or a mineral name such as "sandstone", "limestone" or "dolomite"; see petrophys.model.constants.MatrixProperties.names. | Porosity and matrix |
rho_ma |
number, g/cm³ | from the data | Matrix density, g/cm3. | Porosity and matrix |
nphi_ma |
number, v/v | from the data | Matrix neutron porosity, v/v. | Porosity and matrix |
dt_ma |
number, µs/ft | from the data | Matrix sonic slowness, us/ft. | Porosity and matrix |
rho_fl |
number, g/cm³ | from the data | Pore-fluid density, g/cm3, used by the porosity, hydrocarbon-correction and mineral steps alike. | Porosity and matrix |
dt_fl |
number, µs/ft | 189.0 |
Pore-fluid sonic slowness, us/ft. | Porosity and matrix |
phi_cl |
number, v/v | from the data | Clay (shale) porosity, v/v. | Porosity and matrix |
apply_ |
switch | false |
Apply the neutron-density hydrocarbon correction (opt-in). | Porosity and matrix |
hc_type |
oil, gas |
oil |
Hydrocarbon type, "oil" or "gas": the fluid of the neutron-density hydrocarbon correction and, under "current", the PHIT rule in neutron-density crossover (PHID > PHIN + 0.05): the root-mean-square of PHID and PHIN (Gaymard and Poupon, 1968) for gas, density porosity for oil. | Porosity and matrix |
rho_hc |
number, g/cm³ | from the data | Hydrocarbon density in the flushed zone, g/cm3, for the hydrocarbon correction and the core matrix-density check of auto lithology. | Porosity and matrix |
hc_hydrogen_index |
number | from the data | Hydrogen index of the hydrocarbon for the neutron hydrocarbon correction. | Porosity and matrix |
rw |
number, ohm.m | from the data | Formation water resistivity Rw, ohm.m, at rw_meas_temp. | Formation water |
salinity_ppm |
number, ppm | from the data | Formation water salinity, ppm NaCl equivalent: another way to give the formation water. | Formation water |
rw_meas_temp |
quantity, °F | from the data | Temperature of rw, e.g. "230 degF" or "110 degC". | Formation water |
allow_default_rw |
switch | true |
Use a 0.05 ohm.m default Rw when no Rw source is found (the warnings say so). | Formation water |
sw_model |
auto, archie, north_sea, nigeria_, simandoux, modified_simandoux, indonesia, dual_water, waxman_smits |
auto |
"auto" (routed per sample by clay content) or one of "archie", "simandoux" (Sw in the clay term, Bardon-Pied), "modified_simandoux" (sand term over 1 - Vcl), "indonesia", "dual_water", "waxman_smits", "north_sea", "nigeria_schlumberger". | Water saturation |
a |
number | from the data | Tortuosity factor a. | Water saturation |
m |
number | from the data | Cementation exponent m; one value, or one per lithology as for a. | Water saturation |
n |
number | from the data | Saturation exponent n; one value, or one per lithology as for a. | Water saturation |
m_star |
number | 2.0 |
Waxman-Smits cementation exponent m*. | Water saturation |
cec |
number, meq/100 g | from the data | Cation exchange capacity, meq/100 g (0 to 150; pure smectite is 80-150). | Water saturation |
b_coeff |
number | from the data | Equivalent counter-ion conductance B, (S/m)/(meq/cm3): at 25 degC 4.6 * (1 - 0.6 * exp(-0.77 / Rw)) (Waxman and Smits, 1968), and higher at reservoir temperature. | Water saturation |
rwb |
number, ohm.m | from the data | Bound-water resistivity, ohm.m, from lab data or the LAS header. | Water saturation |
rtsh |
number, ohm.m | from the data | Shale resistivity Rsh, ohm.m, of the shaly-sand equations (Simandoux, modified Simandoux, Indonesia, North Sea, Nigeria). | Water saturation |
vsh_exp |
number | 1.6 |
Shale exponent of the North Sea model. | Water saturation |
shale_exp |
number | 1.6 |
Shale exponent of the Nigeria-Schlumberger model. | Water saturation |
sw_ |
number, v/v | from the data | Clay volume, v/v, from which sw_model="auto" uses a shaly-sand equation rather than Archie. | Water saturation |
perm_method |
auto, timur, coates, wyllie_rose, lith_vcl |
auto |
Permeability method. | Permeability |
perm_ |
timur, coates, wyllie_rose, lith_vcl |
coates |
Empirical equation of PERM under perm_method="auto": "coates" (default), "timur", "wyllie_rose" or "lith_vcl". | Permeability |
swirr |
number, v/v | from the data | Irreducible water saturation, v/v, for the permeability equations. | Permeability |
swirr_flag_phi_cl |
workflow, all_shale_phit |
workflow |
Clay porosity behind the PHIE that picks the SWIRR_APP samples, i.e. the reservoir flag built before permeability when the well has no RESFLAG or NET_RES curve. | Permeability |
use_peer_core |
switch | false |
Calibrate permeability with core data from peer_wells, under the conditions given there; without peer_wells it has no effect. | Permeability |
vcl_cutoff |
number, v/v | 0.3 (policy) |
Maximum clay volume for net rock, v/v. | Net reservoir and pay |
phie_cutoff |
number, v/v | 0.08 (policy) |
Minimum effective porosity for net reservoir, v/v. | Net reservoir and pay |
sw_cutoff |
number, v/v | 0.7 (policy) |
Maximum water saturation for net pay, v/v. | Net reservoir and pay |
reuse_ |
switch | false |
Reuse a RESFLAG or NET_RES curve already on the well as the reservoir flag that picks the SWIRR_APP samples before permeability. | Net reservoir and pay |
bht |
quantity, °F | from the data | Bottom-hole temperature, e.g. "230 degF" or "110 degC". | Temperature |
surface_temp |
quantity, °F | from the data | Surface (mean annual) temperature at depth 0 of the linear temperature profile (offshore, the sea surface rather than the seabed); default 68 degF. | Temperature |
td |
quantity | from the data | Total depth of the BHT, e.g. "2650 m" or "8700 ft"; a bare number is in the well's depth unit. | Temperature |
temperature_ |
quantity, °F/100 ft | from the data | Geothermal gradient from surface_temp at depth 0, e.g. "30 degC/km", "3 degC/100m" or "1.65 degF/100ft"; a bare number is read as degF/100 ft, with a warning. | Temperature |
mud_type |
WBM, OBM |
WBM |
"WBM" (water-based) or "OBM" (oil-based) mud. | Mud |
mud_water |
fresh, salt |
fresh |
"fresh" or "salt" mud, which sets the Rm-to-Rmf factor. | Mud |
mud_ |
switch | false |
The mud contains clay or KCl, so the SP log is not used: Rw is not estimated from the SP, and no VCL_SP is computed. | Mud |
rmf_at_meas_temp |
number, ohm.m | from the data | Mud-filtrate resistivity Rmf at rmf_meas_temp, ohm.m. | Mud |
rmf_meas_temp |
quantity, °F | from the data | Temperature at which rmf_at_meas_temp was measured, e.g. "75 degF" or "24 degC". | Mud |
rmf_salinity_ppm |
number, ppm | from the data | Mud-filtrate salinity, ppm NaCl equivalent (alternative to Rmf). | Mud |
rmf_chlorides_mg_l |
number, mg/l | from the data | Mud-filtrate chlorides (Cl-), mg/l, as on the mud report and the LAS header CLFL. | Mud |
rm |
number, ohm.m | from the data | Mud resistivity Rm at rm_meas_temp, ohm.m (Rmf is derived from it). | Mud |
rm_meas_temp |
quantity, °F | from the data | Temperature at which rm was measured, e.g. "75 degF" or "24 degC". | Mud |
lithology_domain |
auto, clastic, carbonate, evaporite |
from the data | Broad interpretation domain: "clastic" (the default when unset), "carbonate", "evaporite" or "auto". | Lithology |
lithology_source |
auto, external, vendor, computed, config |
auto |
Lithology source. | Lithology |
carbonate_ |
generic, costa |
from the data | Calibration of the carbonate-domain mineral solve, which takes calcite and dolomite from bulk density and closure. | Lithology |
standardize_input |
switch | from the data | Standardize curve aliases and units before interpretation: vendor mnemonics get canonical aliases, units such as kg/m3 or percent porosity are converted and implausible values are screened, with a warning. | Input handling |
rename_ |
switch | false |
Rename vendor mnemonics to canonical names instead of adding aliases. | Input handling |
calculation_ |
current, geolink |
current |
Interpretation configuration. | Input handling |
Notes:
- The list is read from the installed library, so a setting Petrophys adds appears without a change here, under the
group
More from Petrophys. - Settings that take a table, a well list or a file are not interpretation settings:
raise_on_error,peer_wells,formation_tops,zones,lithology,lithology_csv,lithology_,intervals lithology_codes,lithology_curve,skip_steps,nd_clay,curve_aliases(well.). Those that aresettings. HIDDEN petrophys.options can go underinterpret data.interpret. - Each value is checked by
well.: a number, a whole number,settings. validate true/false, one of the choices, or two band edges, then by Petrophys's own validation. - A user's
vcl_cutoff,sw_cutofforphie_cutoffalso replaces the policy's cutoff in what the model is told about the record (well.).view. user_ cutoffs
6. Field notes file
A field notes file is a YAML mapping of a team's standing choices for a field (Conversations): settings in force from the start, and notes added to every question.
name: Brent Group study
settings:
m: 1.8
rw: 0.04
sw_cutoff: 0.6
notes:
- Report water saturation from the Indonesia model.
- Name the Ness and Etive formations where a zone falls in one.
Keys
| Key | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
name |
text | the file's stem | How answers and logs name the notes. | well.notes.load |
settings |
mapping | {} |
Interpretation settings in force from the start (section 5 names), each marked as coming from the field notes. | well.notes.load |
notes |
list of text, or one text | [] |
Standing choices in words, added to every question as (The user's field notes for this field, <name>: ...). At most 20 notes (MAX_NOTES) of at most 300 characters (MAX_NOTE_CHARS); runs of spaces are collapsed. |
well.notes.load, well. |
Notes:
- Any other key, a settings value that fails validation, or notes that are not a list of sentences are refused with
WHAT ... FIX ..., entry by entry. - A conversation keeps what the file held, with its SHA-256, in its log; a resumed conversation does not read the file again. A benchmark run never reads field notes.
7. The eval section
EvalPaths is the eval: section: reference material that only benchmark mode, the tests and evaluation scripts
read; a task never sees it (HarnessConfig. drops it).
eval keys
| Key | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
questions |
path or null | null | The question file, a JSON list of rows (qa_id, question, las_path, formation, category; Command line). Required by benchmark mode. |
EvalPaths., tasks.load_tasks |
reference_ |
path or null | null | The reference contexts, by category, well and formation; read by tests. | EvalPaths. |
gt_dir |
path or null | null | The reference question-answer files; read by tests. | EvalPaths.gt_dir |
Example:
eval:
questions: /data/benchmark/questions.json
reference_context_dir: null
gt_dir: /data/benchmark/references
8. Models and endpoints
A model card is a YAML file with one section, model, checked against config.ModelConfig; the card comes from
--model-card, else the generic card when --model names the served model, else the K2-Horizon-7B card. The
endpoints come from --model-url, else PETROHARNESS_ (comma-separated). With none of these, the command and
the web UI take the model chosen last in the web UI's Model dialog (model.json in PetroHarness's folder), else
WellLogLLM-3.7B as a GGUF in Ollama (welllogllm_ at http://), made ready first
(petroharness.; Install and set up). Benchmark mode
reads neither. Models explains serving and each field.
model:
model: Qwen/Qwen3-32B
label: Qwen3-32B
reasoning: true
chat_template_kwargs: {enable_thinking: true}
retry_template_kwargs: {enable_thinking: false}
max_tokens_spec: 32768
max_tokens_writer: 32768
timeout_s: 3600
Model card fields
| Field | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
model |
text | "" (names none: --model is then required) |
The served model's name. | ModelConfig.model, models.register |
label |
text or null | null (model) |
The name people read. --model also replaces the label. |
ModelConfig.label, models.label |
base_url |
text | http:// |
The endpoint when a card is loaded on its own; a question's endpoint comes from the endpoint list instead. | ModelConfig. |
api_key_env |
text | PETROHARNESS_ |
The environment variable holding the API key. | ModelConfig. |
temperature, top_p |
number, number or null | 0.0, null | Sampling. | ModelConfig |
max_tokens_spec, max_tokens_writer |
integer | 3000, 6000 | Output caps of a step (and settle), and of the writer (and a repair). | ModelConfig |
timeout_s, max_retries |
number, integer | 600.0, 3 | Per-request timeout and client retries. | ModelConfig |
reasoning, enable_thinking |
switch | false, false | A thinking model; the template variable sent when chat_ is null. |
ModelConfig |
chat_, retry_, light_ |
mapping or null | null | Template variables of each call, of the retry after an empty reply, and of a light call. | ModelConfig |
reasoning_end |
text or null | null | The marker after which a light call's reply starts. | ModelConfig |
send_, send_temperature |
switch | true, true | Whether these request fields are sent. | ModelConfig |
max_tokens_param |
max_tokens, max_ |
max_tokens |
The output cap's name. | ModelConfig |
structured_output |
json_schema, json_object, none |
json_schema |
How JSON replies are requested. | ModelConfig |
replay_ |
switch or null | null (as reasoning) |
Replayed assistant turns carry an empty reasoning field. |
ModelConfig |
Notes:
- The card:
--model-card(a YAML file, or a packaged card's name with or without.yaml), else the generic card when--modelis given, else the K2-Horizon-7B card (models.card_file). The packaged cards are insrc/:petroharness/ resources/ models/ generic(no sampling or template fields sent, caps 16384, timeout 1800 s, 2 retries), the default card, and the WellLogLLM cardswelllogllm_7b,welllogllm_3_7bandwelllogllm_.3_ 7b_ gguf - A card the Model dialog writes is in
cards/of PetroHarness's folder; itsapi_key_envnames a variable of its own (PETROHARNESS_KEY_and ten characters), which PetroHarness sets fromkeys.json(connect.arm). - Each card, model name and endpoint list gets a registry key in
models.MODELS:(card file, endpoints[, model])(models.register). - A question's endpoint is
endpoints[(int(sha256(task_(id)[:8], 16) + rep) % len(endpoints)] agent.); the web UI instead sends each question to the least busy endpoint.graph. task_ config - The API key is the variable the card names, else
EMPTY(HarnessConfig.); a local server accepts any key.api_ key
9. Skill library
One setting picks the skill library the model reads guides from
(Development): --skills (skills=), else PETROHARNESS_, else
the packaged skills/researched; none runs without guides.
export PETROHARNESS_SKILLS=/path/to/my_library # library.yaml, refs.yaml, <guide>/SKILL.md, <guide>/sources.yaml
petroharness --las $LAS --tops $TOPS --formation "BRENT GP." --question "..." --skills none
The skills setting
| Source | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
--skills / skills= |
folder or none |
not set | Wins over the others; a relative path that exists from the current folder is made absolute. | interval.prepare, config. |
PETROHARNESS_ |
folder or none |
not set | Used when no --skills was given. |
config. |
HarnessConfig. |
folder or none |
skills/researched |
The configuration's library: a model card's top-level skills: key, which HarnessConfig.load overlays (the data settings file has no skills key). |
config. |
Notes:
- A relative folder is read from
src/;petroharness/ resources none(any case) means no library, no index and no guide action. - A library is checked as it loads (
agent.); a bad one raisesdirection. load LibraryErrorwith each problem, before the first model call (skills README). - The trace records
skills:{"library", "version"}.
10. Environment variables
Three variables cover everyday use: PETROHARNESS_ (the endpoints), PETROHARNESS_DATA (a base settings
file) and PETROHARNESS_ (the skill library). Hosted tracing variables set to true stop the harness.
export PETROHARNESS_MODEL_URL=http://localhost:8000/v1,http://localhost:8001/v1
export PETROHARNESS_API_KEY=any-key-for-a-local-server
unset PETROHARNESS_DATA # a new well with the defaults
export LANGSMITH_TRACING=false # allowed; true or 1 stops the harness
Variables read by the package
These are every environment variable read in src/petroharness.
| Variable | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
PETROHARNESS_DATA |
path | not set | The data config. For a question and for petroharness setup, the base settings file when --settings is not given; for benchmark mode and HarnessConfig(), the data config (else configs/). The web UI shows it in /api/config (settings_env). |
config.data_file, interval._settings, core., ui. |
PETROHARNESS_ |
comma-separated URLs | not set | The model endpoints, when --model-url is not given. Set, the command and the web UI do not read the Model dialog's saved choice. |
models.env_urls |
PETROHARNESS_HOME |
folder | the system's place for an application's settings (~/., ~/, %APPDATA%\PetroHarness) |
PetroHarness's folder: model.json (the Model dialog's choice), keys.json (the keys, readable by its owner only), cards/. The tests set one of their own. |
connect.home |
OPENROUTER_API_KEY |
text | not set | The OpenRouter key, when the Model dialog keeps none. | connect.key |
PETROHARNESS_KEY_… |
text | set by PetroHarness | The key of a card the Model dialog wrote, set in the process from keys.json. |
connect.arm |
PETROHARNESS_ |
text | not set (EMPTY is sent) |
The API key, unless the card's api_key_env names another variable. |
config. |
the card's api_key_env (for example OPENAI_API_KEY) |
text | not set | The API key for that card. | config. |
PETROHARNESS_ |
folder or none |
not set | The skill library, when --skills is not given. The web UI shows it in /api/config (skills_env). |
config., ui. |
PETROHARNESS_ |
folder | not set (src/) |
Another copy of the component texts, read at import, to compare two versions. | agent. |
PETROHARNESS_SET |
name=value,... |
not set | Switches under test (tight_numbers, cell_thickness: Extending); another name raises ValueError. |
options.get |
LANGSMITH_TRACING, LANGSMITH_, LANGCHAIN_TRACING, LANGCHAIN_ |
true/1 or other |
not set | When any is true or 1 (any case), the harness refuses to run: hosted tracing would send every prompt, with the well data, to its service. |
agent. |
Notes:
- The tests also read
WELLLOGBENCH,PETROHARNESS_andSAMPLE_ LAS PETROHARNESS_RUNS(Development); the package does not. PETROHARNESS_is also read once whenMODEL_ URL petroharness.is imported, for the default card's registry entry (models models.MODELS).
11. Configuration in Python
HarnessConfig is the one configuration object: data, eval, model, resources and skills, strict at every
level. Inside given_ it reads the given dict instead of a data config file (real output):
import petrophys
from pathlib import Path
from petroharness.config import HarnessConfig, given_settings
geolink = str(Path(petrophys.sample("30/6-5")).parent)
with given_settings({"data": {"las_dir": geolink, "basis": "zones"}, "eval": {}}):
cfg = HarnessConfig()
print(cfg.data.basis, cfg.data.zone_layout, cfg.skills) # zones lithology_runs skills/researched
HarnessConfig and its helpers
| Name | Type | Default | Meaning | Defined in |
|---|---|---|---|---|
HarnessConfig.data |
DataPaths | the data: section in force |
Section 4. | config. |
HarnessConfig.eval |
EvalPaths or None | the eval: section in force |
Section 7; None in a task's configuration. | config. |
HarnessConfig. |
ModelConfig | ModelConfig() |
Section 8. | config. |
HarnessConfig. |
ResourcePaths | policy_file = resources/, rules_dir = resources/rules |
The policy and the registries. | config. |
HarnessConfig. |
text | skills/researched |
Section 9. | config. |
HarnessConfig. |
classmethod -> HarnessConfig | none | The defaults with the data settings in force, overlaid by each YAML file in order (later files win, key by key). | HarnessConfig.load |
for_tasks() |
HarnessConfig | none | A copy without the eval section. |
HarnessConfig. |
api_key() |
text | none | The key from model.api_key_env, else EMPTY. |
HarnessConfig. |
given_ |
context manager | none | Uses {"data": ..., "eval": ..., "skills"?: ...} instead of the data config file inside the block (per context); its skills, when present, wins over PETROHARNESS_. |
config. |
user_ |
dict | none | One section (data or eval) of the settings in force. |
config. |
data_file() |
Path | none | PETROHARNESS_DATA, else configs/. |
config.data_file |
skills_ |
text | none | The library in force (section 9). | config. |
models.env_urls() |
list | none | The endpoints from the environment. | models.env_urls |
models. |
text | none | The card's file (a packaged card relative to resources). |
models.card_file |
models. |
dict | none | The card's model section, checked. |
models. |
models. |
text | none | model, else the card's label, else its model. |
models.label |
models. |
text | none | The registry key for a card, model and endpoints. | models.register |
Notes:
- Constants:
REPO_ROOT,RESOURCES(src/),petroharness/ resources DATA_FILE_ENV(PETROHARNESS_DATA),LOCAL_DATA_FILE(<REPO_),ROOT>/ configs/ data. local. yaml SKILLS_ENV(PETROHARNESS_),SKILLS DEFAULT_SKILLS(skills/researched);models.URL_ENVS(PETROHARNESS_),MODEL_ URL models.(GENERIC_ CARD models/).generic. yaml - A question's configuration is built by
agent.: the card loaded withgraph. task_ config HarnessConfig.load, the model name from--model, the endpoint from the list, andfor_tasks().
12. Precedence
For an interpretation setting, each source overrides the one before it:
flowchart LR
pp["Petrophys default"] --> pol["policy cutoffs<br/>(vcl 0.3, sw 0.7)"]
pol --> file["data.interpret<br/>in the settings file"]
file --> fn["field notes<br/>settings"]
fn --> start["interpretation=<br/>or the web UI"]
start --> set["/set or adopt<br/>(next question on)"]
A Petrophys setting cannot be combined with --profile or a data interpreter: that is an error, not an override.
The unit answers are shown in comes from --depth-unit, else the settings file's data.depth_unit, else the tops
file's unit, else the LAS's own; a tops file whose stated unit --depth-unit contradicts is refused. On KGS
1046123714, whose logs and tops are in feet (real runs; Data: Kansas Geological Survey (kgs.ku.edu)):
| Given | The interval |
|---|---|
--tops 1046123714_ |
3991-4080 ft (178 samples; tops file 1046123714_ |
--top 1216. |
1216.: 178 samples again, answered in metres |
the feet tops file with --depth-unit m |
ValueError: WHAT: the tops file 1046123714_ |
Who wins
When several sources set the same thing, the first listed wins.
| Setting | Order, first wins | Defined in |
|---|---|---|
| Data settings file (a question) | --settings (settings=), PETROHARNESS_DATA, none |
interval._settings |
Data settings file (benchmark, HarnessConfig()) |
given_, PETROHARNESS_DATA, configs/ |
config. |
lithology_curve |
--lithology-curve, the file's data., detection |
interval._settings |
las_dir, cache_dir (a question) |
the file's value, then the one built for the run (LAS folder, the run's .cache) |
interval._settings |
depth_unit (a question) |
--depth-unit (depth_unit=), the file's data.depth_unit, the tops file's unit, the LAS's own |
interval.prepare, interval._interval |
| How the LAS is interpreted | --profile (context profile), the file's interpreter, interpret |
interval._settings, well. |
A Petrophys setting (m, rw, gr_min, ...) |
/set or adopt (from the next question), interpretation= or the web UI at the start, the field notes' settings, the file's data.interpret, Petrophys's default |
well.settings, interval., Conversation.adopt |
A net-pay cutoff (vcl_cutoff, sw_cutoff) |
as a Petrophys setting, then the policy's 0.3 and 0.7 |
interval. |
The zone rule (zone_, zone_vcl_bands, zone_layout) |
/set or adopt, interpretation=, the field notes, the file's data.zone_* keys, the policy (2.0, [0.3, 0.6], lithology_runs) |
interval., well.view |
| Skill library | --skills (skills=), PETROHARNESS_, HarnessConfig., skills/researched |
config. |
| Model card | --model-card, the generic card when --model is given, the K2-Horizon-7B card |
models.card_file |
| Model name | --model, the card's model |
agent. |
| Endpoints | --model-url, PETROHARNESS_; benchmark mode then http:// |
ask._model_key, models.env_urls |
| API key | the variable the card's api_key_env names, EMPTY |
HarnessConfig. |
| Step cap | --max-steps (max_steps=), 8 |
agent. |
| Route | --investigate (direct=False), the direct route |
agent.graph.turn |
| Resumed conversation | the log's session_start inputs, except --model-url and --investigate given again |
Conversation. |
Notes:
--depth-unitwins over the settings file'sdata.depth_unitfor the unit answers are shown in, and states the unit of--topand--base. Without it, the file'sdata.depth_unitsets the answers' unit, and--topand--baseare read in the LAS's own unit.
13. Limits and errors
Every configuration error, with where it is raised
| Situation | What happens | Where |
|---|---|---|
No data config for benchmark mode or HarnessConfig() |
ValueError: WHAT: no data settings at <path>. ... FIX: copy configs/ |
config. |
A data config with a section other than data and eval |
ValueError: WHAT: <path> has sections [...]. FIX: give 'data' (and optionally 'eval') only. |
config. |
--settings or PETROHARNESS_DATA names no file (a question) |
FileNotFoundError: WHAT: no data settings file at <path>. ... |
interval._settings |
A misspelt key in data, eval, lithology_columns or a model card |
A pydantic validation error naming the key | config._Strict |
interpret and interpreter both set |
ValueError: WHAT: both data. |
well. |
interpret names a setting Petrophys does not have |
ValueError: WHAT: data. |
well. |
tops_csv cannot be read as a table (a row with more fields than the header, an empty file) |
ValueError: WHAT: the settings' tops table <name> cannot be read as a table (<what pandas reports>). FIX: ... |
well. |
--profile with data.interpreter |
ValueError: WHAT: --profile <name> and the settings' data. |
interval._settings |
| Petrophys settings with a profile or interpreter | ValueError saying the profile or interpreter fixes its own settings |
interval., Conversation.adopt |
| An interpretation setting with a wrong name or value | ValueError: WHAT: interpretation settings that cannot be used: <name>: <problem>. ... |
well. |
The policy names an engine, nothing else interprets, and engines_dir is not set |
ValueError: WHAT: the policy names engine ... but no engines directory is configured. FIX: set data. |
well. |
data.interpreter is not a function |
ValueError naming the spec |
well. |
data. holds an empty or non-text entry |
ValueError |
well. |
| Two lithology logs and none named | ValueError naming both |
well. |
| A bad skill library | LibraryError with each problem |
agent. |
| A field notes file with an unknown key, bad settings or too many or too long notes | ValueError per entry, with the fix |
well.notes.load |
PETROHARNESS_SET naming no switch |
ValueError: PETROHARNESS_ |
options.parse |
| Hosted tracing switched on | RuntimeError at import; the process stops |
agent. |
| No endpoint for a question | ValueError: WHAT: no model endpoint. ... |
ask._model_key |
14. Related pages
- Command line: the flags that set these values on the command line.
- Python API: the functions that take them as arguments.
- Evaluate a formation: a data settings file for one question.
- Development: the data config, skill library and benchmark mode.
- Models: serving a model, model cards and every field.
- Conversations: changing a setting mid-conversation, field notes.
- Web UI: the settings panel of the web UI.
- Audit an answer: which of these settings the setup hash covers.
- Interpretation settings: each interpretation setting in detail.
- Well preparation: how the data settings are used to prepare a well.
- Testing: the environment variables the tests read.

