Log I/O
LasFile Class Reference

Class for representing the content of a LAS file in a structural manner. More...

Public Member Functions

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

Detailed Description

Class for representing the content of a LAS file in a structural manner.

A LAS file is a collection of sections (logging meta-data) and curves.

Author
Petroware AS

Constructor & Destructor Documentation

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 by:

    LasFileWriter.Write(new FileInfo("/path/to/file.LAS"), lasFile);
  
Parameters
nameName of LAS file. Null if none.
versionLAS version. Non-null.
Exceptions
ArgumentNullExceptionIf version is null.

Member Function Documentation

void AddCurve ( LasCurve  curve)

Add the specified curve to this LAS file.

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 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 the curve has different number of values than the existing ones.
void AddSection ( LasSection  section)

Add the specified section to this LAS file.

Parameters
sectionSection to add. Non-null.
Exceptions
ArgumentNullExceptionIf section is null.
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 v2.0 there is an implicit association between the "CURVE" section and the corresponding "ASCII" section. This is handled here as well.

Parameters
definitionSectionSection to find data section of. Non-null.
Returns
Associated data section, or null if non-existing.
Exceptions
ArgumentNullExceptionIf definitionSection is null.
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.
LasSection FindParameterSection ( )

Find the parameter section of this LAS file.

Returns
Parameter section of this LAS file. Null if not found.
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.
LasSection FindVersionSection ( )

Find the version section of this file.

Returns
Version section of this file. Null if not found.
LasSection FindWellSection ( )

Find the well section of this LAS file.

Returns
Well section of this LAS file. Null if not found.
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.
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.
char GetFieldDelimiter ( )

Get the data field delimiter of this LAS file.

The field delimiter is defined in the DLM parameter of the VERSION section.

Returns
Field delimiter character of this file. One of ' ', ',' or '\t'. If it is not defined, or not yet read, ' ' is returned.
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.
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.
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.
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.
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.
IList<LasSection> GetSections ( )

Return all the sections of this LAS file.

Returns
All the sections of this LAS file. Never null.
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.
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: