Skip to main content

Automated Well Design from Offset Wells

Learn how to automatically generate optimized well designs by analyzing data from offset wells in your drilling database. By leveraging historical performance data and geological information from nearby wells, you can create data-driven well designs that improve drilling efficiency and reduce risks.

Prerequisites
  • Oliasoft WellDesign API access
  • Python 3.8+ with requests library
  • Access to your drilling database or data warehouse
  • Basic understanding of well trajectory planning

Integration Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│ Drilling │────▶│ Integration │────▶│ Oliasoft │
│ Database │ │ Script │ │ WellDesign API │
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │ │
│ ▼ │
│ ┌──────────────────┐ │
└──────────────▶│ Data Processing │◀────────────┘
│ & Optimization │
└──────────────────┘

Step 1: Retrieve Offset Well Data

First, we'll query your drilling database for relevant offset wells within a specified radius of your proposed well location.

import requests
import json
from datetime import datetime
import numpy as np

def get_offset_wells(lat, lon, radius_km, connection_string):
"""
Retrieve offset wells within specified radius
"""
# Example SQL query (adjust for your database)
query = f"""
SELECT
well_id,
trajectory_data,
formation_tops,
drilling_parameters,
performance_metrics
FROM wells
WHERE
ST_DWithin(
location::geography,
ST_MakePoint({lon}, {lat})::geography,
{radius_km * 1000}
)
ORDER BY completed_date DESC
LIMIT 10
"""

# Execute query and return results
# Implementation depends on your database type
return execute_query(query, connection_string)

Step 2: Analyze Historical Performance

Process the offset well data to identify optimal drilling parameters and trajectory characteristics.

def analyze_offset_performance(offset_wells):
"""
Analyze offset wells to determine optimal parameters
"""
analysis_results = {
'avg_rop': [],
'dogleg_severity': [],
'mud_weights': [],
'casing_points': []
}

for well in offset_wells:
# Extract and analyze key metrics
analysis_results['avg_rop'].append(well['performance_metrics']['rop'])
analysis_results['dogleg_severity'].append(
calculate_max_dogleg(well['trajectory_data'])
)
analysis_results['mud_weights'].append(well['drilling_parameters']['mud_weight'])

# Calculate optimized parameters
optimized_params = {
'target_rop': np.percentile(analysis_results['avg_rop'], 75),
'max_dogleg': np.mean(analysis_results['dogleg_severity']),
'mud_weight_profile': generate_mud_weight_profile(analysis_results['mud_weights'])
}

return optimized_params

Step 3: Generate Well Design via API

Use the analyzed data to create an optimized well design through the Oliasoft WellDesign API.

Create Well Design

def create_automated_well_design(surface_location, target_location, optimized_params, api_key):
"""
Create well design using Oliasoft WellDesign API
"""
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}

# Create initial well design
design_payload = {
"name": f"Auto-Generated Well {datetime.now().strftime('%Y%m%d')}",
"surface_location": {
"latitude": surface_location['lat'],
"longitude": surface_location['lon'],
"elevation": surface_location['elevation']
},
"targets": [{
"name": "Primary Target",
"tvd": target_location['tvd'],
"northing": target_location['northing'],
"easting": target_location['easting']
}],
"trajectory_constraints": {
"max_dogleg_severity": optimized_params['max_dogleg'],
"kickoff_depth": calculate_optimal_kickoff(offset_wells)
}
}

# Create design
response = requests.post(
'https://welldesign.oliasoft.com/api/v1/designs',
headers=headers,
json=design_payload
)

design_id = response.json()['id']

# Add formation data
add_formation_data(design_id, offset_wells, headers)

# Set drilling parameters
set_drilling_parameters(design_id, optimized_params, headers)

return design_id

Step 4: Optimize Trajectory

Fine-tune the trajectory based on offset well learnings.

def optimize_trajectory(design_id, offset_trajectories, api_key):
"""
Optimize trajectory based on offset well analysis
"""
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}

# Analyze collision risks
collision_risks = analyze_collision_risks(design_id, offset_trajectories)

# Generate optimized trajectory
optimized_trajectory = generate_collision_free_trajectory(
design_id,
collision_risks,
min_separation=100 # meters
)

# Update trajectory
response = requests.put(
f'https://welldesign.oliasoft.com/api/v1/designs/{design_id}/trajectory',
headers=headers,
json=optimized_trajectory
)

return response.json()

Complete Integration Example

Here's a complete example that ties everything together:

def automated_well_design_pipeline(project_config):
"""
Complete pipeline for automated well design generation
"""
# Step 1: Get offset wells
offset_wells = get_offset_wells(
lat=project_config['surface_lat'],
lon=project_config['surface_lon'],
radius_km=5,
connection_string=project_config['db_connection']
)

print(f"Found {len(offset_wells)} offset wells for analysis")

# Step 2: Analyze performance
optimized_params = analyze_offset_performance(offset_wells)

# Step 3: Create design
design_id = create_automated_well_design(
surface_location=project_config['surface_location'],
target_location=project_config['target'],
optimized_params=optimized_params,
api_key=project_config['api_key']
)

print(f"Created well design: {design_id}")

# Step 4: Optimize trajectory
final_trajectory = optimize_trajectory(
design_id,
[well['trajectory_data'] for well in offset_wells],
project_config['api_key']
)

# Step 5: Generate report
report = generate_design_report(design_id, offset_wells, optimized_params)

return {
'design_id': design_id,
'report': report,
'offset_wells_analyzed': len(offset_wells)
}

# Execute pipeline
if __name__ == "__main__":
config = {
'api_key': 'your-api-key',
'db_connection': 'your-connection-string',
'surface_location': {
'lat': 60.123,
'lon': 5.456,
'elevation': 25
},
'target': {
'tvd': 3500,
'northing': 1000,
'easting': 500
}
}

result = automated_well_design_pipeline(config)
print(f"Successfully created automated design: {result['design_id']}")

API Request Examples

Making API Requests

import requests

# Get design details
response = requests.get(
f'https://welldesign.oliasoft.com/api/v1/designs/{design_id}',
headers={'Authorization': f'Bearer {api_key}'}
)
design = response.json()

Best Practices

  1. Data Quality: Ensure offset well data is clean and validated before analysis
  2. Parameter Boundaries: Set reasonable limits on automated parameters
  3. Manual Review: Always have engineers review auto-generated designs
  4. Iterative Improvement: Track performance of auto-generated wells to improve algorithms
  5. Error Handling: Implement robust error handling for API calls and data processing

Advanced Features

Machine Learning Integration

Enhance your automated design process with ML models:

from sklearn.ensemble import RandomForestRegressor

def train_rop_prediction_model(historical_data):
"""
Train ML model to predict ROP based on formation and parameters
"""
features = ['formation_type', 'mud_weight', 'wob', 'rpm', 'flow_rate']
X = historical_data[features]
y = historical_data['rop']

model = RandomForestRegressor(n_estimators=100, random_state=42)
model.fit(X, y)

return model

Real-Time Updates

Subscribe to drilling updates to refine designs as new wells are completed:

def subscribe_to_well_updates(callback_url):
"""
Subscribe to receive updates when new offset wells are completed
"""
webhook_config = {
'url': callback_url,
'events': ['well_completed', 'formation_updated'],
'radius_km': 10
}

# Register webhook with your data system
register_webhook(webhook_config)

Troubleshooting

Common issues and solutions:

IssueSolution
No offset wells foundIncrease search radius or adjust location filters
API rate limitsImplement request throttling and batch operations
Trajectory conflictsUse collision avoidance algorithms with safety margins
Data format mismatchesCreate data transformation layer between systems

Next Steps

  • Implement this integration in a test environment
  • Customize analysis parameters for your specific fields
  • Add additional data sources (seismic, production data)
  • Build a UI for reviewing and approving auto-generated designs

Need help with this integration? Contact Oliasoft support or visit our API documentation.