Representation Codes
RP66 V1 defines 27 representation codes that specify how a value is
encoded in the binary stream. The RC object exported by the library maps
each mnemonic to its numeric code.
import { RC, RC_SIZE } from '@geoharkat/dlis-parser';
console.log(RC.FSINGL); // 2
console.log(RC.SNORM); // 13
console.log(RC_SIZE[RC.FDOUBL]); // 8 (bytes per value)
Complete table
Code |
Mnemonic |
Bytes |
Description |
|---|---|---|---|
1 |
|
2 |
RP66 proprietary 16-bit float (not IEEE half-float). Exponent in bits 14-11, mantissa in bits 10-0. |
2 |
|
4 |
IEEE 754 single-precision float (most common scalar type). |
3 |
|
8 |
IEEE single + 4-byte validity/exponent field. Only the float is returned; the extra field is skipped. |
4 |
|
12 |
IEEE single + 8-byte lower/upper bounds. Only the float is returned. |
5 |
|
4 |
IBM base-16 single-precision float. |
6 |
|
4 |
VAX F-float (word-swapped byte pairs). |
7 |
|
8 |
IEEE 754 double-precision float (common for depth/time index channels). |
8 |
|
12 |
IEEE double + 4-byte exponent field. |
9 |
|
16 |
IEEE double + 8-byte bounds. |
10 |
|
8 |
Complex single: real (4 B) + imaginary (4 B).
Returned as |
11 |
|
16 |
Complex double: real (8 B) + imaginary (8 B).
Returned as |
12 |
|
1 |
Signed 8-bit integer. |
13 |
|
2 |
Signed 16-bit integer (big-endian). Used by waveform/array channels (VDL, sonic, FMI). |
14 |
|
4 |
Signed 32-bit integer (big-endian). |
15 |
|
1 |
Unsigned 8-bit integer. Used internally in EFLR templates to store representation codes. |
16 |
|
2 |
Unsigned 16-bit integer (big-endian). |
17 |
|
4 |
Unsigned 32-bit integer (big-endian). |
18 |
|
1–4 |
Variable-length unsigned integer. 1 byte if value < 128, 2 bytes if < 16384, otherwise 4 bytes. |
19 |
|
1+N |
Short ASCII string: 1-byte length prefix + N bytes of text. |
20 |
|
4+N |
Long ASCII string: 4-byte (ULONG) length prefix + N bytes. |
21 |
|
8 |
Date and time: year (1B) + month (1B) + day (1B) + hour (1B) +
minute (1B) + second (1B) + milliseconds (2B BE).
Year is offset from 1900. Parsed into a JavaScript |
22 |
|
1–4 |
Origin reference. Encoded as UVARI. |
23 |
|
variable |
Object name triplet: UVARI origin + USHORT copy + IDENT name. |
24 |
|
variable |
Object reference: IDENT type + OBNAME name. |
25 |
|
variable |
Attribute reference: IDENT label + OBNAME name. |
26 |
|
1 |
Boolean status byte. Returned as JavaScript |
27 |
|
1+N |
Unit expression. Same encoding as IDENT. |
Variable-size codes
Codes with variable byte size (UVARI, IDENT, ASCII, OBNAME,
OBJREF, ATTREF, UNITS) return 0 from RC_SIZE since their
length is not known without reading the data.
import { RC, RC_SIZE } from '@geoharkat/dlis-parser';
RC_SIZE[RC.SNORM] // 2
RC_SIZE[RC.FDOUBL] // 8
RC_SIZE[RC.IDENT] // 0 (variable)
RC_SIZE[RC.UVARI] // 0 (variable)
Checking a channel’s type
import { RC } from '@geoharkat/dlis-parser';
const ch = lf.getChannel('VDL');
if (ch.repcode === RC.SNORM) {
// 16-bit signed waveform — stride = ch.dimension[0] samples per row
console.log('VDL is a signed-16 waveform,', ch.dimension[0], 'samples/row');
}
if (ch.repcode === RC.FSINGL) {
console.log('Scalar IEEE float channel');
}