-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadLAS.py
44 lines (34 loc) · 1000 Bytes
/
ReadLAS.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import lasio
import os
import pandas as pd
def Get_Las_Files(path=None):
Wellname = []
CurveName = []
Data = []
frames = []
rejected_files=[]
x = os.listdir(path)
#Get Well Name
for files in x:
f = str(files)
try:
las = lasio.read(path+f)
#Get wellnames
well = las.well.WELL.value
Wellname.append(well)
#Get curve names
curves = las.keys()
CurveName.append(curves)
#Get data
data = las.data
Data.append(data)
#Create dataframe per well
df = pd.DataFrame(data = data, columns=curves)
df["Wellname"] = well
frames.append(df)
except:
rejected_files.append(files)
#Concat all the df containing one well into one big df
result = pd.concat(frames, sort=True)
result.reset_index(inplace=True)
return (result, rejected_files)