API / geotoolkit / welllog / data / LogData / LogData
This class is the default implementation of a welllog datasource. It contains both the index values (md, tvd, etc) and the corresponding log values. LogCurve can use LogData as a datasource to render a welllog as a curve in a track.
The LogData does not require the index to be strictly increasing and it will not sort the indices/values. It also keeps track of its state (typically for realtime scenario) through LogDataState. The LogData computes and maintains some statistics about its data (min, max) that are used by the shapes to render properly and efficiently.
Any data sample can be marked as null. Null data values are supported by visuals as breaks in the curve. The null value of sample can be specified using Number.NaN or NaN value.
It offers several functions to change the data it contains and will fire events accordingly. Note that most of the shapes that use LogData as datasource are optimized based on those events. Therefore care must be given when changing the data. For example, clearing and setting all the values+1 is more expensive than adding a value.
Example
import {LogData} from '@int/geotoolkit/welllog/data/LogData';
const data1 = new LogData('GR');
const data2 = new LogData(depths, values);
const data3 = new LogData({
'name': 'GR',
'depths': depths,
'values': values
});| Name | Type |
|---|---|
T | null |
↳
LogData
Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
indexunit | string | Unit index unit |
name | string | Name of data |
valuesunit | string | Unit values unit |
Constructors
• new LogData<T>(options?, values?)
Constructor
| Name | Type |
|---|---|
T | null |
| Name | Type | Description |
|---|---|---|
Optional options | string | number[] | Options<T> | array of depths, data name, or object |
Optional values | number[] | array of values |
LogAbstractData.constructor
Methods
▸ addValue(depth, value, metaInfo?): LogData<T>
Add values
| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
value | number | value at the specified depth |
Optional metaInfo | T | meta info |
LogData<T>
this
▸ addValues(depths, values, metaInfos?): LogData<T>
Add values at the bottom of the log
| Name | Type | Description |
|---|---|---|
depths | number[] | The array of ordered depths |
values | number[] | The array of values |
Optional metaInfos | T[] | meta info |
LogData<T>
this
▸ calculateNeatLimits(logScale, centerOnZeroOnNegativeMin, displayUnit): number[]
Return an array of neat min and max
| Name | Type | Description |
|---|---|---|
logScale | boolean | scale log scale |
centerOnZeroOnNegativeMin | boolean | If negative and positive values, center around 0 |
displayUnit | string | AbstractUnit | displayed unit |
number[]
LogAbstractData.calculateNeatLimits
▸ clear(): LogData<T>
Clear log data. Removes all samples and reset depth limits
LogData<T>
this
▸ dispose(): void
Dispose.
void
▸ getClassName(): string
string
▸ getDataOrder(): Order
Return the order of the log data
▸ getDepth(index): number
Return depth by index
| Name | Type | Description |
|---|---|---|
index | number | index at the depth |
number
▸ getDepths(): number[]
Return an array of depths
number[]
▸ getIndexAt(depth, fromIndex?, toIndex?): number
Return index for specified depth
| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the index |
Optional fromIndex | number | index of sample in depths |
Optional toIndex | number | index of sample in depths |
number
▸ getIndexUnit(): AbstractUnit
Return the value unit
Throws
when this method is not implemented
▸ getMaxDepth(): number
Return maximum depth
Throws
when this method is not implemented
number
▸ getMaxMeaningDepth(): number
Return maximum Meaning depth (last depth with value)
number
LogAbstractData.getMaxMeaningDepth
▸ getMaxValue(): number
Return maximum data value
number
▸ getMetaInfo(index): T
Gets additional info by index
| Name | Type | Description |
|---|---|---|
index | number | index |
T
▸ getMetaInfos(): T[]
Returns array of additional info
T[]
▸ getMinDepth(): number
Return minimum depth
Throws
when this method is not implemented
number
▸ getMinMeaningDepth(): number
Return minimum Meaning depth (first depth with value)
number
LogAbstractData.getMinMeaningDepth
▸ getMinValue(): number
Return minimum data value
number
▸ getName(): string
Return name of the data
string
▸ getProperties(): OptionsOut<T>
Gets all the properties pertaining to this object
OptionsOut<T>
properties object
▸ getSize(): number
Return the count of the samples
number
▸ getState(): LogDataState
Return state
▸ getTimeStamp(): number
Return the value to indicate if data source was changed
number
▸ getValue(index): number
Return value by index
| Name | Type | Description |
|---|---|---|
index | number | index of the sample in the array |
number
▸ getValueAt(depth, fromIndex?, toIndex?, interpolation?): number
Return the value matching the given depth or NaN if the given depth is out of the logdata depth range.
If the depths are strictly increasing:
- The returned value will be interpolated when necessary. See example 1
If the depths are not strictly increasing but never decreasing:
- The value returned will be the first one found (in the insertion order). See example 2
- The value returned will be interpolated between the last one found and its closest larger neighbor. See example 2
If the depths are not always increasing (not forward only):
- The value returned will be the last one found (in the insertion order). See example 3
- The value returned will be interpolated between the first one found and its closest larger neighbor. See example 3
Examples assume the default linear interpolation
Example
// Depth Value
// 0 0
// 100 1
// 200 2
getValueAt(100) // -> 1
getValueAt(150) // -> 1.5Example
// Depth Value
// 0 0
// 100 1
// 100 2
// 200 3
getValueAt(100) // -> 1
getValueAt(150) // -> 2.5Example
// Depth Value
// 0 0
// 100 1
// 200 2
// 100 3
getValueAt(100) // -> 3
getValueAt(150) // -> 1.5| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
Optional fromIndex | number | index of sample in depths |
Optional toIndex | number | index of sample in depths |
Optional interpolation | InterpolationType | interpolation type for the value |
number
▸ getValueInRange(depth, prev, next): number
Return value by depth, using linear interpolation if necessary.
See LogAbstractData.findValueAt.
| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
prev | number | The index of the largest previous depth |
next | number | The index of the smallest following depth |
number
LogAbstractData.getValueInRange
▸ getValueUnit(): AbstractUnit
Return the depth unit
Throws
when this method is not implemented
▸ getValues(): number[]
Return an array of values
number[]
▸ hasEventListener(type, callback?): boolean
Check if a list of event listeners for this type contains this listener
| Name | Type | Description |
|---|---|---|
type | string | type of event or property |
Optional callback | Function | to be called, if null, check if any callback is registered |
boolean
LogAbstractData.hasEventListener
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isForwardOnly(): boolean
Return true if data is in ascending order
boolean
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ mergeValue(depth, value, metaInfo?): LogData<T>
Insert/Replace the given value at the correct place in the log. This function works ONLY if the existing data is ordered.
Example
Depth Value
100 0
200 1
mergeValue(150,3)
Depth Value
100 0
150 3
200 1| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
value | number | value at the depth |
Optional metaInfo | T | meta info |
LogData<T>
this
▸ mergeValues(depths, values, checkValues?, metaInfos?): LogData<T>
Inserts/Replace the given values at the correct place in the log. This function works ONLY if the existing data is ordered.
Example
Depth Value
50 0
100 1
200 2
300 3
mergeValue([0,100,150,500], [-1,-100,-150,-500])
---- Depth Value
===> 0 -1
---- 50 0
===> 100 -100
===> 150 -150
---- 200 2
---- 300 3
===> 500 -500| Name | Type | Description |
|---|---|---|
depths | number[] | the place where to merge in the log |
values | number[] | the values to merge |
Optional checkValues | boolean | check values before merge |
Optional metaInfos | T[] | metaInfos |
LogData<T>
this
▸ mergeValuesInternal(depths, values, checkValues?, metaInfos?): LogData<T>
| Name | Type |
|---|---|
depths | number[] |
values | number[] |
Optional checkValues | boolean |
Optional metaInfos | T[] |
LogData<T>
▸ notify<E>(type, source, args?): LogData<T>
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | LogAbstractData | of the event |
Optional args | EventMap[E] | arguments of the event |
LogData<T>
this
▸ off<E>(type?, callback?): LogData<T>
Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
Optional type | E | type of the event |
Optional callback | (eventType: E, sender: LogData<T>, args: EventMap[E]) => void | function to be called |
LogData<T>
this
▸ on<E>(type, callback): LogData<T>
Attach listener on event that will be called whenever the specified event is delivered to the target
If the callback function is already in the list of event listeners for this target, the function is not added a second time.
If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | type of event or property |
callback | (eventType: E, sender: LogData<T>, args: EventMap[E]) => void | to be called |
LogData<T>
this
▸ parseFromString(depths, values): LogData<T>
Sets the depths and values of this logdata using the given string arrays. Uses parseFloat() to parse strings, also recognize 'NaN' values as Number.NaN.
| Name | Type | Description |
|---|---|---|
depths | string | array of strings |
values | string | array of strings |
LogData<T>
▸ removeValues(index, count): LogData<T>
Remove values
| Name | Type | Description |
|---|---|---|
index | number | position where to remove the values |
count | number | count of samples |
LogData<T>
this
▸ requestData(range, scale, callback?): void
| Name | Type | Description |
|---|---|---|
range | Range | range |
scale | number | scale |
Optional callback | () => void | callback to be called after loading data |
void
▸ resumeUpdate(forceUpdate): LogData<T>
Resume update. forceUpdate updates data statistics (update min, max of values, depths...)
| Name | Type | Description |
|---|---|---|
forceUpdate | boolean | force update based on the state of the data |
LogData<T>
this
▸ setIndexUnit(unit): LogData<T>
Sets index unit
| Name | Type | Description |
|---|---|---|
unit | string | AbstractUnit | index unit |
LogData<T>
this
▸ setMetaInfo(infos): LogData<T>
Sets array of additional info
| Name | Type | Description |
|---|---|---|
infos | T[] | additions |
LogData<T>
this
▸ setName(name): LogData<T>
Set name of the data
| Name | Type | Description |
|---|---|---|
name | string | The log data name |
LogData<T>
this
▸ setProperties(properties?): LogData<T>
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options<T> | An object containing the properties to set |
LogData<T>
this
▸ setSilent(bool): LogData<T>
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
LogData<T>
this
▸ setState(state): LogData<T>
Sets state of data. Values can be (Empty,Normal, Warning,Error,Fetching).
| Name | Type | Description |
|---|---|---|
state | LogDataState | state of data. |
LogData<T>
this
▸ setValue(index, value): LogData<T>
Set value by index
| Name | Type | Description |
|---|---|---|
index | number | index of the sample |
value | number | sample values |
LogData<T>
this
▸ setValueUnit(unit): LogData<T>
Sets value unit
| Name | Type | Description |
|---|---|---|
unit | string | AbstractUnit | value unit |
LogData<T>
this
▸ setValues(depths, values, metaInfos?, deepCopy?): LogData<T>
Sets values
Example
// Following example shows how to reverse depths and values for the curve displayed.
new LogData('Curve Name')
.setValues(depths.reverse(), values.reverse());| Name | Type | Description |
|---|---|---|
depths | number[] | The array of ordered depths |
values | number[] | The array of values |
Optional metaInfos | T[] | The array of metaInfo |
Optional deepCopy | boolean | if false, provided arrays shouldn't be changed outside |
LogData<T>
this
▸ suspendUpdate(): LogData<T>
Suspend update
LogData<T>
this
▸ trimValues(startDepth, endDepth): LogData<T>
Remove values from start to end depth. If startDepth is NaN or endDepth is NaN then it uses infinity values
| Name | Type | Description |
|---|---|---|
startDepth | number | where to start trim |
endDepth | number | where to end trim |
LogData<T>
this
▸ Protected update(args?): void
Notify when data has been changed.
| Name | Type | Description |
|---|---|---|
Optional args | LogDataEvent | optional parameters |
void
▸ Protected updateDataStatistics(): LogData<T>
Update data statistics
LogData<T>
this
LogAbstractData.updateDataStatistics
▸ updateTimeStamp(): void
Update time stamp
void
LogAbstractData.updateTimeStamp
▸ Static findValueAt(depth, depths, values, prev, next, interpolation?): number
Utility function to interpolate a value between two depths.
| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
depths | number[] | The array of ordered depths |
values | number[] | The array of values |
prev | number | The index of the largest previous depth |
next | number | The index of the smallest following depth |
Optional interpolation | InterpolationType | interpolation type for the value |
number
The interpolated value or Number.NaN if outside the range
▸ Static getClassName(): string
string
▸ Static interpolateValueAt(depth, depthPrev, valuePrev, depthNext, valueNext, interpolation?): number
Utility function to interpolate a value between two depths.
| Name | Type | Description |
|---|---|---|
depth | number | The depth for which you want to compute the value |
depthPrev | number | prev depth |
valuePrev | number | prev value |
depthNext | number | next depth |
valueNext | number | next value |
Optional interpolation | InterpolationType | interpolation type for the value |
number
The interpolated value or Number.NaN if outside the range