API reference

class wellpathpy.deviation(md, inc, azi)

Deviation

The deviation is a glorified triple (md, inc, azi), with some interesting operations.

Notes

Glossary: md : measured depth inc : inclination (in degrees) azi : azimuth (in degrees)

minimum_curvature(course_length=30)

This function calls mincurve.minimum_curvature with self

Notes

You can access help with wp.mincurve.minimum_curvature? in ipython

radius_curvature()

This function calls rad_curv.radius_curvature with self

Notes

You can access help with wp.rad_curv.radius_curvature? in ipython

tan_method(choice='avg')

This function calls tan.tan_method with self

Notes

You can access help with wp.tan.tan_method? in ipython

to_csv(fname, **kwargs)

This function calls write.deviation_to_csv with self

Notes

You can access help with wp.write.deviation_to_csv? in ipython

wellpathpy.deviation_to_csv(fname, md, inc, azi, fmt='%.3f', delimiter=',', header='md,inc,azi', **kwargs)

Write a log to a comma-separated values (csv) file.

Parameters:
  • fname (str or file handle) – file path or object the CSV will be written to.

  • md (array-like,) – measured depth

  • inc (array-like,) – inclination from vertical

  • azi (array-like,) – azimuth from north

  • fmt (str) – this is the fmt argument to numpy.savetxt, see: https://numpy.org/doc/stable/reference/generated/numpy.savetxt.html

  • delimiter (str) – String or character separating columns.

  • header (str) – String that will be written at the beginning of the file. Beware if changing the header that it does not change the order in which the data are written, which remains: md,`inc`,`azi`.

  • **kwargs (All other keyword arguments are passed to np.savetxt)

Notes

This function is totally unit unaware, the user is responsible to handle units.

Caution: deviation_to_csv uses Python write mode set to the default: ‘w’ therefore existing files will be overwritten.

class wellpathpy.minimum_curvature(src, depth, n, e, dls)
deviation()

Deviation survey

Compute an approximate deviation survey from the position log, i.e. the measured that would be convertable to this well path. It is assumed that inclination, azimuth, and measured-depth starts at 0.

Returns:

dev

Return type:

deviation

resample(depths)

Resample the position log onto a new measured-depth.

Parameters:

depths (array_like) – The measured depths to resample onto

Returns:

resampled – Resampled position log

Return type:

minimum_curvature

Examples

Resample onto a regular, 1m measured depth interval:

>>> depths = list(range(int(dev.md[-1]) + 1))
>>> resampled = pos.resample(depths = depths)
class wellpathpy.position_log(src, depth, northing, easting)

Position log

The position log is the computed positions of the well path. It has no memory of the method that created it, but it knows what deviation it came from. In its essence, it’s a glorified triplet (tvd, northing, easting) with some interesting operations.

Notes

Glossary: tvd : true vertical depth

to_csv(fname, **kwargs)

This function calls write.position_to_csv with self

Notes

You can access help with wp.write.position_to_csv? in ipython

to_tvdss(datum_elevation, inplace=False)

This function calls location.location_to_tvdss with self

Notes

You can access help with wp.location.to_tvdss? in ipython

to_wellhead(surface_northing, surface_easting, inplace=False)

Create a new position log instance moved to the wellhead location

Parameters:
  • surface_northing (array_like)

  • surface_easting (array_like)

  • inplace (bool)

to_zero(surface_northing, surface_easting, inplace=False)

Create a new position log instance moved to 0m North and 0m East

Parameters:
  • surface_northing (array_like)

  • surface_easting (array_like)

  • inplace (bool)

wellpathpy.position_to_csv(fname, depth, northing, easting, fmt='%.3f', delimiter=',', header='easting,northing,depth', **kwargs)

Write a log to a comma-separated values (csv) file.

Parameters:
  • fname (str or file handle) – file path or object the CSV will be written to.

  • depth (array-like,) – true vertical depth (tvd) or true vertical depth subsea (tvdss)

  • northing (array-like,) – distance north of reference point

  • easting (array-like,) – distance east of reference point,

  • fmt (str) – this is the fmt argument to numpy.savetxt, see: https://numpy.org/doc/stable/reference/generated/numpy.savetxt.html

  • delimiter (str) – String or character separating columns.

  • header (str) – String that will be written at the beginning of the file. Beware if changing the header that it does not change the order in which the data are written, which remains: easting,`northing`,`depth`.

  • **kwargs (All other keyword arguments are passed to np.savetxt)

Notes

This function is totally unit unaware, the user is responsible to handle units.

Caution: position_to_csv uses Python write mode set to the default: ‘w’ therefore existing files will be overwritten.

wellpathpy.read_csv(fname, delimiter=',', skiprows=1, **kwargs)

Read a deviation file in CSV format

A header row containing the column names md, inc, azi in that order is generally expected to be included as the first row in the file. By default, this header is skipped with the skiprows argument set to 1 but this can be changed to 0 if no header is inclduded. The data must be ordered as md, inc, azi as the data cannot be distinguished numerically.

Parameters:
  • fname (str) – path to a CSV file with this format: `md,inc,azi 0,0,244 10,11,220 50,43,254 150,78.5,254 252.5,90,359.9`

  • delimiter (str) – the character used as a delimiter in the CSV

  • skiprows (int) – number of rows to skip, normally the header row

  • **kwargs (All other keyword arguments are passed to np.loadtxt)

Returns:

md, inc, azi – md, inc and azi are of type np.ndarray

Return type:

tuple

Notes

mdfloat

measured depth (units not defined)

incfloat

well inclination in degrees from vertical

azifloat

well azimuth in degrees from Grid North

wellpathpy.read_header_json(fname)

Read deviation header

The deviation header information is needed for surface location and true vertical depth subsea calculations. This function loads data from a JSON file into a dict.

Parameters:

fname (str) – JSON object or path to a JSON file

Notes

required keys: elevation_units, elevation, surface_coordinates_units, surface_easting, surface_northing

optional key: datum

datumstr

kb, dfe or rt. datum is not used in calculation

kb (kelly bushing), dfe (drill floor elevation), rt (rotary table)

elevation_unitsstr

datum elevation units

elevationfloat

datum elevation in elevation_units above mean sea level

surface_coordinates_unitsstr

surface coordinate units of wellhead

surface_eastingfloat

wellhead surface location in surface_coordinates_units east of reference

surface_northingfloat

wellhead surface location in surface_coordinates_units north of reference

Returns:

header

Return type:

dict