ComboCurve: Well Spacing Calculation Documentation

ComboCurve: Well Spacing Calculation Documentation

Overview

Well spacing feature is usually aimed to help the users understand the current and historical well spatial distribution, examine the impact of spatial distribution on well production and identify the future well placement. Unconventional wells with a lateral section are primarily considered in well spacing of ComoboCurve V32 . This document explains the workflow, options and technical details of the well spacing feature. The workflow includes well directional survey data import and run well spacing calculation. Understanding both of them is essential to ensure correct calculation results. Details about the algorithm and function flowchart will help a developer maintain the codebase and build future functionalities. 

Part 1 Importing Well Directional Survey Data

1.1 Data Upload

Uploading well directional survey data can be accessed by clicking “CREATE DATA IMPORT”.

1.2 Field Mapping

After a csv file is uploaded, the mapping tool will guide a user to map the columns in the original csv file to ComboCurve Fields. The correct units need to be used to ensure correct calculation results subsequently:
  1. Measured Depth (FT): foot
  2. True Vertical Depth (FT): foot
  3. Azimuth: degree
  4. Inclination: degree
  5. Deviation NS (FT): foot
  6. Deviation EW (FT): foot
  7. Latitude: degree
  8. Longitude: degree
It is also worth noting that if deviation EW/deviation NS are imported, a user needs to make sure the correct positive/negative sign is included, which means ”+” for E/N and “-” for W/S. A reference datum that was used in the directional survey (“NAD83”, “NAD27” or “WGS84”) should also be selected.

 

 

To complete mapping, there are two sets of columns that can be included to meet the minimum requirement:
  1. Measured Depth, Azimuth, Inclination
  2. Measured Depth, True Vertical Depth, deviation NS, and deviation EW
   
To enable the 2D map presentation of the well trajectories and the calculation of well spacing, some additional calculations will be done by backend depending on the missing columns when data is imported as in the two cases above.
  1. True Vertical Depth, deviation NS, deviation EW, latitude, longitude are calculated along the wellbore trajectory following steps below:
    1. Minimum curvature method
      1. Minimum curvature is a commonly used method to calculate deviations and TVD from the measured data for well directional survey. The formula can be found here.
      2. The input of this algorithm is [measuredDepth, azimuth, inclination] and the output is [trueVerticalDepth, deviationEW, deviationNS].The implementation was done in the wellpathy package and the code can be found here. It has been tested by QA to ensure the calculated results conform with the vendor reported data.
    2. Projection of the well head location (LAT, LONG) on XY grid
      1. As the calculated values from last step are referenced to the well head, the absolute location of the well head is needed to get the absolute locations of the entire wellbore. Functions from a python package pyproj are used to project a well head location in (latitude, longitude) to (X, Y) 2D map. The projection involves
        1. getting the corresponding geodetic coordinate system for the specified location using pyproj.database.query_utm_crs_info and pyproj.crs.CRS
        2. instantiate a pyproj.Transformer that transforms from geodetic CRS to projected CRS
        3. Using the transformer to perform the projection
        4. Apply unit conversion to convert to FOOT.
    3. Determine the XY coordinates along the wellbore
      1. The absolute XY coordinates of all points in the directional survey can then be obtained by (well_head_X + deviationEW, well_head_Y + deviationNS)
    4. Transform XY coordinates to (LAT, LONG) for points on wellbore
      1. The absolute coordinates can then be transformed to (latitude, longitude) by instantiating an inverse transformer as opposed to step b. 
 
Latitude, longitude are calculated along the wellbore using steps b–d for the 1st case.

1.3 MongoDB data schema 

"wellSurveyCollections": [

    {

        "collectionName": "well-directional-surveys",

        "schema": {

            "_id": "<MongoDB Internal Id>",

            "schema_version": "some sort of versioning standard",

            "well": "Foreign key to the wells collection NOT NULL",

            "project" : "project id from the well header",

            "measuredDepth": [ "double" ],

            "trueVerticalDepth": [ "double" ],

            "azimuth": [ "double" ],

            "inclination": [ "double" ],

            "deviationNS": [ "double" ],

            "deviationEW": [ "double" ],

            "latitude": [ "double" ],

            "longitude": [ "double" ],

            "createdAt": "timestamp",

            "updatedAt": "timestamp"

        }

    }

 

Part 2 Well Spacing Calculation

 2.1 distance calculation options

“RUN WELL SPACING” is the new button in V32 for spacing calculations when a user selects a number of wells in the “project wells” page. The selected wells are the target wells for spacing calculation. For each target well, a user-selected type of distance is calculated with respect to all the other wells in the filtered wells. The minimum distance is picked as the well spacing distance and reported as distance in XY plane and distance in Z. Configuration of the distance includes zone type, distance type and (optional) CRS.


2.1.1 distance type

Three distance types are available in V32, with two of them being point to point distance (SHL to SHL, mid-point to mid-point) and the remaining one being point to line distance (mid-point to closest). The 3D distance will be projected on horizontal plane and vertical plane, which correspond to distance XY and distance Z in the figure. These two distances are stored in the well headers.

                                                                   



Figure 1  a) SHL to SHL; b) midpoint-to-midpoint; c) midpoint to closest

 

  1. SHL to SHL is the well head distance. It is the onldistance that can be calculated when there is only surface location. Well head distances are straightforward as they are point-to-point, namely
    1. High efficiency is necessary to shorten the wait time for the users. In V32, we make use of two methods to calculate point to point distance:
      1. use vectorized method to get the distance between one point and all the other points when the total number of points involved is less than 500;
      2. use KDTree method from scipy.spatial when the total number of points involved is equal or larger than 500.
    2. In rare cases, some wells have the same surface locations. We will neglect the zero distances and search for the minimum from the non-zero distances. If there is no well of different surface location from the target well, then zero distance is reported.
  2. Mid-point to mid-point is the distance between the midpoint of well lateral sections. To determine the midpoint on the wellbore, ComboCurve uses the following method:
    1. Find the point where inclination value > 85 degrees as the well heel;
    2. When inclination is not available, we calculate the derivative of true vertical depth(TVD) with respect to measured depth (MD) and use d(TVD)/d(MD) < 0.2 as the threshold to mark where the lateral section starts;
    3. Find the well toe as the last point in the well trajectory;
    4. Mid-point is the point where its X is closest to (x_heel + x_toe)/2
  3. Mid-point to closest is a bit more complicated than a) and b). It is valuable as it searches for the nearest well from the mid-point of the target well and is more representative of how close the target well is to other wells. The point to line distance, as shown in the figure |PQ| is determined by the following:
    1. Use the lateral section points,  compute the centroid of points and perform singular value decomposition (use numpy.linalg.svd(data - centroid)) to get the line vector of the fitted straight line.
    2. Determine if there is a projection from the target well midpoint on another well. As shown in the figure, well 1 midpoint cannot project on well 2 or 3. This check is done by the following:

 If well 1 can be projected on well 2.

 

                 


                        3. Find two points A and B on all the fitted lines. The projection from midpoint P to the line AB is the modulus of vector PQ. Vector                               PQ can be determined by the equation shown below. As PQ is calculated, the coordinate of the projected point Q is then                               known and distance between PQ on XY plane and Z plane can be obtained.
 
                                                     

2.1.2 Zone Type

  1. Any zone: examine the distance of the selected well to all of the filtered wells on the left of the “project wells” page.
  1. Same zone: examine the distance of the selected well to the filtered wells in the same landing zone. Wells that don’t have the “landing zone” information will be neglected when using this option. For efficient calculations of point to point calculations, a mask is generated for each target zone. If the total number of wells is less than 1000, then a vectorized method with masking is used. Otherwise, all the wells involved in the calculation are grouped by their landing zones. For each group, if the total number of wells is larger than 500, then KDTree method is used. Otherwise the vectorized method is used with the corresponding landing zone mask.
    To transform a location on the earth to a point on the map (as shown in the figure), a coordinate reference system (CRS) is needed.

 

The CRS includes several key components:
  1. Reference datum: A modeled version of the shape of the Earth which defines the origin used to place the coordinate system in space. Different locations on the earth can use different ellipsoids to model the earth. The most used datum in North America includes WGS84, NAD27 and NAD83.


  1. Coordinate system: a set of coordinates that transforms latitude and longitude on a globe into XYs on a flat map.  The most common coordinate systems in North America are the state plane systems and UTM zones.
  1. Units: The units used to define the grid along the x, y (and z) axis, e.g. foot or meter.
  2. Projection Information: The mathematical equation used to flatten objects that are on a round surface (e.g. the Earth) so you can view them on a flat surface.
To make it simple, the latitude and longitude value of a location on the earth is determined by the reference datum, and the projected XY is determined by the coordinate system. When calculating the 3D distance between two points, we need to correctly map their locations to the same cartesian coordinates.
Usually the CRS information can be found from a survey vendor provided report, e.g. statement like “NAD27 Texas State Plane, North Central Zone, US Feet”. A user can then search for the EPSG code of the CRS. In the case that the original report is not available, ComboCurve uses WGS84/UTM zones as the default CRS. For NAD27 state plane CRS, ComboCurve has those listed from the dropdown menu. A user can select “other” and then input the EPSG code to use a CRS that is not listed.


 

2.2 Run well spacing request

2.2.1filters/lightFilterWellsIds’ payload example


2.2.2 ‘well-spacing/validate’ payload example


2.2.3 ‘well-spacing/run’ payload example


 





2.3 Handling run well spacing request

2.3.1 (internal-api) “well-spacing/validate”

WellSpacingValidationService in internal-api handles checking the data availability before a run well spacing request is sent to python-api. Depending on the configuration selected, surface location, landing zone and directional survey data availability of the selected and filtered wells are checked by calling the database. This includes the following checking criteria:
  1. Surface location and elevation are always needed;
  2. Directional survey is checked when the selected distance type is mid-point related.
  3. Landing zone is checked when the selected zone type is “Same zone”
The checkmarks in the table show what data is needed for each well spacing configuration,

Well spacing configuration

Well headers

 

Zone type

Distance type

Surface latitude, surface longitude, elevation

Landing zone

Directional survey

Any

SHL-to-SHL

 

 

Any

Mid-to-mid

 

Any

mid-to-closest

 

Same

SHL-to-SHL

 

Same

Mid-to-mid

Same

mid-to-closest


   

If the filtered wells have missing data, the data availability is summarized and present to  the user. The user is given the choice of whether to proceed with the calculation and acknowledge that the wells with missing data will be ignored. If none of the selected wells meets the minimum data requirements, a warning message is displayed and calculation  won’t be able to proceed.


2.3.1 (internal-api) “well-spacing/run”

pythonService in the internal-api calls the python-api endpoint “/well-spacing/calculating-well-spacing”

2.3.2 (python-api) “/well-spacing/calculating-well-spacing”

This endpoint makes a function call of the calculate_well_spacing method in the WellSpacingService Class. A flowchart is shown at the end of this document to explain the algorithm flow and the functions called in the process.
The following well headers are updated after this function call returns:

Well header name

value

Vt Well Spacing Any Zone (FT)

Distance Z to closest well (Any Zone)

Hz Well Spacing Any Zone (FT)

Distance XY to closest well (Any Zone)

Vt Well Spacing Same Zone (FT)

Distance Z to closest well (Same Zone)

Hz Well Spacing Same Zone (FT)

Distance XY to closest well (Same Zone)

Closest Well ID Any Zone

Chosen ID of the closest well in 3D Any Zone

Closest Well ID Same Zone

Chosen ID of the closest well in 3D same zone

Part 3 Summary

In summary, as the first MVP, well spacing in ComboCurve V32 provides the functionality of importing directional survey data, calculating the well spacing with different configurations and populating the results to well headers. To prevent calculation failure, it ignores the wells with insufficient information.
    By reading this document, a user may benefit from
  1. Knowing the workflow
  2. Avoiding mistakes when uploading directional survey data
  3. Understanding what’s been calculated for different well spacing calculation configurations.
  4. Knowing what is a CRS and how to choose the correct CRS to achieve best accuracy.
  5. Knowing where to find the calculation results in ComboCurve.
A developer will additionally benefit from learning about
  1. The data storage format in database
  2. How request is sent to internal-api and python-api, what are the services used
  3. Algorithm used to achieve better performance for distance calculations.
  4. How different distance configurations are handled by python

Appendix: Flowchart of distance calculation in python-CC