0% found this document useful (0 votes)
11 views7 pages

AP

The document outlines a Python script for analyzing pressure-time data to identify various reservoir features such as flow regimes, reservoir boundaries, and fracture types. It includes functions for loading data, calculating derivatives, detecting features, and plotting results with annotations. The main function orchestrates the analysis and visualization of the data, providing insights into reservoir behavior.

Uploaded by

Shan Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views7 pages

AP

The document outlines a Python script for analyzing pressure-time data to identify various reservoir features such as flow regimes, reservoir boundaries, and fracture types. It includes functions for loading data, calculating derivatives, detecting features, and plotting results with annotations. The main function orchestrates the analysis and visualization of the data, providing insights into reservoir behavior.

Uploaded by

Shan Shahzad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

Prepare data with time-pressure values


2. The code will automatically detect and annotate:

• Flow regimes (Radial/Linear/Spherical)

• Reservoir boundaries

• Fracture types

• Fault systems

Phase transitions

Import pandas as pd

Import numpy as np
Import matplotlib.pyplot as plt

From scipy.signal import find_peaks

Def load_pressure_data(filepath):

“””Load pressure-time data from CSV file”””

Df = pd.read_csv(filepath)

If {‘Time’, ‘Pressure’}.issubset(df.columns):

Return df[‘Time’], df[‘Pressure’]

Else:

Raise ValueError(“CSV file must contain ‘Time’ and ‘Pressure’ columns”)

Def calculate_derivative(time, pressure):

“””Calculate pressure derivative using Bourdet method”””

Dp = np.gradient(pressure, time)

Tdp = time * dp

Return tdp

Def detect_classed_system(derivative, time):

“””Detect classed system features”””

Features = []

# Detect U-Fault (doubling of derivative)

If any(derivative[i] > 1.8*derivative[i-1] for i in range(1, len(derivative))):

Features.append(‘U-Fault’)

# Detect Partial/Fault (plateau detection)


Slope = np.diff(derivative)

If len(slope[abs(slope) < 0.01]) > 0.1*len(slope):

Features.append(‘Partial/Fault’)

Return features

Def detect_vertical_features(time, pressure, derivative):

“””Detect vertical fracture/horizontal well features”””

Features = []

# Detect Dual Porosity (V-shape pattern)

Peaks, _ = find_peaks(-derivative, prominence=0.1)

If len(peaks) > 1:

Features.append(‘Dual Porosity’)

# Detect Radial Composite (slope change)

Slopes = np.diff(np.log(derivative))/np.diff(np.log(time))

If any(slopes > 0.5):

Features.append(‘Radial Composite’)

# Detect Constant Pressure (zero slope)

If np.mean(np.abs(np.diff(pressure[-10:]))) < 0.1:

Features.append(‘Constant Pressure’)

Return features
Def analyze_reservoir_signatures(time, pressure, derivative):

“””Analyze all reservoir signatures”””

Features = {

‘Classed System’: detect_classed_system(derivative, time),

‘Vertical Fracture/Horizontal Well’: detect_vertical_features(time, pressure, derivative),

‘Flow Phases’: [],

‘Phase Markers’: []

# Phase detection

Phase_boundaries = [0.01, 0.1]

Features[‘Phase Markers’] = [f”Phase boundary at {t}” for t in phase_boundaries]

# Flow regime detection

Log_deriv = np.log(derivative)

Dlog_deriv = np.diff(log_deriv)/np.diff(np.log(time))

If any(dlog_deriv < -0.2):

Features[‘Flow Phases’].append(‘Spherical Flow’)

If any(abs(dlog_deriv) < 0.1):

Features[‘Flow Phases’].append(‘Radial Flow’)

If any(dlog_deriv > 0.5):

Features[‘Flow Phases’].append(‘Linear Flow’)

Return features
Def plot_analysis(time, pressure, derivative, features):

“””Create enhanced log-log plot with annotations”””

Plt.figure(figsize=(12, 8))

# Main plot

Plt.loglog(time, pressure, ‘b-‘, label=’Pressure’)

Plt.loglog(time, derivative, ‘r—‘, label=’Derivative’)

# Add phase markers

For marker in [0.01, 0.1]:

Plt.axvline(marker, color=’gray’, linestyle=’:’, alpha=0.7)

Plt.text(marker, plt.ylim()[0]*1.5, f’t={marker}’, rotation=90, ha=’right’, va=’bottom’)

# Add feature annotations

Annotation_y = max(derivative)*0.8

For i, (category, items) in enumerate(features.items()):

If items:

Plt.text(0.95, 0.85 – i*0.05, f”{category}: {‘, ‘.join(items)}”,

Transform=plt.gca().transAxes, ha=’right’, va=’top’,

Bbox=dict(facecolor=’white’, alpha=0.8))

# Add slope markers

Slope_markers = {

‘Radial Flow’: (0.0, ‘green’),

‘Linear Flow’: (0.5, ‘purple’),

‘Spherical Flow’: (-0.5, ‘orange’)


}

For regime, (slope, color) in slope_markers.items():

X_ref = 0.1

Y_ref = derivative[np.argmin(abs(time – x_ref))]

Dx = np.logspace(-1, 1, 10)

Dy = y_ref * (dx/x_ref)**slope

Plt.loglog(dx, dy, color=color, linestyle=’:’, alpha=0.7)

Plt.text(dx[-1], dy[-1], regime, color=color, ha=’left’, va=’center’)

Plt.xlabel(‘Time (log scale)’)

Plt.ylabel(‘Pressure and Derivative (log scale)’)

Plt.title(‘Advanced Pressure Transient Analysis’)

Plt.legend()

Plt.grid(True, which=’both’, linestyle=’—‘)

Plt.tight_layout()

Plt.show()

Def main():

Time, pressure = load_pressure_data(‘pressure_data.csv’)

Derivative = calculate_derivative(time, pressure)

Features = analyze_reservoir_signatures(time, pressure, derivative)

Print(“Reservoir Analysis Results:”)

For category, items in features.items():

Print(f”\n{category}:”)
For item in items:

Print(f” - {item}”)

Plot_analysis(time, pressure, derivative, features)

If __name__ == “__main__”:

Main()

You might also like