LogIo.Net  0.9
by Petroware AS
LogIo.Net Documentation

The Petroware AS LogIo.Net module is a .Net library for accessing DLIS log files.

An example program is shown below:

using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
namespace Test
{
// <summary>
// Class for testing the LogIo.Net API.
// </summary>
class LogIoTest
{
public static void Main(string[] arguments)
{
FileInfo file = new FileInfo("path/to/file.DLIS");
//
// Write some meta information about the disk file
//
Console.WriteLine("File: " + file.FullName);
if (!file.Exists) {
Console.WriteLine("File not found.");
return;
}
Console.WriteLine("Size: " + file.Length);
//
// Read the DLIS file including bulk data. Report the performance.
//
DlisFileReader reader = new DlisFileReader(file);
Console.WriteLine();
Console.WriteLine("Reading...");
Stopwatch stopwatch = Stopwatch.StartNew();
IList<DlisFile> dlisFiles = reader.Read(true);
Console.WriteLine("Done in " + stopwatch.ElapsedMilliseconds + "ms.");
//
// Write the DLIS file header
//
Console.WriteLine();
Console.WriteLine("-- File header:");
Console.WriteLine(dlisFiles[0].GetHeader());
//
// Report number of subfiles. Loop over each of them.
//
Console.WriteLine();
Console.WriteLine("The file contains " + dlisFiles.Count + " subfile(s):");
foreach (DlisFile dlisFile in dlisFiles) {
//
// Report subfile ID
//
Console.WriteLine();
Console.WriteLine("File ID: " + dlisFile.GetFileId());
Console.WriteLine();
//
// Report the meta-data we can conveniently extract through DlisUtil
//
Console.WriteLine("-- Meta-data as reported by DlisUtil:");
Console.WriteLine("Well name.........: " + DlisUtil.GetWellName(dlisFile));
Console.WriteLine("Run number........: " + DlisUtil.GetRunNumber(dlisFile));
Console.WriteLine("Field name........: " + DlisUtil.GetFieldName(dlisFile));
Console.WriteLine("Producer name.....: " + DlisUtil.GetProducerName(dlisFile));
Console.WriteLine("Company...........: " + DlisUtil.GetCompany(dlisFile));
Console.WriteLine("Country...........: " + DlisUtil.GetCountry(dlisFile));
Console.WriteLine("Start date........: " + DlisUtil.GetStartDate(dlisFile));
Console.WriteLine("Bit size..........: " + DlisUtil.GetBitSize(dlisFile));
Console.WriteLine("MD................: " + DlisUtil.GetMd(dlisFile));
Console.WriteLine("Index type........: " + DlisUtil.GetIndexType(dlisFile));
Console.WriteLine("Header identifier.: " + DlisUtil.GetHeaderIdentifier(dlisFile));
double[] interval = DlisUtil.GetInterval(dlisFile);
Console.WriteLine("Interval..........: " + interval[0] + " - " + interval[1]);
//
// Report all the meta-data
//
Console.WriteLine();
Console.WriteLine("-- Meta-data details:");
Console.WriteLine();
Console.WriteLine("The subfile contains " + dlisFile.GetSets().Count + " set(s):");
Console.WriteLine();
foreach (DlisSet set in dlisFile.GetSets()) {
Console.WriteLine("Set type: " + set.GetSetType() + " (Name = " + set.GetName() + ")");
// This will write all the set content as a matrix
// Console.WriteLine(set);
}
//
// Encrypted records
//
Console.WriteLine();
Console.WriteLine("-- The subfile contains " + dlisFile.GetEncryptedRecords().Count + " encrypted record(s).");
//
// Report number of frames in this sub file. Loop over each of them.
//
Console.WriteLine();
Console.WriteLine("-- Curve information:");
Console.WriteLine();
Console.WriteLine("The subfile contains " + dlisFile.GetFrames().Count + " frame(s):");
foreach (DlisFrame frame in dlisFile.GetFrames()) {
int nCurves = frame.GetCurves().Count;
int nValues = frame.GetCurves().Count > 0 ? frame.GetCurves()[0].GetNValues() : 0;
//
// Report frame ID and #curves and #values
//
Console.WriteLine();
Console.WriteLine("Frame " + frame.GetName() +
" (" + nCurves + " curves of " + nValues + " values each):");
Console.WriteLine();
//
// For each curve, report name, dimension, unit, type and description, ...
//
foreach (DlisCurve curve in frame.GetCurves()) {
Console.WriteLine(" " + curve.GetName() +
"[" + curve.GetNDimensions() + "], " +
curve.GetUnit() + ", " +
curve.GetValueType() +
"(" + curve.GetRepresentationCode() + "), " +
curve.GetDescription());
//
// ... and the first few values from the first couple of dimensions:
//
for (int dimension = 0; dimension < curve.GetNDimensions(); dimension++) {
Console.Write(" ");
for (int index = 0; index < curve.GetNValues(); index++) {
Console.Write(curve.GetValue(dimension, index) + "; ");
if (index == 2) break; // Write a few values only
}
Console.WriteLine("...");
if (dimension == 2) { // Write a few dimensions only
Console.WriteLine(" :");
break;
}
}
}
}
}
}
}
}