Surveys and units¶
A directional survey states, at each station, the measured depth along the
hole, the inclination from vertical, and the azimuth of the hole’s direction.
Survey holds those values with the
units they are stated in. The units are checked when the survey is made, and
everything downstream works in metres and radians.
Every TrajectoryInput constructor
builds the survey for you, from md_unit and angle_unit; see Building the input.
This page is about the survey on its own, and the units it accepts.
Stating a survey¶
Give one value per station for each quantity:
from geodetic_engine.welltrajectory import Survey
survey = Survey(
md=[0, 500, 1500, 2500],
inclination=[0, 20, 60, 70],
azimuth=[10, 30, 45, 50],
md_unit="m",
)
print("md :", survey.md, survey.md_unit)
print("angles in :", survey.angle_unit)
print("md_metres :", survey.md_metres)
print("radians :", survey.inclination_radians.round(6))
print("azimuths :", survey.azimuth_degrees)
md : [ 0. 500. 1500. 2500.] m
angles in : degree
md_metres : [ 0. 500. 1500. 2500.]
radians : [0. 0.349066 1.047198 1.22173 ]
azimuths : [10. 30. 45. 50.]
The values are kept as given. md_metres,
inclination_radians and
azimuth_degrees convert them.
angle_unit defaults to degrees and applies to both inclination and azimuth.
Units¶
A unit can be given in three forms, and is resolved the same way for MD, for
depths and elevations (z_unit), and for angles. It is read by
geodetic_engine.units, as everywhere else in this package:
Form |
Example |
|---|---|
A symbol or name, in any case |
|
An OSDU unit id |
|
An OSDU unit |
|
length_factor() and
angle_factor() show what a unit resolves
to, in metres and radians per unit:
from geodetic_engine.welltrajectory import angle_factor, length_factor
for unit in ("m", "Metre", "ft", "ftUS", "dev:reference-data--UnitOfMeasure:ft:"):
print(f"{unit:40} {length_factor(unit)!r}")
for unit in ("degree", "rad", "gon"):
print(f"{unit:40} {angle_factor(unit)!r}")
m 1.0
Metre 1.0
ft 0.3048
ftUS 0.3048006096012192
dev:reference-data--UnitOfMeasure:ft: 0.3048
degree 0.017453292519943295
rad 1.0
gon 0.015707963267948967
ft is the international foot, 0.3048 m, and ftUS the US survey foot,
1200/3937 m. They differ by 2 parts per million, 2 cm over a 10 km well, so
they are never treated as the same unit.
An OSDU unit persistableReference is read for its scale, USO or a UAD
that reduces to one. It must state what it measures: its baseMeasurement
ancestry is Length or L for a length, and Plane_Angle, Angle or A
for an angle, in any case. The OSDU CRS conversion service writes the names,
and the OSDU unit catalogue the dimensions. A unit with an offset, or one that
is not a plain length or angle, such as a rate per length, is refused. A
payload in feet:
import json
feet = json.dumps(
{
"scaleOffset": {"scale": 0.3048, "offset": 0.0},
"symbol": "ft",
"baseMeasurement": {"ancestry": "Length", "type": "UM"},
"type": "USO",
}
)
length_factor(feet)
0.3048
The US survey foot as the OSDU unit catalogue states it:
us_foot = json.dumps(
{
"abcd": {"a": 0.0, "b": 1200.0, "c": 3937.0, "d": 0.0},
"symbol": "ft[US]",
"baseMeasurement": {"ancestry": "L", "type": "UM"},
"type": "UAD",
}
)
length_factor(us_foot)
0.3048006096012192
Anything else raises UnitError, which
is also a geodetic_engine.units.UnitError. A
unit is never defaulted:
length_factor("fathom")
UnitError: 'fathom' is not a length unit this package knows
length_factor("deg") # an angle, not a length
UnitError: 'deg' is not a length unit this package knows
The check happens as soon as the survey is made, not when it is first used:
Survey([0, 1000], [0, 10], md_unit="cubit")
UnitError: 'cubit' is not a length unit this package knows
A survey in feet converts once, to metres:
in_feet = Survey([0, 1000, 2000], [0, 30, 60], [0, 45, 45], md_unit="ft")
in_feet.md_metres
array([ 0. , 304.8, 609.6])
Surveys without azimuths¶
An inclination-only survey leaves azimuth out. The hole is then taken to head
north throughout, and the trajectory records that it was:
from geodetic_engine.welltrajectory import compute_trajectory
inclination_only = Survey([0, 500, 1000], [0, 5, 10])
print("azimuth :", inclination_only.azimuth)
print("azimuth_degrees :", inclination_only.azimuth_degrees)
trajectory = compute_trajectory(
inclination_only, (500000.0, 6600000.0), "EPSG:32631", north="TN"
)
print(*trajectory.operations, sep="\n")
azimuth : None
azimuth_degrees : [0. 0. 0.]
trajectory CRS EPSG:32631; wellhead at (500000, 6600000), elevation 0 m
grid convergence -0.000000000 deg and scale factor 0.999600000 at the wellhead
azimuths against true north
the survey states no azimuth; taken as 0 throughout
minimum curvature over 3 survey stations
read offsets as WGS 84 / Azimuthal Equidistant Lat=59.53834913 Lon=3.00000000
converted from WGS 84 / Azimuthal Equidistant Lat=59.53834913 Lon=3.00000000 to WGS 84 / UTM zone 31N
The wellhead¶
The wellhead is where the survey starts: the position of its first station,
which true vertical depth and the offsets count from. Measured depth is kept
as surveyed, so for a survey whose first station is not at MD 0 the wellhead
is that tie-in point, such as the seabed, and the provenance says so.
It is given in the trajectory CRS, in xy order, with its elevation:
from geodetic_engine.welltrajectory import Wellhead
Wellhead(500000.0, 6600000.0, 25.0)
Wellhead(x=500000.0, y=6600000.0, z=25.0)
x and y are in the CRS’s own units: easting and northing for a projected
CRS, longitude and latitude for a geographic one. z is the elevation of the
first station, positive up, in the trajectory’s z_unit. Every position is
reported at elevation \(z - \mathrm{TVD}\). A plain tuple, (x, y) or
(x, y, z), works anywhere a Wellhead
does, with the elevation 0 when left out.
What the azimuths are measured from¶
NorthReference says whether the
azimuths are against grid north or true north. The strings "GN" and "TN"
work too:
from geodetic_engine.welltrajectory import NorthReference
list(NorthReference), NorthReference("GN")
([<NorthReference.GRID: 'GN'>, <NorthReference.TRUE: 'TN'>],
<NorthReference.GRID: 'GN'>)
Grid azimuths are turned onto true north with the grid convergence at the wellhead before minimum curvature is run; see Computing a trajectory. This needs a conformal projection, one that preserves angles.
Surveys that describe no wellbore¶
The stations must give one value each, as flat sequences of finite numbers:
Survey([0, 500, 1000], [0, 10], [0, 0, 0])
InvalidSurveyError: md, inclination and azimuth must give one value per station, not [3, 2, 3]
The rest is checked when minimum curvature runs: at least two stations, MD strictly increasing, inclinations between 0 and 180 degrees:
compute_trajectory(
Survey([0, 500, 400], [0, 10, 20], [0, 0, 0]), (500000.0, 6600000.0), "EPSG:32631"
)
InvalidSurveyError: MD must strictly increase; it does not at 400
Two consecutive stations pointing in opposite directions do not determine
a unique arc plane, which raises
DegenerateSurveyError:
compute_trajectory(
Survey([0, 100, 200], [0, 90, 90], [0, 0, 180]), (500000.0, 6600000.0), "EPSG:32631"
)
DegenerateSurveyError: the hole reverses direction at MD 200, which does not determine a unique arc plane