# True-vertical-depth
**by [Matt Hall](https://github.com/kwinkunks)**
We have some well data. Some of the wells have deviated (non-vertical) sections. All well sections are straight; the corners are not rounded. Each well record is represented by 7 numbers:
x y d k i a t
123,654,24,450,12,254,1200
These numbers are (_x_, _y_) of the surface location, the elevation of the datum _d_, the kick-off point _k_ (from the datum), the inclination _i_ and azimuth _a_ of the deviated section, and the total depth _t_ (measured along the hole from the datum).
Some wells have an unknown datum, denoted by 'UNK'; you should ignore them.
We wish to know:
1. What is the highest datum?
2. What is the greatest offset distance reached, **to the nearest metre**?
3. What is the greatest true vertical depth reached, **to the nearest metre**?
4. At a TVDSS of -2000 m, how many wells have **an absolute _y_-offset** of more than 100 m?
Note the following assumptions and definitions:
- *Measured depth* is measured along the well path, starting at the top, and is always positive.
- Elevations are positive above sea-level, and negative below sea-level.
- *True vertical depth sub-sea*, or TVDSS, is the vertical depth below mean sea level.
- The *offset distance* is the horizontal distance from the surface location to the bottomhole location.
- The section of the well above the *kick-off point* is vertical.
- A kick-off point of -999.25 indicates that there is no deviated section.
- The 'deviated' section of the well below the kick-off point is straight but inclined at _i_ degrees off the vertical.
- On a map, the deviated section of the well is oriented towards the direction _a_ degrees clockwise from North.
This diagram might help. Then again, it might not.
## Example wells
Your questions relate to the collection of wells. In this example, we'll look at just one well:
212,32,68,322,8,295,2630
- The datum of this well is **68** m above sea-level.
- The offset distance at the bottom of this well is about 321.21 m, or **321** to the nearest m.
- The TVDSS at the bottom of this well is -2539.54 m, or **-2540** to the nearest m.
- At a TVDSS of -2000 m, this well has a y-offset of 103.7 m and therefore would be counted for question 4.
Let's look at another well.
416,232,89,-999.25,-999.25,-999.25,1989
- The datum of this well is **89** m above sea-level.
- The offset distance at the bottom of this well is **0** m; it is not deviated.
- The TVDSS at the bottom of this well is **-1900** m.
- This well does not reach -2000 m.
## A quick reminder how this works
This document is formatted in [Markdown](https://daringfireball.net/projects/markdown/).
You can retrieve your data, which is always a string, by choosing a **``** (also a string). This ensures that you have different data from other people, so be creative.
```
url = 'https://kata.scienxlab.org/challenge/true-vertical-depth'
params = {
'key': # Replace with your own string.
}
r = requests.get(url, params)
r.text
```
To answer question 1, change the `params`:
```
params = {
'key': , # Use the same key you used to get your input.
'question': 1,
'answer': 1234 # Your answer; can be a float, int, list or array;
# the challenge description will tell you which.
}
```
To get a hint for a question, provide the question number but no answer:
```
params = {
'question': 1,
}
```
[Complete instructions at kata.scienxlab.org](https://kata.scienxlab.org/challenge)
[An example notebook to get you started](https://gist.github.com/kwinkunks/50f11dac6ab7ff8c3e6c7b34536501a2)
----
© 2024 [Scienxlab](https://scienxlab.org/) — Code: openly licensed under [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0) — Text: openly licensed under [CC BY](https://creativecommons.org/licenses/by/4.0/).