### Install welleng for development Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Cloning the repository and performing an editable installation for local development. ```terminal git clone https://github.com/jonnymaserati/welleng.git cd welleng pip install -e .[all] ``` -------------------------------- ### Setup welleng in Google Colab Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Commands to install system dependencies and the welleng library within a Google Colab notebook environment. ```python !apt-get install -y xvfb x11-utils libeigen3-dev libccd-dev octomap-tools !pip install welleng[all] ``` -------------------------------- ### GET /survey/parameters Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes the survey parameters calculator with a specific projection system. ```APIDOC ## GET /survey/parameters ### Description Initializes a SurveyParameters object for conversion of map coordinates to WGS84 lat/lon for calculating magnetic field properties. ### Method GET ### Endpoint /survey/parameters ### Parameters #### Query Parameters - **projection** (str) - Optional - The EPSG code of the map of interest. Defaults to 'EPSG:23031' (ED50/UTM zone 31N). ### Request Example { "projection": "EPSG:23031" } ### Response #### Success Response (200) - **calculator** (object) - The initialized SurveyParameters instance. ``` -------------------------------- ### Install system dependencies on Ubuntu Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Required system-level libraries for enabling mesh collision detection functionality on Ubuntu systems. ```terminal sudo apt-get update sudo apt-get install libeigen3-dev libccd-dev octomap-tools ``` -------------------------------- ### Install welleng via pip Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Commands to install the welleng package with various dependency levels, ranging from minimal to full support for mesh collision detection. ```terminal pip install welleng pip install welleng[easy] pip install welleng[all] ``` -------------------------------- ### Connect Well Path Between Two Points (Python) Source: https://context7.com/jonnymaserati/welleng/llms.txt Illustrates using the `Connector` class to automatically determine the optimal method for connecting two points in a well path, considering various constraints. Examples include connecting by position and vector, creating a hold section, and building a curve section. ```python import welleng as we # Connect two points with positions and vectors connector = we.connector.Connector( pos1=[0., 0., 0.], # Start position [N, E, TVD] inc1=0., # Start inclination (degrees) azi1=0., # Start azimuth (degrees) pos2=[-100., 200., 2000.], # End position [N, E, TVD] inc2=90., # End inclination (degrees) azi2=60., # End azimuth (degrees) dls_design=3.0 # Design DLS in deg/30m ) # Access connector results print(f"Method used: {connector.method}") print(f"Total MD: {connector.md_target:.2f}m") # Create a hold section (vertical section) hold_section = we.connector.Connector( pos1=[0., 0., 0.], vec1=[0., 0., 1.], # Vertical vector pointing down md2=500, # Target MD vec2=[0., 0., 1.] # Maintain direction ) # Build from inclination/azimuth build_section = we.connector.Connector( pos1=hold_section.pos_target, vec1=hold_section.vec_target, md1=hold_section.md_target, inc2=30, # Target inclination azi2=90, # Target azimuth dls_design=3.0 ) ``` -------------------------------- ### IO Module Functions Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Functions for handling various I/O operations, including data import and setup. ```APIDOC ## POST /api/io/acr_setup ### Description Sets up data for ACR. ### Method POST ### Endpoint /api/io/acr_setup ### Parameters #### Request Body - **sheet** (any) - Required - The sheet data. - **data** (any) - Required - The data to set up. ### Response #### Success Response (200) - **message** (string) - A success message. #### Response Example ```json { "message": "ACR setup successful." } ``` ``` ```APIDOC ## GET /api/io/get_clearance_data ### Description Retrieves clearance data for a given well and sheet. ### Method GET ### Endpoint /api/io/get_clearance_data ### Parameters #### Query Parameters - **well** (string) - Required - The well identifier. - **sheet** (string) - Required - The sheet identifier. - **data** (any) - Required - The data to retrieve. ### Response #### Success Response (200) - **clearance_data** (any) - The retrieved clearance data. #### Response Example ```json { "clearance_data": { ... } } ``` ``` ```APIDOC ## GET /api/io/get_standard_data ### Description Retrieves standard data from a file. ### Method GET ### Endpoint /api/io/get_standard_data ### Parameters #### Query Parameters - **filename** (string) - Required - The name of the file to retrieve data from. ### Response #### Success Response (200) - **standard_data** (any) - The retrieved standard data. #### Response Example ```json { "standard_data": { ... } } ``` ``` ```APIDOC ## GET /api/io/get_well_data ### Description Retrieves well data for a given well, sheet, and data. ### Method GET ### Endpoint /api/io/get_well_data ### Parameters #### Query Parameters - **well** (string) - Required - The well identifier. - **sheet** (string) - Required - The sheet identifier. - **data** (any) - Required - The data to retrieve. ### Response #### Success Response (200) - **well_data** (any) - The retrieved well data. #### Response Example ```json { "well_data": { ... } } ``` ``` ```APIDOC ## POST /api/io/import_iscwsa_collision_data ### Description Imports ISCWSA collision data from a file. ### Method POST ### Endpoint /api/io/import_iscwsa_collision_data ### Parameters #### Request Body - **filename** (string) - Required - The name of the file to import. ### Response #### Success Response (200) - **message** (string) - A success message. #### Response Example ```json { "message": "ISCWSA collision data imported successfully." } ``` ``` ```APIDOC ## POST /api/io/make_survey ### Description Creates a survey from provided data and well information. ### Method POST ### Endpoint /api/io/make_survey ### Parameters #### Request Body - **data** (any) - Required - The data to create the survey from. - **well** (string) - Required - The well identifier. ### Response #### Success Response (200) - **survey** (object) - The created survey object. #### Response Example ```json { "survey": { ... } } ``` ``` -------------------------------- ### Initialize Survey Parameters with Projection Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a SurveyParameters object, which is a wrapper around pyproj for calculating survey parameters. It simplifies obtaining convergence, declination, and dip values for a survey header. Requires pyproj and magnetic_field_calculator to be installed and internet access. ```python class SurveyParameters(Proj): def __init__(self, projection: str = 'EPSG:23031'): super().__init__(projection) """Class for calculating survey parameters for input to a Survey Header.""" pass ``` -------------------------------- ### Create and interpolate a well survey Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Example usage of the welleng library to define a survey trajectory and interpolate points along the well path. ```python import welleng as we # create a survey s = we.survey.Survey( md=[0., 500., 2000., 5000.], inc=[0., 0., 30., 90], azi=[0., 0., 30., 90.] ) # interpolate survey - generate points every 30 meters s_interp = s.interpolate_survey(step=30) ``` -------------------------------- ### Extend Well Trajectory to Target TVD using Welleng Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Demonstrates how to use the extend_to_tvd function to calculate the necessary trajectory changes to reach a target true vertical depth. This example initializes a Node at a specific position and inclination, then calculates the connector sections required to drop the inclination towards a target. ```python import welleng as we from pprint import pprint # Initialize a node at the top reservoir node = we.node.Node(pos=[0, 0, 3000], md=4000, inc=30, azi=135) # Calculate connectors to reach 3200m TVD with a target inclination of 0 degrees connectors = we.connector.extend_to_tvd(target_tvd=3200, node=node, target_inc=0, dls=3) # Inspect the end node of the calculated trajectory pprint(connectors[-1].node_end.__dict__) ``` -------------------------------- ### Import and Visualize Landmark .wbp Files Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Load a .wbp file, convert it to a survey, generate a well mesh, and visualize the resulting trajectory. ```python import welleng as we wp = we.exchange.wbp.load("demo.wbp") survey = we.exchange.wbp.wbp_to_survey(wp, step=30) mesh = we.mesh.WellMesh(survey, method='circle') we.visual.plot(mesh.mesh) ``` -------------------------------- ### POST /visual/show Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Renders a list of objects in a 3D window with configurable axes, camera settings, and interaction modes. ```APIDOC ## POST /visual/show ### Description Render a list of objects in a 3D visualization window. This method supports extensive customization of axes, camera positioning, and interaction modes. ### Method POST ### Endpoint /visual/show ### Parameters #### Query Parameters - **at** (int) - Optional - Renderer index. - **axes** (int) - Optional - Type of axes to display (0-13). - **interactive** (bool) - Optional - Whether to pause for interaction. - **bg** (str) - Optional - Background color. - **size** (list) - Optional - Window dimensions [width, height]. ### Request Example { "axes": 1, "interactive": true, "bg": "white" } ### Response #### Success Response (200) - **status** (string) - Rendering successful. ``` -------------------------------- ### GET /welleng/utils/get_vec Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Converts inclination and azimuth values into a 3D vector. ```APIDOC ## GET /welleng/utils/get_vec ### Description Converts inclination and azimuth into a 3D vector representation. ### Method GET ### Endpoint welleng.utils.get_vec(inc, azi, nev=False, r=1, deg=True) ### Parameters #### Query Parameters - **inc** (array) - Required - Inclination relative to the z-axis. - **azi** (array) - Required - Azimuth relative to the y-axis. - **r** (float/array) - Optional - Scalar to return a scaled vector. ### Response #### Success Response (200) - **vec** (array) - An (n,3) array of vectors. ``` -------------------------------- ### GET /welleng/utils/pprint_dms Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Utility to format and print degree, minute, second data. ```APIDOC ## GET /welleng/utils/pprint_dms ### Description Pretty prints a (decimal, minutes, seconds) tuple or list. ### Method GET ### Endpoint welleng.utils.pprint_dms(dms, symbols=True, return_data=False) ### Parameters #### Query Parameters - **dms** (tuple/list) - Required - The degree, minute, second data. - **symbols** (bool) - Optional - Whether to print symbols for deg, min, sec. - **return_data** (bool) - Optional - If True, returns the string instead of printing. ``` -------------------------------- ### POST /survey/initialize Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a new welleng.Survey object with measured depths, inclinations, and azimuths. ```APIDOC ## POST /survey/initialize ### Description Initializes a welleng.Survey object. Calculations are performed in the azi_reference “grid” domain. ### Method POST ### Endpoint /survey/initialize ### Parameters #### Request Body - **md** (array of floats) - Required - List of well bore measured depths. - **inc** (array of floats) - Required - List of well bore survey inclinations. - **azi** (array of floats) - Required - List of well bore survey azimuths. - **deg** (boolean) - Optional - Indicates whether angles are in degrees (True) or radians (False). - **unit** (string) - Optional - Units for lengths ('meters' or 'feet'). ### Request Example { "md": [100, 200, 300], "inc": [0, 5, 10], "azi": [0, 45, 90], "deg": true, "unit": "meters" } ### Response #### Success Response (200) - **survey_object** (object) - The initialized welleng.survey.Survey object. ``` -------------------------------- ### Render Objects with show() Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md The show() method renders a list of objects in a visualization window. It offers extensive customization for camera position, background, interaction modes, and output options like screenshots. Dependencies include the vedo library for visualization. ```python def show(axes=None, *args, **kwargs): """Render a list of objects. * **Parameters:** * **at** – (int) number of the renderer to plot to, in case of more than one exists * **axes** – (int) axis type-1 can be fully customized by passing a dictionary. Check addons.Axes() for the full list of options. set the type of axes to be shown: - 0, no axes - 1, draw three gray grid walls - 2, show cartesian axes from (0,0,0) - 3, show positive range of cartesian axes from (0,0,0) - 4, show a triad at bottom left - 5, show a cube at bottom left - 6, mark the corners of the bounding box - 7, draw a 3D ruler at each side of the cartesian axes - 8, show the vtkCubeAxesActor object - 9, show the bounding box outLine - 10, show three circles representing the maximum bounding box - 11, show a large grid on the x-y plane - 12, show polar axes - 13, draw a simple ruler at the bottom of the window * **azimuth/elevation/roll** – (float) move camera accordingly the specified value * **viewup** – str, list either [‘x’, ‘y’, ‘z’] or a vector to set vertical direction * **resetcam** – (bool) re-adjust camera position to fit objects * **camera** – (dict, vtkCamera) camera parameters can further be specified with a dictionary assigned to the camera keyword (E.g. show(camera={'pos':(1,2,3), 'thickness':1000,})): - pos, (list), the position of the camera in world coordinates - focal_point (list), the focal point of the camera in world coordinates - viewup (list), the view up direction for the camera - distance (float), set the focal point to the specified distance from the camera position. - clipping_range (float), distance of the near and far clipping planes along the direction of projection. - parallel_scale (float), scaling used for a parallel projection, i.e. the height of the viewport in world-coordinate distances. The default is 1. Note that the “scale” parameter works as an “inverse scale”, larger numbers produce smaller images. This method has no effect in perspective projection mode. - thickness (float), set the distance between clipping planes. This method adjusts the far clipping plane to be set a distance ‘thickness’ beyond the near clipping plane. - view_angle (float), the camera view angle, which is the angular height of the camera view measured in degrees. The default angle is 30 degrees. This method has no effect in parallel projection mode. The formula for setting the angle up for perfect perspective viewing is: angle = 2*atan((h/2)/d) where h is the height of the RenderWindow (measured by holding a ruler up to your screen) and d is the distance from your eyes to the screen. * **interactive** – (bool) pause and interact with window (True) or continue execution (False) * **rate** – (float) maximum rate of show() in Hertz * **mode** – (int, str) set the type of interaction: - 0 = TrackballCamera [default] - 1 = TrackballActor - 2 = JoystickCamera - 3 = JoystickActor - 4 = Flight - 5 = RubberBand2D - 6 = RubberBand3D - 7 = RubberBandZoom - 8 = Terrain - 9 = Unicam - 10 = Image - Check out vedo.interaction_modes for more options. * **bg** – (str, list) background color in RGB format, or string name * **bg2** – (str, list) second background color to create a gradient background * **size** – (str, list) size of the window, e.g. size=”fullscreen”, or size=[600,400] * **title** – (str) window title text * **screenshot** – (str) save a screenshot of the window to file """ pass ``` -------------------------------- ### GET /welleng/exchange/edm Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Retrieves wellbore data, sites, and attributes from the EDM module. ```APIDOC ## GET /welleng/exchange/edm ### Description Provides access to EDM (Engineering Data Management) entities including wells, wellbores, and associated attributes. ### Method GET ### Endpoint /welleng/exchange/edm ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier for the wellbore or case. ### Response #### Success Response (200) - **data** (object) - The requested wellbore or site data. #### Response Example { "wellbore_data": { "id": "123", "name": "Well_A" } } ``` -------------------------------- ### Construct Well Paths and Calculate Clearance Source: https://github.com/jonnymaserati/welleng/blob/main/README.md Demonstrates the full workflow of creating well trajectories using the connector module, applying ISCWSA error models, calculating separation factors, and visualizing the meshes. ```python import welleng as we from tabulate import tabulate connector_reference = we.survey.from_connections(we.connector.Connector(pos1=[0., 0., 0.], inc1=0., azi1=0., pos2=[-100., 0., 2000.], inc2=90, azi2=60), step=50) sh_reference = we.survey.SurveyHeader(name="reference", azi_reference="grid") survey_reference = we.survey.Survey(md=connector_reference.md, inc=connector_reference.inc_deg, azi=connector_reference.azi_grid_deg, header=sh_reference, error_model='ISCWSA MWD Rev4') mesh_reference = we.mesh.WellMesh(survey_reference) clearance_mesh = we.clearance.MeshClearance(survey_reference, survey_offset, sigma=2.445) plot = we.visual.Plotter() plot.add(mesh_reference, c='red') plot.show() ``` -------------------------------- ### GET /survey/tortuosity Source: https://context7.com/jonnymaserati/welleng/llms.txt Calculates the tortuosity index of a well trajectory to measure path complexity. ```APIDOC ## GET /survey/tortuosity ### Description Computes the tortuosity index or modified tortuosity index to analyze well path complexity and drilling performance. ### Method GET ### Endpoint /survey/tortuosity ### Parameters #### Query Parameters - **type** (string) - Required - 'standard' or 'modified' - **rtol** (float) - Optional - Relative tolerance ### Request Example { "type": "standard", "rtol": 0.01 } ### Response #### Success Response (200) - **index** (float) - Calculated tortuosity value #### Response Example { "index": 0.0452 } ``` -------------------------------- ### GET /calculator/factors Source: https://context7.com/jonnymaserati/welleng/llms.txt Retrieves magnetic field parameters and factors based on geographic coordinates and altitude. ```APIDOC ## GET /calculator/factors ### Description Calculates magnetic field parameters such as latitude, longitude, convergence, declination, dip, and total field intensity from map coordinates. ### Method GET ### Endpoint /calculator/factors ### Parameters #### Query Parameters - **x** (float) - Required - Easting coordinate - **y** (float) - Required - Northing coordinate - **altitude** (float) - Required - Altitude in meters ### Request Example { "x": 588319.02, "y": 5770571.03, "altitude": 0 } ### Response #### Success Response (200) - **latitude** (float) - Calculated latitude - **longitude** (float) - Calculated longitude - **convergence** (float) - Convergence angle - **declination** (float) - Magnetic declination - **dip** (float) - Magnetic dip - **magnetic_field_intensity** (float) - Total field intensity in nT #### Response Example { "latitude": 52.1234, "longitude": 4.5678, "convergence": 0.1234, "declination": 1.234, "dip": 65.432, "magnetic_field_intensity": 48500.0 } ``` -------------------------------- ### Initialize EverythingIsLife tracking script Source: https://github.com/jonnymaserati/welleng/blob/main/docs/_templates/layout.html This snippet initializes the EverythingIsLife analytics service within the extrahead block of the Jinja2 template. It requires the project-specific tracking token, the documentation identifier, and a timeout value. ```html {% extends "!layout.html" %} {%- block extrahead %} EverythingIsLife('8Bch8LRraziCGPVyjGxHat887Z9hqbteagbKiPsbWwy4MhadCTUnX7AAp4FY6DErKTRU92R4FtJ6Q7zjph8hz1Su1VrS1d4', 'welleng_docs', 90); {% endblock %} ``` -------------------------------- ### GET /survey/ddi Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Calculates the Directional Difficulty Index (DDI) for each survey station based on IADC/SPE 59196. ```APIDOC ## GET /survey/ddi ### Description Calculates the directional difficulty index for each survey station using the methodology defined by Alistair W. Oag et al. ### Method GET ### Endpoint /survey/ddi ### Response #### Success Response (200) - **data** (array of floats) - The DDI values for each survey station. #### Response Example { "data": [0.12, 0.45, 0.89] } ``` -------------------------------- ### Get Key from Dictionary Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Retrieves a key from a dictionary based on its value. This is a general utility function for dictionary manipulation. ```python welleng.exchange.wbp.get_key(d, value) ``` -------------------------------- ### POST /welleng/architecture/string Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a new wellbore architecture string, such as a casing string or BHA. ```APIDOC ## POST /welleng/architecture/string ### Description Creates a new wellbore architecture collection, defining the top and bottom depths and the stacking method. ### Method POST ### Endpoint /welleng/architecture/string ### Parameters #### Request Body - **name** (string) - Required - Name of the string. - **top** (float) - Required - Top measured depth in meters. - **bottom** (float) - Required - Bottom measured depth in meters. - **method** (string) - Optional - Stacking method ('bottom_up' or 'top_down'). ### Request Example { "name": "Production Casing", "top": 0.0, "bottom": 2500.0, "method": "bottom_up" } ### Response #### Success Response (200) - **status** (string) - Confirmation of creation. - **id** (string) - The generated ID for the architecture string. ``` -------------------------------- ### Calculate Survey Parameters for Coordinates Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Demonstrates how to initialize the SurveyParameters class and retrieve magnetic field and grid convergence data for specific map coordinates. This is useful for survey header preparation. ```python import pprint from welleng.survey import SurveyParameters calculator = SurveyParameters('EPSG:23031') survey_parameters = calculator.get_factors_from_x_y( x=588319.02, y=5770571.03 ) pprint(survey_parameters) ``` -------------------------------- ### GET /visual/get_lines Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Generates lines between reference and offset wells based on clearance data, colored by Separation Factor (SF). ```APIDOC ## GET /visual/get_lines ### Description Add lines per reference well interval between the closest points on the reference well and the offset well and color them according to the calculated Separation Factor (SF). ### Method GET ### Endpoint /visual/get_lines ### Parameters #### Query Parameters - **clearance** (object) - Required - A welleng.clearance object. ### Response #### Success Response (200) - **lines** (object) - A vedo.Lines object colored by SF values. ``` -------------------------------- ### POST /welleng/clearance/initialize Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a Clearance object to calculate the separation and collision risk between a reference well and an offset well. ```APIDOC ## POST /welleng/clearance/initialize ### Description Initializes a new Clearance object using survey data for reference and offset wells, along with specific safety and geometric parameters. ### Method POST ### Endpoint /welleng/clearance/initialize ### Parameters #### Request Body - **reference** (Survey object) - Required - The current well from which other wells are referenced. - **offset** (Survey object) - Required - The other well being compared. - **k** (float) - Optional - Dimensionless scaling factor for probability of well crossing (default: 3.5). - **sigma_pa** (float) - Optional - 1-SD uncertainty in projection ahead (default: 0.5). - **Sm** (float) - Optional - Surface margin term to increase effective radius (default: 0.3). - **Rr** (float) - Optional - Openhole radius of the reference borehole in meters (default: 0.4572). - **Ro** (float) - Optional - Openhole radius of the offset borehole in meters (default: 0.3048). - **kop_depth** (float) - Optional - Kick-off point measured depth (default: -inf). ### Request Example { "reference": "survey_obj_1", "offset": "survey_obj_2", "k": 3.5, "sigma_pa": 0.5 } ### Response #### Success Response (200) - **status** (string) - Confirmation of object initialization. #### Response Example { "status": "success", "message": "Clearance object initialized" } ``` -------------------------------- ### Create Well Trajectory with Survey Data (Python) Source: https://context7.com/jonnymaserati/welleng/llms.txt Demonstrates how to create a basic well trajectory using measured depth, inclination, and azimuth data with the `Survey` class. It also shows how to include header information and specify an ISCWSA error model for calculating well bore uncertainty. ```python import welleng as we # Create a basic survey from MD, inclination, and azimuth data survey = we.survey.Survey( md=[0., 500., 1000., 2000., 3000.], inc=[0., 0., 30., 60., 90.], azi=[0., 0., 45., 90., 135.] ) # Access calculated trajectory data print(f"Northing: {survey.n}") print(f"Easting: {survey.e}") print(f"TVD: {survey.tvd}") print(f"Dog Leg Severity: {survey.dls}") # Create survey with header information and error model header = we.survey.SurveyHeader( name="Well-001", latitude=60.0, longitude=2.0, azi_reference="grid", b_total=50000., dip=70., declination=0. ) survey_with_errors = we.survey.Survey( md=[0., 500., 1000., 2000., 3000.], inc=[0., 0., 30., 60., 90.], azi=[0., 0., 45., 90., 135.], header=header, error_model='ISCWSA MWD Rev5' # Options: 'ISCWSA MWD Rev4', 'ISCWSA MWD Rev5' ) # Access covariance matrices for uncertainty print(f"Covariance NEV shape: {survey_with_errors.cov_nev.shape}") ``` -------------------------------- ### GET /exchange/edm/attributes Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Retrieves specific attributes from an EDM (Engineering Data Model) file based on provided tags and logic filters. ```APIDOC ## GET /exchange/edm/attributes ### Description Queries an EDM instance to return attributes associated with specific tags, filtered by a dictionary of key-value pairs. ### Method GET ### Endpoint welleng.exchange.edm.EDM.get_attributes ### Parameters #### Query Parameters - **tags** (list) - Optional - List of tags to retrieve. - **attributes** (dict) - Optional - Dictionary of attribute keys and values to filter by. - **logic** (str) - Optional - 'AND' or 'OR' logic for attribute matching. ### Request Example { "tags": ["well_1", "well_2"], "attributes": {"status": "active"}, "logic": "AND" } ### Response #### Success Response (200) - **data** (dict) - A dictionary of lists containing tags and their matching attributes. ``` -------------------------------- ### Initialize WellPlan Object for WBP Data Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Creates a WellPlan object to store data for or from a .wbp file. It accepts various parameters that correspond to the Landmark .wbp format, including units, survey data, and plan details. This object serves as a container for well bore information. ```python welleng.exchange.wbp.WellPlan(depth_unit='meters', surface_unit='meters', survey=None, plan_name=None, parent_name=None, location_type=None, plan_method='curve_only', dirty_flag=None, sidetrack_id=None, dls=3.0, extension=0, wbp_data=None, targets=[], line=None, parent_wbp_file=None) ``` -------------------------------- ### Get Node Parameters Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Retrieves the parameters of a given Node object. This utility function is useful for accessing the properties stored within a Node instance. ```python welleng.node.get_node_params(node) ``` -------------------------------- ### Initialize welleng Connector Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Instantiates the Connector class to calculate wellbore geometry between two points. It accepts various parameters such as positions, vectors, and dogleg severity constraints. ```python from welleng.connector import Connector # Initialize a connector with start and end positions conn = Connector( pos1=[0.0, 0.0, 0.0], pos2=[100.0, 50.0, 500.0], dls_design=3.0 ) ``` -------------------------------- ### Import/Export Landmark WBP Files - Python Source: https://context7.com/jonnymaserati/welleng/llms.txt Enables importing and exporting well plan files in Landmark's .wbp format for interoperability with COMPASS and DecisionSpace software. It includes functions to load .wbp files, convert them to welleng Survey objects, and export survey data back to .wbp format. ```python import welleng as we # Import a .wbp file wp = we.exchange.wbp.load("path/to/well.wbp") # Convert to welleng Survey object survey = we.exchange.wbp.wbp_to_survey(wp, step=30) # Access imported survey data print(f"Well name: {survey.header.name}") print(f"Total MD: {survey.md[-1]:.2f}m") # Export a survey to .wbp format # First create a WellPlan object from survey well_plan = we.exchange.wbp.WellPlan( survey=survey, plan_name="exported_well", location_type="UTM" ) # Create the document and save doc = we.exchange.wbp.export(well_plan) we.exchange.wbp.save_to_file(doc, "path/to/output.wbp") ``` -------------------------------- ### Get Parent Survey from File Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Retrieves the parent survey information from a specified file. This is useful for sidetrack or lateral well planning where a parent well bore exists. ```python welleng.exchange.wbp.get_parent_survey(filename) ``` -------------------------------- ### Initialize Well Survey Header Parameters Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a SurveyHeader object with various parameters defining a well bore's survey data. It accepts geographical coordinates, survey date, gravitational and magnetic field strengths, and units for measurements. Defaults are provided for most parameters, with some values calculated if not explicitly provided. ```python class SurveyHeader: def __init__(self, name: str = None, longitude=None, latitude=None, altitude=None, survey_date=None, G=9.80665, b_total=None, earth_rate=0.26251614, dip=None, declination=None, convergence=0, azi_reference='true', vertical_inc_limit=0.0001, deg=True, depth_unit='meters', surface_unit='meters', mag_defaults={'b_total': 50000.0, 'declination': 0.0, 'dip': 70.0}, vertical_section_azimuth=0, grid_scale_factor: float = 1.0): """A class for storing header information about a well.""" self.name = name self.longitude = longitude self.latitude = latitude self.altitude = altitude self.survey_date = survey_date self.G = G self.b_total = b_total self.earth_rate = earth_rate self.dip = dip self.declination = declination self.convergence = convergence self.azi_reference = azi_reference self.vertical_inc_limit = vertical_inc_limit self.deg = deg self.depth_unit = depth_unit self.surface_unit = surface_unit self.mag_defaults = mag_defaults self.vertical_section_azimuth = vertical_section_azimuth self.grid_scale_factor = grid_scale_factor ``` -------------------------------- ### Get Unit Key from Data Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Determines the unit key from the provided data. This function is likely used to standardize or identify unit systems within WBP data. ```python welleng.exchange.wbp.get_unit_key(data) ``` -------------------------------- ### Convert Survey Data to MinCurve - Python Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Generates geometric data from a well bore survey, including measured depth, inclination, and azimuth. It allows specifying the starting XYZ coordinates and the unit system for dogleg severity. ```python class MinCurve: def __init__(self, md, inc, azi, start_xyz=[0.0, 0.0, 0.0], unit='meters'): """Generate geometric data from a well bore survey. * **Parameters:** * **md** (*list* *or* *1d array* *of* *floats*) – Measured depth along well path from a datum. * **inc** (*list* *or* *1d array* *of* *floats*) – Well path inclination (relative to z/tvd axis where 0 indicates down), in radians. * **azi** (*list* *or* *1d array* *of* *floats*) – Well path azimuth (relative to y/North axis), in radians. * **unit** (*str*) – Either “meters” or “feet” to determine the unit of the dogleg severity. """ pass ``` -------------------------------- ### Project to Bit Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Projects the survey ahead to the bit. ```APIDOC ## POST /project_to_bit ### Description Convenience method to project the survey ahead to the bit. ### Method POST ### Endpoint /project_to_bit ### Parameters #### Request Body - **delta_md** (float) - Required - The along hole distance from the surveying tool to the bit in meters. - **dls** (float) - Optional - The desired dog leg severity (deg / 30m) between the surveying tool and the bit. Default is to project the DLS of the last survey section. - **toolface** (float) - Optional - The desired toolface to project from at the last survey point. The default is to project the current toolface from the last survey station. ### Response #### Success Response (200) - **node** (welleng.node.Node object) - The projected node. #### Response Example ```json { "node": { "properties": { ... } } } ``` ``` -------------------------------- ### WBP Exchange - Import/Export Landmark Files Source: https://context7.com/jonnymaserati/welleng/llms.txt Enables importing and exporting well plan files in Landmark's .wbp format for interoperability with COMPASS and DecisionSpace software. ```APIDOC ## WBP Exchange - Import/Export Landmark Files ### Description Imports and exports well plan files in Landmark's .wbp format, facilitating interoperability with COMPASS and DecisionSpace software. ### Method Use functions within the `welleng.exchange.wbp` module. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python import welleng as we # Import a .wbp file wp = we.exchange.wbp.load("path/to/well.wbp") # Convert to welleng Survey object survey = we.exchange.wbp.wbp_to_survey(wp, step=30) # Access imported survey data print(f"Well name: {survey.header.name}") print(f"Total MD: {survey.md[-1]:.2f}m") # Export a survey to .wbp format # First create a WellPlan object from survey well_plan = we.exchange.wbp.WellPlan( survey=survey, plan_name="exported_well", location_type="UTM" ) # Create the document and save doc = we.exchange.wbp.export(well_plan) we.exchange.wbp.save_to_file(doc, "path/to/output.wbp") ``` ### Response #### Success Response (200) Successfully imports data from a .wbp file into a `welleng.survey.Survey` object or saves a `welleng.exchange.wbp.WellPlan` object to a .wbp file. #### Response Example ```json { "status": "success", "message": "Well plan imported/exported successfully." } ``` ``` -------------------------------- ### Node Class Initialization Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a Node object, representing a point in 3D space with associated wellbore parameters. It accepts position, vector, measured depth, inclination, azimuth, and uncertainty covariance. Various parameters can be set during initialization, and it supports different units and coordinate systems. ```python welleng.node.Node(pos=None, vec=None, md=None, inc=None, azi=None, unit='meters', degrees=True, nev=True, cov_nev=None, **kwargs) ``` -------------------------------- ### Load Well Data from WBP File Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.exchange.md Loads well bore data line by line from a specified .wbp file. It then initiates a WellPlan object and populates it with the loaded data, returning the created WellPlan object. ```python welleng.exchange.wbp.load(filename) ``` -------------------------------- ### Initialize MeshClearance for Collision Detection Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes the MeshClearance class to calculate clearance between two wellbores using a mesh-based approach. This method requires trimesh and python-fcl libraries and allows configuration of vertex count and sigma confidence levels. ```python from welleng.clearance import MeshClearance # Initialize with default parameters clearance = MeshClearance( *clearance_args, n_verts=12, sigma=2.445, return_data=True, return_meshes=False ) ``` -------------------------------- ### Connector Module Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Documentation for the welleng.connector module. ```APIDOC ## Module: welleng.connector ### Description This module contains functionalities related to connecting or interfacing with external systems or data sources. Specific details about the functions within this module are not provided in the input text. ``` -------------------------------- ### 3D Plotting and Visualization of Wells - Python Source: https://context7.com/jonnymaserati/welleng/llms.txt Provides tools for interactive 3D visualization of well trajectories and meshes using vedo/VTK. It allows adding multiple well meshes and clearance lines to a plotter and displaying them. Also supports generating Plotly figures for web-based visualizations. ```python import welleng as we # Create two surveys survey_ref = we.survey.Survey( md=[0., 500., 1000., 2000.], inc=[0., 0., 30., 60.], azi=[0., 0., 45., 90.], header=we.survey.SurveyHeader(name="reference", azi_reference="grid"), error_model='ISCWSA MWD Rev4' ) survey_off = we.survey.Survey( md=[0., 500., 1000., 2000.], inc=[0., 0., 35., 55.], azi=[0., 0., 50., 100.], start_nev=[100., 50., 0.], header=we.survey.SurveyHeader(name="offset", azi_reference="grid"), error_model='ISCWSA MWD Rev4' ) # Create meshes mesh_ref = we.mesh.WellMesh(survey_ref) mesh_off = we.mesh.WellMesh(survey_off) # Calculate clearance and get closest lines clearance = we.clearance.MeshClearance(survey_ref, survey_off, sigma=2.445) lines = we.visual.get_lines(clearance) # Create plotter and add objects plot = we.visual.Plotter() plot.add(mesh_ref, c='red') plot.add(mesh_off, c='blue') plot.add(lines) plot.show() plot.close() # Generate plotly figure (for notebooks/web) fig = survey_ref.figure(type='scatter3d') fig.show() ``` -------------------------------- ### POST /well/header Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes a new well header object containing metadata, location, and magnetic field properties. ```APIDOC ## POST /well/header ### Description Creates a new well header instance to store survey metadata, geographic location, and magnetic field parameters. ### Method POST ### Endpoint /well/header ### Parameters #### Request Body - **name** (string) - Optional - The assigned name of the well bore. - **longitude** (float) - Optional - Longitude of the surface location. - **latitude** (float) - Optional - Latitude of the surface location. - **altitude** (float) - Optional - Altitude of the surface location. - **survey_date** (YYYY-mm-dd) - Optional - Date of the survey recording. - **deg** (bool) - Optional - Whether angles are in degrees (True) or radians (False). ### Request Example { "name": "Well-01", "longitude": -0.1278, "latitude": 51.5074, "deg": true } ### Response #### Success Response (200) - **status** (string) - Confirmation of header creation. #### Response Example { "status": "success", "well_name": "Well-01" } ``` -------------------------------- ### Interpolate Well Survey Data (Python) Source: https://context7.com/jonnymaserati/welleng/llms.txt Shows how to generate a dense listing of survey points at regular measured depth intervals using the `interpolate_survey` method. It also covers interpolating to a specific measured depth and interpolating at fixed true vertical depth intervals. ```python import welleng as we # Create a sparse survey survey = we.survey.Survey( md=[0., 500., 2000., 5000.], inc=[0., 0., 30., 90.], azi=[0., 0., 30., 90.] ) # Interpolate to get points every 30 meters survey_interpolated = survey.interpolate_survey(step=30) print(f"Original stations: {len(survey.md)}") print(f"Interpolated stations: {len(survey_interpolated.md)}") # Interpolate at specific MD node = survey_interpolated.interpolate_md(1234) print(f"Position at MD 1234m: N={node.pos_nev[0]:.2f}, E={node.pos_nev[1]:.2f}, TVD={node.pos_nev[2]:.2f}") # Interpolate at fixed TVD intervals survey_tvd = survey.interpolate_survey_tvd(step=10) ``` -------------------------------- ### String Class Initialization for Well Bore Architecture Source: https://github.com/jonnymaserati/welleng/blob/main/docs/welleng.md Initializes the String class, a generic collection for well bore architecture like casing strings. It takes parameters for name, top and bottom depths, and an optional method for adding items ('bottom_up' or 'top down'). ```python class String: def __init__(self, name, top, bottom, *args, method='bottom_up', **kwargs): self.name = name self.top = top self.bottom = bottom self.method = method pass ```