Package: las-py
Las-pylas-py is a zero-dependency Python library for parsing .Las file (Geophysical/Canadian well log files).Currently supports only version 2.0 of LAS Specification. For more information about this format, see the Canadian Well Logging Societyweb pageWhat's new in 1.1.0Export to csvExport to csv without rows containing null valuesBug fixesTo Install$pipinsatlllas-pyUsagefromlas_pyimportLaspymy_las=Laspy('path_to_las_file.las')Read datadata=my_las.dataprint(data)#[[2650.0, 177.825, -999.25, -999.25], [2650.5, 182.5, -999.25,-999.25], [2651.0,180.162, -999.25, -999.25], [2651.5, 177.825, -999.25, -999.25], [2652.0, 177.825, -999.25, -999.25] ...]# get data with rows that has null value strippeddata=my_las.data_strippedprint(data)#[[2657.5, 212.002, 0.16665, 1951.74597], [2658.0, 201.44, 0.1966, 1788.50696], [2658.5, 204.314, 0.21004, 1723.21204], [2659.0, 212.075, 0.22888, 1638.328], [2659.5, 243.536, 0.22439, 1657.91699]...]Get the log headersheaders=my_las.headerprint(headers)# ['DEPTH', 'GR', 'NPHI', 'RHOB']Get the log headers descriptionshds_and_desc=my_las.header_and_descrprint(hds_and_desc)# {DEPTH': 'DEPTH', 'GR': 'Gamma Ray', 'NPHI': 'Neutron Porosity','RHOB': 'Bulk density'}Get a particular column, say Gamma Ray logGR=my_las.column('GR')print(GR)# [-999.25, -999.25, -999.25, -999.25, -999.25, 122.03, 123.14, ...]# get column with null values strippedGR=my_las.column_stripped('GR')print(GR)# [61.61, 59.99, 54.02, 50.87, 54.68, 64.39, 77.96, ...]Note this returns the column, after all the data has been stripped off their null values, which means that valid data in a particular column would be stripped off if there is another column that has a null value at that particular rowGet the Well ParametersPresents a way of accessing the details individual well parameters.The details include the following:1. descr - Description/ Full name of the well parameter
  2. units - Its unit measurements
  3. value - Valuestart=my_las.well.STRT.value# 1670.0stop=my_las.well.STOP.value#  1669.75null_value=my_las.well.NULL.value#  -999.25# Any other well parameter present in the file, canbe gotten with the same syntax aboveGet the Curve ParametersPresents a way of accessing the details individual log columns.The details include the following:1. descr - Description/ Full name of the log column
  2. units - Unit of the log column measurements
  3. value - API value of the log columnNPHI=my_las.curve.NPHI.descr# 'Neutron Porosity'RHOB=my_las.curve.RHOB.descr# 'Bulk density'# This is the same for all log column present in the fileGet the Parameters of the wellThe details include the following:1. descr - Description/ Full name of the log column
  2. units - Unit of the log column measurements
  3. value - API value of the log columnBHT=my_las.param.BHT.descr# 'BOTTOM HOLE TEMPERATURE'BHT_valaue=my_las.param.BHT.value# 35.5BHT_units=my_las.param.BHT.units# 'DEGC'# This is the same for all well parameters present in the fileGet the number of rows and columnsrows=my_las.row_counts# 4columns=my_las.column_counts# 3081Get the version and wrapversion=my_las.version# '2.0'wrap=my_las.wrap# 'YES'Get other informationother=my_las.otherprint(other)# Note: The logging tools became stuck at 625 metres causing the data# between 625 metres and 615 metres to be invalid.Export to CSVThis writes a csv file to the current working directory, with headers of the well and data section only.my_las.to_csv('result')# result.csv has been created Successfully!result.csvDEPTRHOBGRNPHI0.5-999.25-999.25-0.081.0-999.25-999.25-0.081.5-999.25-999.25-0.04............1.3-999.25-999.25-0.08Or get the version of csv with null values strippedmy_las.to_csv_stripped('clean')# clean.csv has been created Successfully!clean.csvDEPTRHOBGRNPHI80.52.77118.6-6.0881.02.76117.4-6.081.52.75216.4-5.96............80.52.76216.2-5.06Supportlas-py is an MIT-licensed open source project. You can help it grow by becoming a sponsor/supporter. Donate onPatreon