I'm writing this post because I'm having trouble with the last step of my code: data exportation of a .las file. The code seems to work fine but when I open the written file, it happens there's no data in it, only the file header.
For those who are not familiar with .las files formatting, it is a world-wide accepted simple format used for the exchange of well log data. In other words, it's just an ascii file, with a header and the data arranged in a matrix way. Rows/indexes is usually represent depth and Columns correspond to different variables.
My code is actually very simple in essence. It imports a .las file, calculates a new curve using as input two of the imported ones and appends the result to the wells data.
You can access to the .las file here.
pip install welly
from welly import Project, Well, Curve
alias_dict = {'Sonic P': ['DT', 'DT4P'],
'Sonic S': ['DTS'],
'Bulk Density': ['RHOB'],
'Caliper': ['HCAL', 'CALI'],
}
#Instantiate the well from a Project object.
p = Project.from_las("/content/15_9-F-1A.LAS")
well = p.get_wells()[0]
# Get the curves separated:
rhob = well.get_curve("Bulk Density",alias=alias_dict)
dt = well.get_curve("Sonic P",alias=alias_dict)
dts = well.get_curve('Sonic S', alias=alias_dict)
#Calculate the new curve:
values = rhob.as_numpy()*(dts.as_numpy()**2)
#Create a Curve object with the calculated data:
params = {'mnemonic': 'G', 'units': 'gunits','run':0}
G = Curve(values, **params)
#"Append" the calculated curve to the well data:
well.data["G"] = G
#Write a new .las file with the calculated column:
well.to_las('out.las')
You will see that the "out.las" has no data in it, only the header sections.
I hope someone can help me. Thanks in advance!