export_context

petrophys.reporting.context.export_context

Also available as petrophys.export_context, petrophys.reporting.export_context

export_context(
data,
output_path=None,
*,
layout='well',
max_bytes=DEFAULT_MAX_BYTES,
max_total_bytes=DEFAULT_MAX_TOTAL_BYTES,
overwrite=False,
context_profile=None,
split_by_lithology=True,
**options,
)[source]

Write a well summary or a fully computed context package.

layout="well" (the default) summarizes one well or interpretation result in one JSON file at output_path; without output_path the summary is returned as a dict (category selects one category’s document). layout="package" interprets every well file of the data folder and writes the context package to the new folder output_path: one folder per category, well and formation (or zone), one JSON file per group. formations, lithology and lithology_codes are the formation tops, lithology intervals and lithology codebook, as for petrophys.read(); a tops or zones table for several wells needs a well column.

Without context_profile, package layouts read the well files in the data folder, apply optional formation and lithology inputs, interpret each well with the supplied workflow_config or defaults, and write context JSON. Files are read by petrophys.read() from their extension: LAS, DLIS, CSV or TSV. pattern selects them (default "*.las"; e.g. "*.dlis" or "*.csv"), and reader_options are passed to the reader, e.g. {"depth_unit": "m"} for a CSV or TSV file, which records no depth unit, or {"step": 0.1524} for a DLIS sampling step in metres.

zones (package layout only) is a CSV or Excel file or a table of your own intervals: one row per zone with its name (zone or name), top and bottom, and a well column when it covers several wells. The zones take the place of the formations, and their documents carry zone_info and zone_name. Setting columns (rw, m …) apply inside their zone, as in petrophys.interpret(well, zones=...).

Interpretation settings for every well of a package are keywords, as for petrophys.interpret() (rw=0.07, sw_model="indonesia"), or a complete workflow_config; keywords override its fields.

In a package each formation (or zone; the whole well without either) is split into lithology groups, runs of samples with one lithology, or with split_by_lithology=False is one group; such a group’s documents give its dominant_lithology.

context_profile computes a published package from its delivery’s raw LAS files with the package’s own pipeline and calculations (petrophys.reporting.context_profiles): "geolink" (data: the raw eval folder; also formations, the NPD picks workbook, and lithology_codes, the GeoLink lithology codebook), "geolink_train" (the LAS_with_petrophys_params raw LAS; also the NPD picks workbook and the GeoLink codebook), "danish" (the Danish raw LAS; also its tops workbook and the codebook) or "costa" (the COSTA LAS, or None for the copies bundled with petrophys). A profile fixes the package’s settings, so workflow_config and the other interpretation options are rejected; only well_names, pattern, formations and lithology_codes apply. Context profiles apply only to the package layout, and only the context JSON is written to output_path.

max_bytes (default 1,000,000) is the largest size of one JSON document and max_total_bytes (default: no limit) that of a whole package; a larger export raises ContextSizeError and writes nothing. A well summary is not written over an existing file unless overwrite=True; a package always needs a folder that does not exist yet. The well layout returns the summary (a dict) or the path of the written file, and the package layout a list with one export result per written context file (source_file, output_file, success, warnings and errors).

Parameters:
  • data (Any)

  • output_path (Any)

  • layout (str)

  • max_bytes (int)

  • max_total_bytes (int | None)

  • overwrite (bool)

  • context_profile (str | None)

  • split_by_lithology (bool)

  • options (Any)