Add type 3 binary bundle.

Consisting of final positions + errors.
This commit is contained in:
D. Berge
2025-08-08 11:21:05 +02:00
parent c2ec2970f0
commit 6a94287cba

View File

@@ -78,7 +78,7 @@ function bundle (json, opts = {}) {
return encode.sequential(json, el => el.line, el => el.point, deltas, values, type) return encode.sequential(json, el => el.line, el => el.point, deltas, values, type)
} else if (type == 2) { } else if (type == 2) {
/* Gun information: /* Raw positions and gun information:
* *
* - Δelem 0: BigUint64Array + Int16Array timestamps * - Δelem 0: BigUint64Array + Int16Array timestamps
* - elem 01: Float32Array, Float32Array Raw positions (x, y) * - elem 01: Float32Array, Float32Array Raw positions (x, y)
@@ -225,6 +225,59 @@ function bundle (json, opts = {}) {
console.log("DELTAS", deltas); console.log("DELTAS", deltas);
console.log("VALUES", values); console.log("VALUES", values);
return encode.sequential(json, el => el.sequence, el => el.point, deltas, values, type)
} else if (type == 3) {
/* Final positions and raw vs final errors:
*
* - Δelem 0: BigUint64Array + Int16Array timestamps
* - elem 01: Float32Array, Float32Array Final positions (x, y)
* - elem 23: Int16Array, Int16Array (×10) Final - raw position errors (i, j)
*/
// Add timestamps
deltas.push({
// Timestamp
key: el => el.tstamp.valueOf(),
baseType: BigUint64Array,
incrType: Int16Array
});
// Add raw positions
values.push({
// longitude
key: el => el.geometryfinal?.coordinates?.[0],
type: Float32Array
});
values.push({
// latitude
key: el => el.geometryfinal?.coordinates?.[1],
type: Float32Array
});
// Add raw inline, crossline errors relative to preplot
values.push({
// Crossline
key: el => el.errorfinal?.coordinates?.[0] * 10,
type: Int16Array
});
values.push({
// Inline
key: el => el.errorfinal?.coordinates?.[1] * 10,
type: Int16Array
});
// Add raw inline, crossline errors relative to raw
values.push({
// Crossline
key: el => (el.errorfinal?.coordinates?.[0] - el.errorraw?.coordinates?.[0]) * 10,
type: Int16Array
});
values.push({
// Inline
key: el => (el.errorfinal?.coordinates?.[1] - el.errorraw?.coordinates?.[1]) * 10,
type: Int16Array
});
return encode.sequential(json, el => el.sequence, el => el.point, deltas, values, type) return encode.sequential(json, el => el.sequence, el => el.point, deltas, values, type)
} }
} }