Log I/O
Loading...
Searching...
No Matches
LisFileReader Class Referencesealed

Class for reading LIS files (sometimes also referred to as TAP files). More...

Public Member Functions

 LisFileReader (FileInfo file)
 Create a LIS reader for the specified disk file.
 
 LisFileReader (Stream inputStream)
 Create a LIS file reader for the specified stream.
 
IList< LisFileRead (bool shouldReadCurveData=true, bool shouldCaptureStatistics=false, ILisDataListener dataListener=null)
 Read all logical LIS files of this disk file.
 
void ReadData (IList< LisFile > lisFiles, bool shouldCaptureStatistics=false, ILisDataListener dataListener=null)
 Read data from a set of LIS files where the meta data has already been read.
 

Static Public Member Functions

static double IsLisFile (FileInfo file, byte[] content=null)
 Get the probability that the specified file is a LIS file.
 

Detailed Description

Class for reading LIS files (sometimes also referred to as TAP files).

Typical usage:

    LisFileReader reader = new LisFileReader(new FileInfo("path/to/file"));
    IList<LisFile> lisFiles = reader.Read(true);

If the curve data is not needed, it is possible to read only the meta-data from the disk file. The curve data may be filled in later:

    LisFileReader reader = new LisFileReader(new FileInfo("path/to/file"));
    IList<LisFile> lisFiles = reader.Read(false);
    :
    reader.ReadData(lisFiles);

Note that even if only meta-data is read, all curve information are properly established as this information comes from meta-data. Only the curve values will be missing.

If disk files are larger than physical memory, it is possible to stream (process than throw away) the data during read. See LisDataListener. The same mechanism may be use to be able to abort the reading process during the operation.

See also
LIS 79 Documentation
Author
Petroware AS

Constructor & Destructor Documentation

◆ LisFileReader() [1/2]

LisFileReader ( Stream inputStream)

Create a LIS file reader for the specified stream.

Note: The client owns the stream and is responsible for closing it after the read operation is complete.

Parameters
inputStreamStream to read. Non-null.
Exceptions
ArgumentNullExceptionIf stream is null.

◆ LisFileReader() [2/2]

LisFileReader ( FileInfo file)

Create a LIS reader for the specified disk file.

Parameters
fileDisk file to read. Non-null.
Exceptions
ArgumentNullExceptionIf file is null.

Member Function Documentation

◆ IsLisFile()

static double IsLisFile ( FileInfo file,
byte[] content = null )
static

Get the probability that the specified file is a LIS file.

The check can be done with or without considering the content of the file. In the former case, only the file name (typically the extension) is considered. In the latter case a portion of the start of the file is used to match for known patterns. By passing the portion as an argument, the client code can read this once and then pass it to different classifiers in order to determine its most likely type.

Getting a portion of a file can be done by:

    FileInfo file = ...;
    BinaryReader reader = new BinaryReader(file.OpenRead());
    byte[] content = new byte[2000]; //say
    reader.Read(content, 0, content.Length);
    reader.Close();
Parameters
fileFile to check. Null to classify on content only.
contentA number of bytes from the start of the file. Null to classify on file name only.
Returns
Probability that the file is a LIS file. [0.0,1.0].

◆ Read()

IList< LisFile > Read ( bool shouldReadCurveData = true,
bool shouldCaptureStatistics = false,
ILisDataListener dataListener = null )

Read all logical LIS files of this disk file.

Parameters
shouldReadCurveDataIndicate if bulk data should be read. False to read header data only.
shouldCaptureStatisticsTrue to capture statistics per curve. Statistics capture will reduce read performance slightly, so set this to false if the statistics are not needed.
dataListenerListener that will be notified when new data has been read. Null if not used.
Returns
List of the logical LIS files contained in the file.
Exceptions
IOExceptionIf the read operation fails for some reason.
OperationCanceledExceptionIf the client returns false from the IDlisDataListener.DataRead method.

◆ ReadData()

void ReadData ( IList< LisFile > lisFiles,
bool shouldCaptureStatistics = false,
ILisDataListener dataListener = null )

Read data from a set of LIS files where the meta data has already been read.

This will preserve the existing LisFile structure in case a LIS file is read in two operations:

    // Read meta data
    List<LisFile> lisFiles = reader.Read(false);

    // Read the curve data
    reader.readData(lisFiles);
  

There is nothing to gain in performance with this approach so in case the result is not cached, the following will be equivalent:

    // Read meta data
    List<LisFile> lisFiles = reader.Read(false);

    // Read the curve data
    lisFiles = reader.Read(true);
  
Parameters
lisFilesLIS files to populate. Non-null.
shouldCaptureStatisticsTrue to capture statistics per curve during read. Statistics capture will reduce read performance slightly, so set this to false if the statistics are not needed.
dataListenerListener that will be notified when new data has been read. Null if not used.
Exceptions
ArgumentNullExceptionIf lisFiles is null.
IOExceptionIf the read operation fails for some reason.
OperationCanceledExceptionIf the client returns false from the IDlisDataListener.DataRead method.

The documentation for this class was generated from the following file: