forked from petroGG/Basic-Well-Log-Interpretation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlastotext.py
27 lines (23 loc) · 811 Bytes
/
lastotext.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'''
Walakpa1 Well data is available in LAS format.
In file:
- curves names are located at the beginning of lines 20 - 31;
- log data start at the line 37.
'''
start_curves_names=19
end_curves_names=31
start_log_data=36
lasfile='WA1.las'
txtfile='WA1.txt'
lines = open(lasfile).read().splitlines()
#Read the name of the curves from las and write them in txt file:
curves=[]
for line in lines[start_curves_names:end_curves_names]:
curves.append(line.split()[0].split('.')[0])
header=str(curves).replace("['","").replace("']","").replace("', '"," ")
f=open(txtfile,'w')
f.write(header+'\n')
#Then read the log data which starts at line 37 (In Python is 36) and write it in the same .txt file:
for text in lines[36:]:
f.write(str(text).replace("['","").replace("']","")+'\n')
f.close()