export_las

petrophys.io.export_las

export_las(
well,
filepath,
version=2.0,
wrap=False,
curves=None,
*,
extra_parameters=None,
other=None,
depth_unit_label=None,
pad_header_by_bytes=False,
**kwargs,
)[source]

Export Well to LAS file.

Parameters:
  • well (Well) – Well object to export

  • filepath (str or Path) – Output file path

  • version (float, optional) – LAS version (1.2 or 2.0, default: 2.0). Another version raises ValueError before the file is opened.

  • wrap (bool, optional) – Write the ~A section wrapped (WRAP. YES): each depth on its own line and the values after it on lines of at most 80 characters (default: False, one line per depth).

  • curves (list of str, optional) – Specific curves to export (default: all)

  • extra_parameters (list of dict, optional) – Additional ~Params entries, each a mapping with mnemonic, value and optional unit and descr keys (e.g. the settings an interpretation used).

  • other (str, optional) – Text appended to the ~Other section.

  • depth_unit_label (str, optional) – Depth unit label to write for DEPT, STRT, STOP and STEP instead of well.depth_unit, e.g. "FT" as a source file wrote it. It must name the same unit.

  • pad_header_by_bytes (bool, default False) – Pad the header columns by each text’s UTF-8 byte length rather than its character count, as the GeoLink eval package’s interpreted LAS were padded (a field name such as SLEIPNER OST with an O-slash then widens its column by one). The bytes written are the same UTF-8.

  • **kwargs – Additional arguments passed to lasio’s LASFile.write (e.g. fmt="%.8f" to control numeric precision). Without fmt the values are written with six significant figures (%.6g), or lasio’s fixed five decimals when reproducing a benchmark context package. The depth index (and STRT, STOP, STEP) is written with the fewest fixed decimals (at most six) that keep every depth, unless column_fmt is given.

Raises:

ValueError – If version is not 1.2 or 2.0, or depth_unit_label names another unit; the file is not opened then. The file is written only once its content is complete.

Notes

Regularly sampled depths are written with their mean spacing as STEP, irregularly sampled ones with STEP 0 as LAS 2.0 requires. Depths are regular when every spacing is within 0.1 % of the first or every depth lies within 1 % of the step of an evenly spaced grid, as depths stored in single precision do. Samples without a finite depth are left out (a LAS index cannot be null). Non-scalar well parameters (dicts, lists) are not written. Header TD (in the depth unit), BS (in inches), BHT and the other ~Well items the LAS reader kept (header.las_well_items) are written to ~Well, and the LAS_OTHER parameter to ~Other. Mnemonics that are not valid in LAS, such as lasio’s GR:1/GR:2 for duplicates, are written with ‘_’ (GR_1, GR_2) with a warning.

Examples

>>> from petrophys.io import export_las
>>> export_las(well, "output.las")