LASReader¶
petrophys.io.LASReader
- class LASReader(filepath, encoding=None)[source]¶
Reader for LAS (Log ASCII Standard) files.
Examples
>>> reader = LASReader("well_data.las") >>> well = reader.to_well()
Attributes
Return list of curve mnemonics.
Return underlying lasio object.
Return well name from header.
Methods
Get data for a specific curve.
Get unit for a specific curve.
Get unit text from LAS well or parameter header.
Get value from LAS header.
Convert LAS data to Well object.
- __init__(filepath, encoding=None)[source]¶
Initialize LAS reader.
- Parameters:
- Raises:
FileNotFoundError – If the file does not exist.
ValueError – If the file cannot be parsed as LAS, has no ~Curve curves or no ~A section. Comma-delimited ~A rows and lower-case section titles are read.
- property las¶
Return underlying lasio object.
- to_well()[source]¶
Convert LAS data to Well object.
The first ~Curve curve is the depth index (DEPT, TDEP, INDEX, …), as LAS 2.0 defines; a later TVD or DEPTH curve is an ordinary curve. Data rows whose index is null (the header NULL, -999.25 or NaN) are left out with a warning, and an unreadable index value raises ValueError naming its data row. In the curves, unreadable tokens (
-1.#IND,****) are read as NaN with a warning, FortranDexponents are read, and values ofCOMMON_LAS_NULLSthat differ from the header NULL are read as NaN with a warning.Header values with units are stored as:
header.td: total depth in the well’s depth unit (well.depth_unit), converted from the TD unit;header.td_source_unitis the TD unit as written.header.bit_size: bit size in inches, converted from mm, cm or m;header.bit_size_source_unitis the BS unit as written. Without a BS item, numbered bit runs (BS1, BS2, … with the depths BSD1, BSD2, … they drilled) giveheader.bit_size_intervals.
A TD or BS whose unit is not recognised is left unset (None) with a warning; one without a unit is taken to be in the depth unit or in inches. Other ~Well items are kept in
header.las_well_itemsand the ~Other text in theLAS_OTHERparameter, whichpetrophys.io.export_las()writes back. Numeric-looking header values written with leading zeros (LIC . 00123) are kept as text.- Returns:
Well object with loaded data
- Return type: