Introduction

The following outlines a typical workflow for analyzing and manipulating data from a LAS file using lastools functionality, and expands on function documentation by way of example/s.

Workflow

The typical workflow for analyzing and manipulating data from a LAS file typically comprises of:

Compile LAS files

It is common for a company to have many hundreds or thousands of LAS files across a disparate file structure. However, it may be more convenient (in order to perform analytics or for loading/writing LAS) to have LAS files stored in a single file location.

As a first step the below examples how you might compile (copy) all ".las" files from a target directory to a nominated locaiton by creating a quick 'compile' function

#source directory
s <- c("C:/")
# create a target directory on the file system called "compiled_las"
#target directory
t <- c("C:/compiled_las")

las_compile <-  function (s,t)
{

  list.of.files <- list.files(s, pattern = "\\.las$",recursive = TRUE, full.names = T)
  file.copy(list.of.files,t)
}

#compile las takes .las files from the source directory and moves to the target directory
las_compile(s,t)

Read LAS file/s to R

'lastools' provides two ways to load las data. The first is to load a LAS file as a LAS 'Object' (using lastools::read_las). The second is to load LAS curve data to an R data.table by using lastools::read_las_data_df. The latter is really just a wrapper for read_las, however is convenient for rapidly compiling multiple LAS data sets to a flat file structure.

Note that the majority of functions in lastools (convert, plot etc.) expect a LAS 'object', created from lastools::read_las.

Also note that the ability to compile the curve data of >10 LAS files direct to flat file format (R data.table) is a unique feature as compared to other (freely available) packages/software.

To load a single LAS file to a LAS object is rudimentary. The function lastools::read_las simply expects a directory path to the LAS file of interest.

lastools::read_las("filepath")

Note that specified NULL values in the LAS file (usually some numeric value) are set to 'NA' by default; to keep NULL values simply use 'replace_null =FALSE'.

lastools::read_las("filepath",replace_null =FALSE)

Loading LAS file LOG data to data.table is also rudimentary and supports bulk loading at a directory level (no need to nominate an exact file-path to a LAS file). This function will compile all LAS log data (.las files) into a long format data table by well/file. Due to the potential variety in NULL numeric values from differing LAS files, all NULL values are set to R NA value

lastools::read_las_data_df("directory")

LAS Object

A lastools 'LAS object' is an 'R' representation of a LAS file and is returned when using the lastools::read_las function. The representation comprises of a list object with list sections WELL, CURVE, PARAMETER and LOG are data.frames while OTHER is a string with line breaks. VERSION is a numeric (1.2 or 2.0).

Each section is representative of the most pertinent sections of a LAS file. Below is an example of each section using the example 'LAS object' data provided with lastools (accessible as lastools::example_las_obj)

Well Section

Contains detail on the borehole (well) such as the well identifier, service company, locality details, start and stop depths etc.

library(lastools)
knitr::kable(lastools::example_las_obj$WELL,digits = 3,align = c("c"), caption = "lastools::example_las_obj$WELL")

Curve section

Contains the detail (API codes and long descriptions) of the log data headings

library(lastools)
knitr::kable(lastools::example_las_obj$CURVE,digits = 3,align = c("c"), caption = "lastools::example_las_obj$CURVE")

Parameter section

Contains additional details at the discretion of the service company or the requesting company

library(lastools)
knitr::kable(lastools::example_las_obj$PARAM,digits = 3,align = c("c"), caption = "lastools::example_las_obj$PARAM")

#lastools::read_las("L:\\Coal_Quality\\R LIBRARY\\Packages\\lastools\\las_files\\PMI2279.las")

Log section

Contains the actual response data in flat file (wide) format. Column names are typically codes which are fully described in the Curve section

library(lastools)
knitr::kable(head(lastools::example_las_obj$LOG, n=10),digits = 3,align = c("c"), caption = "lastools::example_las_obj$LOG")

Convert/standardize LAS

Once a LAS file is loaded to memory as a LAS object, a number of convinience functions are available to modify the LAS version and well information.

These include:

As an example, a common issue with LAS files from different vendors is inconsistant white space in the well id field and incosistancy in the order of depth increments (acending vs decending). In this case it might

library(lastools)

References



Gitmaxwell/lastools documentation built on May 16, 2020, 2:46 p.m.