Skip to content

ProcessLithologyToThermalConductivity API Reference

geoloop.lithology.process_lithology.ProcessLithologyToThermalConductivity

Handles the calculation procedure of subsurface thermal conductivities based on lithological data.

Attributes:

Name Type Description
lithology_props_df DataFrame

DataFrame containing physical properties and thermal parameters for different lithologies, adopted from Hantschel & Kauerauf (2009).

borehole_df DataFrame

DataFrame containing borehole lithological description (depth and lithology data).

Tg float

Surface temperature (in °C).

Tgrad float

Average geothermal gradient (in °C/km).

z_Tg float

Depth at which the (sub)surface temperature Tg is measured.

phi_scale float

Scaling factor for porosity over depth. Induces uniform variation in porosity values during sampling of different porosity-depth profiles in a stochastic (MC) simulation.

lithology_scale float

Scaling factor for lithology fraction over depth. Induces uniform variation in lithology fraction values during sampling of different porosity-depth profiles in a stochastic (MC) simulation.

lithology_error float

Depth-independent error applied to lithology fraction during sampling of different porosity-depth profiles in a stochastic (MC) simulation.

nsamples int

Number of thermal conductivity-depth profiles to generate and store.

basecase bool

Whether to run the simulation in "base case" mode. In base case mode, no scaling and/or error values are applied to the porosity and lithology profiles in the thermal conductivity calculation.

out_dir str

Path to the directory where files with subsurface properties are saved.

out_table str

Name of the file (.h5) for storing the table with subsurface properties.

read_from_table bool

Whether to read precomputed results of subsurface thermal conductivities from an existing file or compute real-time.

Raises:

Type Description
ValueError

If any required input is missing or incompatible.

create_lithology_props_dict

create_lithology_props_dict() -> (
    dict[int, ThermalConductivityCalculator]
)

Creates a dictionary of physical and thermal properties for different lithologies, in the correct format for the thermal conductivity calculations. Property values are adopted from the Hantschel & Kauerauf (HK) database.

Dictionary maps the physical and thermal properties from the HK classification to the corresponding variables in the thermal conductivity calculations.

Returns:

Type Description
dict

Mapping lithology ID -> ThermalConductivityCalculator.

create_borehole_lithology_props_classification

create_borehole_lithology_props_classification() -> (
    pd.DataFrame
)

Merge borehole lithology sheet with HK classification table and create columns with HK IDs for lithology a and b.

Returns:

Type Description
DataFrame

DataFrame containing lithological classification along borehole, with thermal properties and added columns 'Lithology_ID_a' and 'Lithology_ID_b'.

from_config classmethod

from_config(
    config: LithologyConfig,
) -> ProcessLithologyToThermalConductivity

Create a ProcessLithologyToThermalConductivity instance from a configuration dict.

Parameters:

Name Type Description Default
config LithologyConfig

Configuration dictionary with required keys.

required

Returns:

Type Description
ProcessLithologyToThermalConductivity

Initialized instance.

create_single_thermcon_profile

create_single_thermcon_profile(
    isample: int,
) -> ThermalConductivityResults

Calculates depth-dependent subsurface properties, for a specific sample of the loaded or calculated subsurface properties table.

Parameters:

Name Type Description Default
isample int

Sample index (0 is basecase).

required

Returns:

Type Description
ThermalConductivityResults

Object with arrays depth, lithology fraction, porosity and kh_bulk.

create_multi_thermcon_profiles

create_multi_thermcon_profiles() -> None

Create thermal conductivity profiles for all requested (stochastic) samples (or read from .h5 file).

If read_from_table is True, read data from out_dir/out_table. Otherwise compute samples in run time.

Returns:

Type Description
None (results are stored internally).

get_thermcon_sample_profile

get_thermcon_sample_profile(
    isample: int,
) -> ThermalConductivityResults

Retrieves depth-dependent subsurface properties for a specific sample in the precomputed table.

Parameters:

Name Type Description Default
isample int

Sample index (use -1 to request basecase which is index 0).

required

Returns:

Type Description
ThermalConductivityResults

Results container for the requested sample.

save_thermcon_sample_profiles

save_thermcon_sample_profiles() -> None

Save the computed sample profiles to a NetCDF (.h5) file using xarray.

The dataset will contain variables: - kh_bulk (depth x n_samples) - phi (depth x n_samples) - lithology_a_fraction (depth x n_samples)

Returns:

Type Description
None (results are saved directly to the specified output file).

get_start_end_depths

get_start_end_depths()

Retrieves the start and end depths for all intervals with different subsurface properties.

Returns:

Type Description
(zstart, zend) : tuple of numpy arrays

zstart: start depth of each segment (first element 0) zend: end depth array taken from results