Skip to content

LAS/DLIS Modules

LAS Module

LASMnemonicsID.LAS

create_mnemonic_dict(gamma_names, sp_names, caliper_names, deepres_names, rxo_names, density_names, density_correction_names, neutron_names, dtc_names, dts_names, pe_names)

Function that creates the mnemonic dictionary with the mnemonics per log type.

Source code in src/LASMnemonicsID/LAS/LAS.py
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
def create_mnemonic_dict(
    gamma_names,
    sp_names,
    caliper_names,
    deepres_names,
    rxo_names,
    density_names,
    density_correction_names,
    neutron_names,
    dtc_names,
    dts_names,
    pe_names,
):
    """
    Function that creates the mnemonic dictionary with the mnemonics per log type.
    """
    mnemonic_dict = {
        "gamma": gamma_names,
        "sp": sp_names,
        "caliper": caliper_names,
        "deepres": deepres_names,
        "rxo": rxo_names,
        "density": density_names,
        "density_correction": density_correction_names,
        "neutron": neutron_names,
        "dtc": dtc_names,
        "dts": dts_names,
        "pe": pe_names,
    }
    return mnemonic_dict

parseLAS(input_path, verbose=True, preferred_names=None)

Parse LAS file or all in directory → DataFrame or {filename: df}.

Parameters:

Name Type Description Default
input_path str / Path

LAS file or directory

required
verbose bool

Print info

True
preferred_names dict

Mapping of curve types to preferred column names and preferred original columns. Example: {"deepres": "RT", "deepres_preferred_original": "AT90", "gamma": "GR"} If not provided, defaults to standard petrophysical names.

None

Returns:

Type Description

DataFrame (single) or dict {filename: df} (multiple/dir)

Source code in src/LASMnemonicsID/LAS/LAS.py
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def parseLAS(input_path, verbose=True, preferred_names=None):
    """
    Parse LAS file or all in directory → DataFrame or {filename: df}.

    Args:
        input_path (str/Path): LAS file or directory
        verbose (bool): Print info
        preferred_names (dict, optional): Mapping of curve types to preferred column names and preferred original columns.
            Example: {"deepres": "RT", "deepres_preferred_original": "AT90", "gamma": "GR"}
            If not provided, defaults to standard petrophysical names.

    Returns:
        DataFrame (single) or dict {filename: df} (multiple/dir)
    """
    input_path = Path(input_path)

    # Define default standard names
    std_names = {
        "gamma": "GR",
        "sp": "SP",
        "caliper": "CALI",
        "deepres": "RT",
        "rxo": "RXO",
        "density": "RHOB",
        "density_correction": "DRHO",
        "neutron": "NPHI",
        "dtc": "DT",
        "dts": "DTS",
        "pe": "PEF"
    }

    # Update with user preferences if provided
    if preferred_names:
        std_names.update(preferred_names)

    # Case 1: Single File
    if input_path.is_file() and input_path.suffix.lower() == '.las':
        df = _read_single_las(input_path, verbose, std_names)
        return df if df is not None else None

    # Case 2: Directory (Recursive)
    las_files = list(input_path.rglob("*.las"))
    if not las_files:
        if verbose:
            print(f"No LAS files found in {input_path}")
        return {}

    las_dict = {}
    for las_file in las_files:
        df = _read_single_las(las_file, verbose, std_names)
        if df is not None:
            filename = las_file.name
            las_dict[filename] = df

    # Return single DF if only 1 file found, else dict
    if len(las_dict) == 1:
        return next(iter(las_dict.values()))

    return las_dict

DLIS Module

LASMnemonicsID.DLIS