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

Class for representing the content of one logical LAS file. More...

Public Member Functions

void AddCurve (LasCurve curve)
 Add the specified curve to the default definition section of this LAS file.
 
void AddCurve (string definitionSectionName, LasCurve curve)
 Add the specified curve to this LAS file and associate it with the section of the given name.
 
void AddSection (LasSection section)
 Add the specified section to this LAS file.
 
void ClearCurves ()
 Clear all curves of this LAS file.
 
void ClearCurves (LasSection dataSection)
 Clear the curves of the specified data section.
 
LasSection FindDataSection (LasSection definitionSection)
 Find the data section of a given definition section.
 
LasSection FindOtherSection ()
 Find the "other" section of this LAS file.
 
LasSection FindParameterSection ()
 Find the parameter section of this LAS file.
 
LasSection FindSection (string name)
 Find the first section starting with the specified name.
 
LasSection FindVersionSection ()
 Find the version section of this file.
 
LasSection FindWellSection ()
 Find the well section of this LAS file.
 
IList< LasCurveGetCurves ()
 Return the curves of this LAS file.
 
IList< LasCurveGetCurves (LasSection dataSection)
 Return the curves of the specified data section.
 
IList< LasSectionGetDataSections ()
 Return all the data sections of this LAS file.
 
char GetFieldDelimiter ()
 Get the data field delimiter of this LAS file.
 
string GetName ()
 Return the name of this LAS file.
 
string GetNoValue ()
 Get the string that defines no-value for this LAS file when the file is written to disk.
 
string GetParameterValue (string parameterName)
 Return the value of the specified parameter.
 
DateTime? GetParameterValueAsDate (LasSection section, string parameterName)
 Return the specified parameter in the given section as a date.
 
double? GetParameterValueAsDouble (LasSection section, string parameterName)
 Return the value of the specified parameter as a double.
 
IList< LasSectionGetSections ()
 Return all the sections of this LAS file.
 
LasVersion GetVersion ()
 Return the version of this LAS file.
 
bool HasCurveData ()
 Check if this LAS file instance contains bulk data.
 
 LasFile (string name, LasVersion version)
 Create an empty LAS file instance that can be populated with data and later saved to disk.
 
override string ToString ()
 

Detailed Description

Class for representing the content of one logical LAS file.

A LAS file is a collection of metadata sections and curves.

Author
Petroware AS

Constructor & Destructor Documentation

◆ LasFile()

LasFile ( string name,
LasVersion version )

Create an empty LAS file instance that can be populated with data and later saved to disk.

The mandatory ~Version section will be auto-populated.

The mandatory ~Well section must be created by the client, but parameters associated with the curve data (STRT, STOP, STEP and NULL) will be auto-populated if the section is present.

Required parameter sections must be provided by the client.

The definition section(s) will be auto-populated based on provided curves.

The instance may later be written to file using LasFileWriter.

Parameters
nameName of LAS file. Null if none.
versionLAS version. Non-null.
Exceptions
ArgumentNullExceptionIf version is null.

Member Function Documentation

◆ AddCurve() [1/2]

void AddCurve ( LasCurve curve)

Add the specified curve to the default definition section of this LAS file.

The first curve added will be the index curve. Curves should be prepopulated with values, and should all have the same number of values.

If a well section has been added to the LAS file instance prior to calling addCurve, the STRT, STOP and STEP entries will automatically be included if they are not present already. If they are present, no validation will be done on these entries.

If values are added to the curves after they are added to the LAS file instance, the client must take responsibility for the STRT, STOP and STEP entries.

Parameters
curveCurve to add. Non-null.
Exceptions
ArgumentNullExceptionIf curve is null.
ArgumentExceptionIf curve has an invalid number of values.

◆ AddCurve() [2/2]

void AddCurve ( string definitionSectionName,
LasCurve curve )

Add the specified curve to this LAS file and associate it with the section of the given name.

The first curve added will be the index curve. Curves should be pre-populated with values, and should all have the same number of values.

If this is LAS 2.0 the specified section name is not used as the definition and data sections are implicit. Null may be specified in this case. If this is LAS 3.0 the specified section name must be without the "~" prefix and "_Definition"/"_Data" suffix. If null is specified, the default "Log" name is being used.

If a well section has been added to the LAS file instance prior to calling AddCurve, the STRT, STOP and STEP entries will automatically be included if they are not present already. If they are present, no validation will be done on these entries.

If values are added to the curves after they are added to the LAS file instance, the client must take responsibility for the STRT, STOP and STEP entries.

Parameters
definitionSectionNameName of definition section to add to. Null for default.
curveCurve to add. Non-null.
Exceptions
ArgumentNullExceptionIf curve is null.
ArgumentExceptionIf curve has an invalid number of values.

◆ AddSection()

void AddSection ( LasSection section)

Add the specified section to this LAS file.

Parameters
sectionSection to add. Non-null.
Exceptions
ArgumentNullExceptionIf section is null.

◆ ClearCurves() [1/2]

void ClearCurves ( )

Clear all curves of this LAS file.

This method is typically used with files of LAS 2.0 where there is only one set of curves.

◆ ClearCurves() [2/2]

void ClearCurves ( LasSection dataSection)

Clear the curves of the specified data section.

This method is typically used with files of LAS 3.0 where multiple data sections are possible. For LAS 2.0 the ClearCurves() (without an argument) can be used for the same purpose.

Parameters
dataSectionThe data section to clear the curves of. Non-null


Exceptions
ArgumentNullExceptionIf dataSection is null.
ArgumentExceptionIf LasSection is of section type data.

◆ FindDataSection()

LasSection FindDataSection ( LasSection definitionSection)

Find the data section of a given definition section.

A data section will have an association pointer to its definition as follows:

    ~XXX_Definition

    ~XXX_Data | XXX_Definition
  

Passing the XXX_Definition section into this method will return the XXX_Data section.

For LAS 2.0 there is an implicit association between the "CURVE" section and the corresponding "ASCII" section which is handled in this method.

Parameters
definitionSectionSection to find data section of. Non-null.
Returns
Associated data section, or null if non-existing.
Exceptions
ArgumentNullExceptionIf definitionSection is null.

◆ FindOtherSection()

LasSection FindOtherSection ( )

Find the "other" section of this LAS file.

This section is a feature of LAS version <= 2.0 only.

Returns
Other section of this LAS file. Null if not found.

◆ FindParameterSection()

LasSection FindParameterSection ( )

Find the parameter section of this LAS file.

This method is most useful for LAS 2.0 files where there is exactly one parameter section of a predefined name. In LAS 3.0 there may be several parameter sections with arbitrary names.

Returns
Parameter section of this LAS file. Null if not found.

◆ FindSection()

LasSection FindSection ( string name)

Find the first section starting with the specified name.

The search is case insensitive.

Parameters
name(Start of) name of section to find. "W" or "WELL" will both return the "~WELL" section and so on. Non-null.
Returns
The requested section, or null if not found.
Exceptions
ArgumentNullExceptionIf name is null.

◆ FindVersionSection()

LasSection FindVersionSection ( )

Find the version section of this file.

Returns
Version section of this file. Never null.

◆ FindWellSection()

LasSection FindWellSection ( )

Find the well section of this LAS file.

The well section is mandatory in LAS files, but if this instance originates from a file where it was not present, it may still be absent.

Returns
Well section of this LAS file. Null if not found.

◆ GetCurves() [1/2]

IList< LasCurve > GetCurves ( )

Return the curves of this LAS file.

This methods is typically used with files of LAS 2.0 where there is only one set of curves.

Returns
The curves of this LAS file. Never null. The first curve in the list is always the index curve.

◆ GetCurves() [2/2]

IList< LasCurve > GetCurves ( LasSection dataSection)

Return the curves of the specified data section.

This methods is typically used with files of LAS 3.0.

For LAS 2.0 this method can be called with the ascii section as argument, or GetCurves() (without arguments) can be used.

Parameters
dataSectionData section of curves to get. Non-null.
Returns
The requested curves. Never null.
Exceptions
ArgumentNullExceptionIf dataSection is null.

◆ GetDataSections()

IList< LasSection > GetDataSections ( )

Return all the data sections of this LAS file.

For a LAS 2.0 file this will be at most one, while for LAS 3.0 it may be several. In any case, the associated curves can be retrieved by the GetCurves(LasSection dataSection) method.

Returns
All the data sections of this LAS file. Never null.

◆ GetFieldDelimiter()

char GetFieldDelimiter ( )

Get the data field delimiter of this LAS file.

The field delimiter is defined in the DLM parameter of the VERSION section. For LAS 2.0 the field delimiter is always ' '.

Returns
Field delimiter character of this file. One of ' ', ',' or '\t'. If it is not defined, ' ' is returned.

◆ GetName()

string GetName ( )

Return the name of this LAS file.

Typically the name of the back-end disk file, or null if not set.

Returns
Name of this file. May be null.

◆ GetNoValue()

string GetNoValue ( )

Get the string that defines no-value for this LAS file when the file is written to disk.

The no-value is defined in the NULL parameter of the ~WELL section.

NOTE: This is for information only; The client program should use null consistently when specifying or testing for no-value.

Returns
No-value of this file, or the default if not found. Never null.

◆ GetParameterValue()

string GetParameterValue ( string parameterName)

Return the value of the specified parameter.

Search all sections.

Parameters
parameterNameName of parameter to get value of. Non-null.
Returns
The requested parameter value, or null if the value is unspecified or the parameter is not found.
Exceptions
ArgumentNullExceptionIf parameterName is null.

◆ GetParameterValueAsDate()

DateTime? GetParameterValueAsDate ( LasSection section,
string parameterName )

Return the specified parameter in the given section as a date.

If the parameter is not found, or if the parameter isn't a valid date, null is returned. Several date formats are checked in order to parse the parameter value.

NOTE: This method is at the file level rather than the section level as no-values needs to be resolved. The no-value concept is defined at the file level.

Parameters
sectionSection to find value from. Null to search all sections.
parameterNameName of parameter to get date of. Non.null.
Returns
The requested date, or null if it is no-value, not found or not of date type.
Exceptions
ArgumentNullExceptionIf parameterName is null.

◆ GetParameterValueAsDouble()

double? GetParameterValueAsDouble ( LasSection section,
string parameterName )

Return the value of the specified parameter as a double.

NOTE: This method is at the file level rather than the section level as no-values needs to be resolved. The no-value concept is defined at the file level.

Parameters
sectionSection to query. Null to search all sections.
parameterNameName of parameter to get value of. Non-null.
Returns
The parameter value as a double, or null if it is no-value, if it doesn't exist or isn't numeric.
Exceptions
ArgumentNullExceptionIf parameterName is null.

◆ GetSections()

IList< LasSection > GetSections ( )

Return all the sections of this LAS file.

Returns
All the sections of this LAS file. Never null.

◆ GetVersion()

LasVersion GetVersion ( )

Return the version of this LAS file.

Returns
Version of this LAS file. If not defined, or not yet read, version 2.0 is returned. Never null.

◆ HasCurveData()

bool HasCurveData ( )

Check if this LAS file instance contains bulk data.

Returns
True if the instance contains curve data, false otherwise.

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