Plotter module

quick_pp.plotter.plotter.update_fluid_contacts(well_data, well_config: dict)[source]

Update fluid flags based on fluid contacts.

Parameters:
  • well_data (pd.DataFrame) – DataFrame containing well log data, including a ‘TVD’ column.

  • well_config (dict) – A dictionary defining the fluid contacts for a specific zone (e.g., GOC, OWC).

Returns:

The input DataFrame with added ‘OIL_FLAG’, ‘GAS_FLAG’, ‘WATER_FLAG’, and ‘FLUID_FLAG’ columns.

Return type:

pd.DataFrame

quick_pp.plotter.plotter.generate_zone_config(zones: list = None)[source]

Generate zone configuration.

Parameters:

zones (list, optional) – List of zone names. Defaults to [‘ALL’].

Returns:

Zone configuration

Return type:

dict

quick_pp.plotter.plotter.update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict)[source]

Update zone configuration with fluid contacts.

Parameters:
  • zone_config (dict) – Dictionary containing zone configuration.

  • zone (str) – Zone name for which configuration is to be updated.

  • fluid_contacts (dict) – Fluid contacts for the specified zone.

Returns:

Updated zone configuration

Return type:

dict

quick_pp.plotter.plotter.generate_well_config(well_names: list = None)[source]

Generate well configuration.

Parameters:

well_names (list, optional) – List of well names. Defaults to [‘X’].

Returns:

Well configuration

Return type:

dict

quick_pp.plotter.plotter.update_well_config(well_config: dict, well_name: str, zone: str = '', fluid_contacts: dict = None, sorting: int = 0)[source]

Update well configuration with fluid contacts.

Parameters:
  • well_config (dict) – Dictionary containing well sorting and fluid contacts.

  • well_name (str) – Well name for which configuration is to be updated.

  • zone (str) – Zone name for which configuration is to be updated.

  • fluid_contacts (dict) – Fluid contacts for the specified zone.

  • sorting (int, optional) – Sorting of the wells on the stick plot. Defaults to None.

Returns:

Updated well configuration

Return type:

dict

quick_pp.plotter.plotter.assert_well_config_structure(well_config)[source]

Assert well configuration structure.

Parameters:

well_config (dict) – Dictionary containing well sorting and fluid contacts.

quick_pp.plotter.plotter.stick_plot(data, well_config: dict, zone: str = 'ALL')[source]

Generate a multi-well stick plot to visualize fluid distribution.

This function creates a series of vertical tracks, one for each well, displaying the Bulk Volume of Oil (BVO) against True Vertical Depth (TVD). It shades the background of each track based on the fluid flags (oil, gas, water) derived from the fluid contacts specified in the well_config.

Parameters:
  • data (pd.DataFrame) – DataFrame with log data for one or more wells. Must include ‘WELL_NAME’, ‘TVD’, ‘PHIT’, and ‘SWT’.

  • well_config (dict) – A configuration dictionary where keys are well names. Each well’s value is a dictionary containing a ‘sorting’ integer and a ‘zones’ dictionary. The ‘zones’ dictionary maps zone names to their respective fluid contacts.

  • zone (str, optional) – The specific zone to plot. Defaults to ‘ALL’.

quick_pp.plotter.plotter.neutron_density_xplot(nphi, rhob, dry_min1_point: tuple, dry_clay_point: tuple, fluid_point: tuple = (1.0, 1.0), wet_clay_point: tuple = (), dry_silt_point: tuple = (), responsive: bool = True, **kwargs)[source]

Neutron-Density crossplot with lithology lines based on specified end points. This plot is a standard petrophysical tool used to identify lithology and porosity.

Parameters:
  • nphi (np.ndarray or float) – Neutron porosity log values.

  • rhob (np.ndarray or float) – Bulk density log values.

  • dry_min1_point (tuple) – (NPHI, RHOB) coordinates for the primary matrix mineral.

  • dry_clay_point (tuple) – (NPHI, RHOB) coordinates for dry clay.

  • fluid_point (tuple, optional) – (NPHI, RHOB) coordinates for the formation fluid. Defaults to (1.0, 1.0).

  • wet_clay_point (tuple, optional) – (NPHI, RHOB) coordinates for wet clay. Defaults to ().

  • dry_silt_point (tuple, optional) – (NPHI, RHOB) coordinates for dry silt. Defaults to ().

Returns:

The generated Neutron-Density crossplot figure.

Return type:

matplotlib.figure.Figure

Well Log module

quick_pp.plotter.well_log.add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs)[source]

Add predefined traces to a Plotly figure.

Parameters:
  • fig (plotly.graph_objects.Figure) – The Plotly figure to add traces to.

  • df (pd.DataFrame) – The DataFrame containing the log data.

  • index (pd.Series) – The depth index for the y-axis.

  • no_of_track (int) – The total number of tracks in the plot.

  • trace_defs (dict) – A dictionary defining the traces and their styles.

  • **kwargs – Additional keyword arguments to pass to go.Scatter.

Returns:

The figure with the added traces.

Return type:

plotly.graph_objects.Figure

quick_pp.plotter.well_log.add_crossover_traces(df)[source]

Calculate and add gas crossover shading traces to the DataFrame.

If ‘NPHI’ and ‘RHOB’ are present, this function calculates the region where neutron porosity crosses over bulk density, indicating potential gas zones. It adds ‘RHOB_ON_NPHI_SCALE’, ‘GAS_XOVER_TOP’, and ‘GAS_XOVER_BOTTOM’ columns to the DataFrame for plotting.

Returns:

The DataFrame with added crossover-related columns.

Return type:

pd.DataFrame

quick_pp.plotter.well_log.add_rock_flag_traces(df)[source]

Prepare rock flag data for plotting by one-hot encoding.

If a ‘ROCK_FLAG’ column exists, this function: 1. Converts it to integer type. 2. Assigns a unique color to each flag value in COLOR_DICT. 3. One-hot encodes the ‘ROCK_FLAG’ column into separate ‘ROCK_FLAG_X’ columns.

Returns:

The DataFrame with one-hot encoded rock flag columns.

Return type:

pd.DataFrame

quick_pp.plotter.well_log.fix_missing_volumetrics(df)[source]

Ensure standard volumetric columns exist and fill NaNs.

Iterates through a predefined list of volumetric curve names. If a column exists, it fills missing values with 0. If it doesn’t exist, it is not added.

Returns:

The DataFrame with NaNs filled in volumetric columns.

Return type:

pd.DataFrame

quick_pp.plotter.well_log.fix_missing_depths(df: DataFrame) DataFrame[source]

Resamples a DataFrame to a regular depth interval.

This function addresses gaps in depth data by creating a complete, evenly-spaced depth range and merging the original data onto it. It uses the most common depth interval found in the data as the new step.

Parameters:

df (pd.DataFrame) – The input DataFrame, which must contain a ‘DEPTH’ column.

Returns:

A new, resampled DataFrame with consistent depth steps.

Returns an empty DataFrame if the input is invalid.

Return type:

pd.DataFrame

quick_pp.plotter.well_log.plotly_log(well_data, well_name: str = '', depth_uom='', trace_defs: dict = None, xaxis_defs: dict = None, column_widths: list = None)[source]

Generate a multi-track well log plot using Plotly.

This function creates a comprehensive, interactive well log plot with multiple tracks, supporting various log types, custom styling, and special overlays like gas crossover, rock flags, and formation tops.

Parameters:
  • well_data (pd.DataFrame) – The primary DataFrame containing well log data. It must include a ‘DEPTH’ column.

  • well_name (str, optional) – The name of the well, to be displayed as the plot title. Defaults to ‘’.

  • depth_uom (str, optional) – The unit of measurement for depth (e.g., ‘m’, ‘ft’). Defaults to “”.

  • trace_defs (dict, optional) – A dictionary to define and style traces. If not provided, defaults to TRACE_DEFS from the config.

  • xaxis_defs (dict, optional) – A dictionary to configure x-axes. If not provided, defaults to XAXIS_DEFS from the config.

  • column_widths (list, optional) – A list of relative widths for each track. If empty, all tracks will have equal width. Defaults to [].

Returns:

A Plotly Figure object representing the well log plot.

Return type:

go.Figure

Example

>>> from quick_pp.plotter import plotly_log
>>> fig = plotly_log(well_df, well_name='MyWell', depth_uom='m')
>>> fig.show()