-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwitsml.py
21 lines (20 loc) · 861 Bytes
/
witsml.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pathlib as path
import pandas as pd
from lxml import etree as et
from collections import defaultdict
import plotly.express as px
witsml = path.Path(r'D:\codes\python\volve_things\witsml')
data = defaultdict(list)
for file in witsml.rglob('*.xml'):
tree = et.parse(str(file))
for elem in tree.getiterator():
elem.tag = et.QName(elem).localname
for traj in tree.findall('trajectory/trajectoryStation'):
data['nameWell'].append(tree.find('trajectory/nameWell').text)
data['dispNs'].append(float(traj.find('dispNs').text))
data['dispEw'].append(float(traj.find('dispEw').text))
data['tvd'].append(float(traj.find('tvd').text)*-1)
data['incl'].append(traj.find('incl').text)
trajectory = pd.DataFrame(data)
fig = px.line_3d(trajectory, x="dispNs", y="dispEw", z="tvd", color='nameWell')
fig.show()