API / geotoolkit / seismic / data / MemoryReader / MemoryReader
data.MemoryReader.MemoryReader
A seismic reader that keeps all traces in memory. This reader should only be used for small seismic datasets given that all its data is kept in memory. This reader can work in synchronous or asynchronous mode. See the setTraceProcessor method for further details and examples.
Example
import {MemoryReader} from '@int/geotoolkit/seismic/data/MemoryReader';
const reader = new MemoryReader({
'numberOfTraces': 1024,
'numberOfSamples': 100,
'sampleRate': 0.004
})↳
MemoryReader
Constructors
Methods
Constructors
• new MemoryReader(options?)
Creates memory reader
| Name | Type | Description |
|---|---|---|
Optional options | number | Options | nullValue or options is passed when a value does not exist. There will be a break in the wiggles in that area. Fill will not fill that area. User can set a custom color for NullValue |
SeismicReader.constructor
Methods
▸ clone(): MemoryReader
Return clone of the reader
▸ Protected copyConstructor(src, deepCopy?): MemoryReader
Copy constructor function.
Function used as part of the cloning mechanism.
Implementations should copy the given instance state to this instance.
| Name | Type | Description |
|---|---|---|
src | MemoryReader | Source to copy from |
Optional deepCopy | boolean | deep copy |
this
▸ dispose(): void
Dispose.
void
▸ getClassName(): string
string
▸ getMetaData(): SeismicMetaData
returns seismic meta data information
▸ getModelLimits(): Rect
Returns seismic model limits
▸ getNullValue(): number
Returns null value
number
null value
▸ getNumberOfSamples(): number
Returns number of samples
number
SeismicReader.getNumberOfSamples
▸ getNumberOfTraces(): number
Returns number of traces
number
SeismicReader.getNumberOfTraces
▸ getOptions(): any
Returns supported extra options
any
options options
▸ getOriginalMetaData(): SeismicMetaData
Returns seismic original meta data information before any decimation
SeismicReader.getOriginalMetaData
▸ getSampleRate(): number
returns sample rate
number
▸ getStatistics(): Statistics
Returns statistics
▸ getTimeStamp(): number
Return the value to indicate if data was changed
number
▸ getTraceHeaderFields(): FieldDesc[]
Return trace header fields
SeismicReader.getTraceHeaderFields
▸ 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
SeismicReader.hasEventListener
▸ invalidate(rect?): void
Invalidate data and notify that data is changed
| Name | Type | Description |
|---|---|---|
Optional rect | Rect | optional area of tracers and samples to invalidate. It is not supported now |
void
▸ isDisposed(): boolean
Returns whether this object has been disposed
boolean
▸ isSilent(): boolean
Return true if the event dispatcher doesn't notify any events
boolean
▸ loadMetaData(callback): void
load SeismicMetaData seismic meta data
| Name | Type | Description |
|---|---|---|
callback | (reader: SeismicReader) => void | method to be called when data is ready |
void
▸ notify<E>(type, source, args?): MemoryReader
Notify listeners
| Name | Type |
|---|---|
E | extends string |
| Name | Type | Description |
|---|---|---|
type | E | event types |
source | SeismicReader | of the event |
Optional args | EventMap[E] | arguments of the event |
this
▸ off<E>(type?, callback?): MemoryReader
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: MemoryReader, args: EventMap[E]) => void | function to be called |
this
▸ on<E>(type, callback): MemoryReader
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: MemoryReader, args: EventMap[E]) => void | to be called |
this
▸ queryInterface<T>(someInterface): InstanceType<T>
Returns interface, if reader can provide it
| Name | Type |
|---|---|
T | extends Constructor<any> |
| Name | Type | Description |
|---|---|---|
someInterface | T | interface |
InstanceType<T>
internal instance of this interface
▸ readDataSetStatistics(callback): void
read Seismic data statistics
| Name | Type | Description |
|---|---|---|
callback | (reader: MemoryReader, statistics: Statistics) => void | method to be called when data is ready |
void
▸ select(query, callback): void
returns seismic trace section
| Name | Type | Description |
|---|---|---|
query | SelectQuery | this specifies the condition of the request |
callback | SelectCallback | method to be called when data is ready |
void
▸ setNumberOfSamples(numberOfSamples): MemoryReader
Sets number of samples per trace
| Name | Type | Description |
|---|---|---|
numberOfSamples | number | number of samples per trace |
this
▸ setNumberOfTraces(numberOfTraces): MemoryReader
Set number of traces
| Name | Type | Description |
|---|---|---|
numberOfTraces | number | The number of traces in the memory reader |
this
▸ setSilent(bool): MemoryReader
Set silent mode
| Name | Type | Description |
|---|---|---|
bool | boolean | flag to enable silent mode |
this
▸ setTraceProcessor(traceProcessor): MemoryReader
Sets the 'trace processor' of this memory reader.
The trace processor is a delegate object responsible for providing data to the reader.
Example
// Example of asynchronous reader
import {MemoryReader} from '@int/geotoolkit/seismic/data/MemoryReader';
import {Statistics} from '@int/geotoolkit/seismic/data/Statistics';
const reader = new MemoryReader({
'numberOfTraces': 1024,
'numberOfSamples': 100,
'sampleRate': 0.004
})
.setTraceProcessor({
'getAsyncData': (query, callback) => {
callback({'getTraceData': (reader: MemoryReader, samples: number[], traceId: number) => {
for (let i = 0; i < reader.getNumberOfSamples(); i++) {
trace[i] = Math.cos(i / 8);
}
}});
},
'getDataStatistics': (): Statistics => ({
'average': 0,
'min': -1,
'max': 1,
'rms': Math.sqrt(2) / 2
})
});Example
// Example of synchronous reader
...
reader
.setTraceProcessor({
'getTraceData': (reader: MemoryReader, samples: number[], traceId: number) => {
for (let i = 0; i < reader.getNumberOfSamples(); i++) {
trace[i] = Math.cos(i / 8);
}
},
...
});| Name | Type | Description |
|---|---|---|
traceProcessor | ExtendedTraceProcessor | object that implements following set of functions which provide trace data and statistics to reader. |
this
▸ update(query?, callback?): void
Update reader if seismic meta data is changed
| Name | Type | Description |
|---|---|---|
Optional query | Record<string, any> | this specifies the condition of the request |
Optional callback | UpdateCallback | method to be called when data is ready |
void
▸ Protected updateTimeStamp(): void
Update time stamp
void
▸ Static getClassName(): string
string