public final class LasFile extends Object
A LAS file is a collection of metadata sections and curves.
Constructor and Description |
---|
LasFile(String name,
LasVersion version)
Create an empty LAS file instance that can be populated with data and later
saved to disk.
|
Modifier and Type | Method and Description |
---|---|
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.
|
List<LasCurve> |
getCurves()
Return the curves of this LAS file.
|
List<LasCurve> |
getCurves(LasSection dataSection)
Return the curves of the specified data section.
|
List<LasSection> |
getDataSections()
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.
|
Date |
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.
|
List<LasSection> |
getSections()
Return all the sections of this LAS file.
|
LasVersion |
getVersion()
Return the version of this LAS file.
|
boolean |
hasCurveData()
Check if this LAS file instance contains bulk data.
|
String |
toString() |
public LasFile(String name, LasVersion version)
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 well section is present.
Required parameter sections must be provided by the client.
Definition and data section(s) will be auto-populated based on provided curves.
The instance may be written to file using LasFileWriter
.
name
- Name of LAS file. Null if none.version
- LAS version. Non-null.IllegalArgumentException
- If version is null.public String getName()
public List<LasSection> getSections()
public List<LasSection> getDataSections()
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.
public void addSection(LasSection section)
section
- Section to add. Non-null.IllegalArgumentException
- If section is null.public LasSection findSection(String name)
name
- (Start of) name of section to find. "W" or "WELL" will
return the "~Well" section and so on. Non-null.IllegalArgumentException
- If name is null.public LasSection findVersionSection()
public LasVersion getVersion()
public LasSection findWellSection()
public LasSection findParameterSection()
public LasSection findDataSection(LasSection definitionSection)
A data section will have an association pointer to its definition as follows:
~XXX_Definition ~XXX_Data | XXX_DefinitionPassing 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.
definitionSection
- Section to find data section of. Non-null.IllegalArgumentException
- If definitionSection is null.public LasSection findOtherSection()
public char getFieldDelimiter()
public String getNoValue()
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.
public List<LasCurve> getCurves(LasSection dataSection)
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.
At first invocation the data section is parsed and converted to the list of curves. The data records contained in the data section are removed after invocation to conserve memory. Subsequent invocations return a buffered list of curves.
dataSection
- The data section to find curves of. Non-null.IllegalArgumentException
- If dataSection is null.public List<LasCurve> getCurves()
This methods is typically used with files of LAS 2.0 where there is only one set of curves.
public void clearCurves()
public void clearCurves(LasSection dataSection)
clearCurves()
(without an argument) can be used for the same purpose.dataSection
- The data section to clear the curves of. Non-nullIllegalArgumentException
- If dataSection is null or not of LasSection.Type.DATA.public void addCurve(String definitionSectionName, LasCurve curve)
The first curve added to a section will be the index curve. Curves should be prepopulated 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.
definitionSectionName
- Name of definition section to add to. Null for default.curve
- Curve to add. Non-null.IllegalArgumentException
- If curve is null or if it has an invalid number or values.public void addCurve(LasCurve curve)
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.
curve
- Curve to add. Non-null.IllegalArgumentException
- If curve is null or if it has an invalid number or values.public String getParameterValue(String parameterName)
parameterName
- Name of parameter to get value of. Non-null.IllegalArgumentException
- If parameterName is null.public Double getParameterValueAsDouble(LasSection section, String parameterName)
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.
section
- Section to query. Null to search all sections.parameterName
- Name of parameter to get value of. Non-null.IllegalArgumentException
- If parameterName is null.public Date getParameterValueAsDate(LasSection section, String parameterName)
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.
section
- Section to find value from. Null to search all sections.parameterName
- Name of parameter to get date of. Non.null.IllegalArgumentException
- If parameterName is null.public boolean hasCurveData()
Copyright © 2024 Petroware AS - https://petroware.no