Lock dock (v16)
Turn Lock dock on below the tool switcher to share the original LAS across Log Viewer, Crossplot, Histogram and Python in the same browser and website address. New files, sample files and removal synchronize with open tabs. The stored original LAS restores after navigation or reload. Turning off deletes the stored shared LAS and leaves open datasets in place.
Scripts, calculated results and plot settings stay in each tool. A different shared LAS resets results/views and stops a run against the old file while keeping editor text. Save your project before leaving a page. Export LAS and reimport it while locked to share calculated curves as source curves. Read Lock dock: workflow, storage and limitations.
The browser workflow
- Load a LAS and configure the plot.
- Click Save settings to download a
.scene.jsonfile. - In another session, load the same LAS in the same tool, then click Load settings.
- Click Verify plot to inspect the applied configuration and sample checks; export the PNG.
A settings file contains the filename, fingerprint, row count, curve references and plotting choices. Crossplot settings also contain selected source-row indices. It does not contain raw curve arrays. Each tool has a separate in-memory dataset; switching tools does not transfer your LAS.
Binding and validation
The format is petrophysics.scene/v1. The dataset fingerprint is SHA-256 over the decoded source text encoded as UTF-8, with a leading BOM removed and CRLF/CR normalized to LF. This is a normalized-text fingerprint, not a checksum of the original file bytes. Other whitespace and header edits change it. HTTPS, localhost or a browser context supporting Web Crypto is required for scene commands.
Curve references contain id, mnemonic and unit. Original IDs are zero-based LAS column indices; calculated Vsh is appended after them. Duplicate mnemonics remain distinct. A changed unit, wrong source, unknown setting or invalid limit is rejected before application. Configuration is a full replacement, not a partial patch; repeated application does not add duplicate curves.
In-page JavaScript API
A browser client that is permitted to execute page JavaScript can call window.Petrophysics. This is a local page API, not an HTTP endpoint, a registered WebMCP provider or a remote MCP server.
const api = window.Petrophysics;
const capabilities = api.get_capabilities();
const dataset = await api.inspect_dataset();
const scene = await api.get_scene();
// Edit the returned full configuration, then validate and apply it.
const result = await api.apply_scene(scene);
const checked = await api.inspect_scene();
await api.export_result({format: 'png'});
await api.export_result({format: 'json'});| Command | Input / result |
|---|---|
| get_capabilities() | Synchronous catalog; currentTool and commandsAvailableHere identify this page. |
| import_las({text, filename}) | Parses the supplied LAS text and returns dataset metadata. Browser file chooser also works. No arbitrary URL fetch. |
| inspect_dataset() | Filename, source SHA-256, row count, warnings and each curve’s ID, unit, range, valid/missing/non-positive counts. |
| get_scene() | Returns the full scene JSON. |
| apply_scene(scene) | Checks source and settings, applies the scene, then returns inspect_scene. |
| configure_crossplot(config) | Crossplot page only. Apply a complete crossplot configuration to the current dataset. |
| configure_log_view(config) | Log Viewer page only. Apply a complete four-track configuration. |
| compute_vsh({curve, min, max}) | Log Viewer only. Calculate/update linear Vsh from the user’s GR references; returns inspect_scene. |
| set_selection({rows, operation, colour?}) | Crossplot only. Replace/Add/Remove explicit zero-based numeric source rows. Not depth values. |
| fit_regression({type, width?}) | Crossplot only. Fit selected rows intersected with the filter. Rejects an invalid fit without replacing it. |
| inspect_scene() | Applied scene, release, warnings and numeric display checks. Regression result includes success/failure details. |
| export_result({format, download?}) | png/json/las in plotting tools; json/las in standalone Python; download defaults to true. Returns {filename, format, bytes, blob}; PNG adds width/height. |
| close_dataset() | Clears the current page’s dataset and display. |
All methods except get_capabilities return Promises. A concurrent mutating API request receives BUSY. Wait for a command before the next. API errors have a code when supplied by the scene layer and always include a message; parser/display errors may be plain Errors.
Configuration details
Crossplot: x/y each have curve, type, min and max. Limits can be null (Auto). view is null for the configured full range or an object with xmin/xmax/ymin/ymax. Y min is the bottom endpoint. Points, colouring, filter, selection and regression are separate objects. selection.rows can include numeric pairs outside the current viewport or log-scale domain; regression fits original values, subject to the filter and model’s domain requirements.
Log Viewer: depth names the detected index and ordered top/bottom within its range. tracks contains exactly four objects in left-to-right order, each with curves and pairFill. Every curve includes its own scale, style and baselineFill. Pair a/b are LAS curve IDs belonging to that track. Fill opacity is 0–1 in JSON; the UI shows percent. Inactive pairs may use null references on empty tracks.
Track-edge fills (v7)
Each log curve may include edgeFill: {enabled, side, mode, colour, palette, reverse, opacity}. side is left or right; mode is solid or palette. colour is a #RRGGBB value; palette is one of the advertised palette IDs; reverse is boolean; opacity is 0–1. Include all fields when specifying edgeFill. The palette follows that curve’s Min/Max and scale, with values outside the scale limited to the end colours. The side is always the physical track edge. Omit edgeFill to load an older scene with this fill disabled. Baseline and pair fills remain independent.
Calculated Vsh in log-view scenes
compute_vsh({curve, min, max}) is available in the Log Viewer. Resolve the original GR curve with inspect_dataset and supply its exact id, mnemonic and unit. The command creates or updates one result, preserving the current tracks and depth window, and returns inspect_scene. Inspect the new output reference before assigning it to a track.
When calculated, config.vsh contains {method: "linear", source: {id, mnemonic, unit}, min, max, output: {id, mnemonic, unit}}. Min and max are finite, ordered GR references. The output uses v/v, is appended after original LAS columns, and has a collision-free VSH_GR mnemonic. Original source text and SHA-256 remain unchanged. Loading a scene recalculates Vsh and validates the entire display before applying any changes.
The optional vsh member can be absent or null for no calculation, so old v4 scenes remain compatible. A scene referencing calculated Vsh must include its definition. Whole-file counts are in checks.vsh; inspect_dataset marks the output with derived metadata. The result stays in this page’s memory. Built-in calculation settings store formula inputs; Export LAS downloads calculated curves with the original data so they can be opened in Crossplot.
Density porosity and Archie commands (v6)
New Log Viewer commands: compute_density_porosity({curve, densityUnit, rhoMatrix, rhoFluid, clip}) and compute_archie({porosity, porosityUnit, resistivity, resistivityUnit, rw, a, m, n, clip}). All fields are required. Curve fields use exact {id,mnemonic,unit} references from inspect_dataset. Density units: g/cm3 or kg/m3; porosity: fraction or percent; resistivity: ohm.m or ohm.ft. Endpoints are g/cm³; Rw is Ω·m at formation temperature. Results return inspect_scene.
New scenes use config.calculations, an ordered array of up to three typed definitions. Order fixes output IDs; density dependencies are evaluated before Archie even if listed later. Sources and output references are validated. Vsh-only scenes retain the legacy config.vsh format. Do not combine both formats. checks.calculations reports all inputs and full-file statistics. See the Markdown reference for exact definition shapes and code examples, and the JSON schema.
Use concrete examples
Download the JSON Schema · Four-track scene · Crossplot scene. The runtime additionally checks dataset identity, units, numerical domains and pair references.
PNG exports capture the current display with legends at 2× composition resolution. They are not vector files. Pixel appearance depends on viewport, device pixel ratio and available fonts. The JSON and numerical checks are the record for reproducibility.
Python result snapshots (v9)
Log Viewer may include config.python = {version: 1, script, curves}. Each curve stores name, unit, description, values and source (its producing script). Missing values are null. Arrays retain the original LAS row order and must match its row count. Load validates everything before applying; scripts are never auto-executed.
Python curves follow the original and built-in calculated columns. Resolve their current IDs with inspect_dataset(); the viewer remaps plotted Python IDs when new built-in curves are added. Python names are reserved when naming built-in outputs. Log Viewer accepts project JSON up to 128 MiB; Crossplot retains its 8 MiB import limit. Saved Python projects include result measurements as well as settings. See Python reference.
Python projects across three tools (v11)
Crossplot now accepts optional config.python (the same version-1 script and result snapshot structure used by Log Viewer). Restore attaches result arrays before resolving axis, colouring and filtering references. Standalone Python projects use tool: "python" with config containing only python. Projects remain tool-specific and bound to the original LAS hash. All three tools accept project JSON up to 128 MiB. Importing a project never runs Python code.
Export LAS (v15)
Export LAS is available in Log Viewer, Crossplot, Histogram and Python. It downloads every original parsed curve and all current calculated results. Log Viewer includes Vsh, density porosity and Archie Sw as well as Python results.
Find the button beside Export PNG in the plotting tools, in their expanded plot headers, or beside Save .py in any Python editor, docked or expanded. It becomes available after a LAS loads, even before calculating, and is disabled during Python execution or another project action.
To include a Python curve, call well.add_curve(...) and finish successfully. Earlier committed and restored project results are included. New script, Reset kernel, Stop and a failed run retain previous committed results.
The download contains the full parsed LAS interval and all curves. Track assignments, visible depth limits, axis choices, zoom, filters and point selection do not restrict it. Regression lines are plot objects, not LAS columns.
- Format: LAS 2.0 for legacy numeric input; source-preserving LAS 3.0 for 3.0 input. Original row/column order is retained, with calculated columns appended. The first source column remains the index. No resampling, unit conversion or fixed-decimal rounding is applied.
- Missing samples use a NULL code that does not collide with valid data. Numeric precision, including signed zero, is retained.
- Units, descriptions and parseable well/parameter metadata are included. Duplicate or delimiter-containing names become unique LAS-safe names, with mappings in the notice and
~Othersection. In-page names stay unchanged. - Irregular/repeated indices use STEP 0 without reordering. Missing index samples block export. Import-skipped rows and invalid values cannot be recovered; their counts are reported.
- Maximum export: 128 MiB. Website import limits remain 25 MiB / 250,000 rows / 5 million values. Larger downloads may need an external reader; the notice identifies this.
- LAS contains data, not code, figures or settings. Save a JSON project separately with the original LAS. Reimported calculated curves become ordinary source curves.
Open the exported LAS in another tool to reuse results, or load it while Lock dock is on to share it across tools. Python kernels and projects stay specific to each page. CSV export is not included.
// JavaScript in any of the four tools:
const result = await Petrophysics.export_result({format: "las", download: false});
// Omit download:false to start a download.
console.log(result.rows, result.curveCount, result.calculatedCurveCount);
console.log(result.renamedCurves, result.warnings);
The result also includes blob, filename, format, bytes, pythonCurveCount and nullValue. Calculated count includes built-in and Python curves; Python count is its subset. NO_DATASET means load a LAS; PYTHON_RUNNING means finish or stop the run. There is no Python well.export_las method. Request LAS explicitly; default exports remain PNG in plotting tools and JSON in standalone Python.
Histogram in v18
Histogram reference →. The fourth tool shares Python, LAS export and Lock dock. Use configure_histogram(config), get_histogram_statistics() and set_selection({rows, mode}). Additional report formats are statistics-csv, bins-csv and statistics-json. Python receives all source rows; histogram filters, selection and zoom do not limit its input.
LAS datasets in v22
All four tools share the reader for LAS versions through 3.0. Choose the active table using LAS dataset. Projects record its identity; Lock dock shares that choice and the source file. Numeric plots require numeric data, and Log Viewer requires depth. Python exposes typed fields and all tables with well.datasets and well.dataset(id). Legacy numeric export remains LAS 2.0; LAS 3.0 export retains extra tables and typed fields. LAS formats, syntax and limits.