gnss-js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analysis.cjs +140 -33
- package/dist/analysis.js +3 -3
- package/dist/{chunk-SDRRAJT5.js → chunk-4YN353Q7.js} +16 -9
- package/dist/{chunk-WR7LCB52.js → chunk-BJHTBYNG.js} +15 -4
- package/dist/{chunk-CB6EOOLA.js → chunk-HBLU2EJ4.js} +70 -21
- package/dist/{chunk-354IRDOG.js → chunk-LWNTWBHB.js} +36 -7
- package/dist/{chunk-K7WZQFBV.js → chunk-MIIM4LDY.js} +4 -1
- package/dist/{chunk-Y3R57B5P.js → chunk-SO3POWWR.js} +37 -8
- package/dist/{chunk-IS4UUDBV.js → chunk-W4YMQKWH.js} +54 -9
- package/dist/{chunk-PRSZIWKM.js → chunk-WP2JFDLA.js} +21 -28
- package/dist/constants.cjs +36 -7
- package/dist/constants.js +1 -1
- package/dist/coordinates.cjs +4 -1
- package/dist/coordinates.js +1 -1
- package/dist/{ephemeris-BUWzfmBy.d.cts → ephemeris-C10stHhM.d.cts} +1 -1
- package/dist/{ephemeris-BUWzfmBy.d.ts → ephemeris-C10stHhM.d.ts} +1 -1
- package/dist/index.cjs +249 -83
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/ntrip.cjs +15 -4
- package/dist/ntrip.js +1 -1
- package/dist/orbit.cjs +16 -9
- package/dist/orbit.d.cts +1 -1
- package/dist/orbit.d.ts +1 -1
- package/dist/orbit.js +1 -1
- package/dist/rinex.cjs +123 -29
- package/dist/rinex.js +3 -3
- package/dist/rtcm3.cjs +20 -27
- package/dist/rtcm3.d.cts +2 -2
- package/dist/rtcm3.d.ts +2 -2
- package/dist/rtcm3.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
CycleSlipAccumulator,
|
|
4
4
|
MultipathAccumulator,
|
|
5
5
|
analyzeQuality
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SO3POWWR.js";
|
|
7
7
|
import {
|
|
8
8
|
frequencyLabel,
|
|
9
9
|
parseAntex
|
|
@@ -114,7 +114,7 @@ import {
|
|
|
114
114
|
rad2deg,
|
|
115
115
|
rhumbLine,
|
|
116
116
|
vincenty
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-MIIM4LDY.js";
|
|
118
118
|
import "./chunk-5S5MONFK.js";
|
|
119
119
|
import {
|
|
120
120
|
DAYS_MJD2000_MJD,
|
|
@@ -150,7 +150,7 @@ import {
|
|
|
150
150
|
padR,
|
|
151
151
|
parseNavFile,
|
|
152
152
|
writeRinexNav
|
|
153
|
-
} from "./chunk-
|
|
153
|
+
} from "./chunk-W4YMQKWH.js";
|
|
154
154
|
import {
|
|
155
155
|
SYSTEM_ORDER,
|
|
156
156
|
crxDecompress,
|
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
parseRinexStream,
|
|
160
160
|
systemCmp,
|
|
161
161
|
systemName
|
|
162
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-HBLU2EJ4.js";
|
|
163
163
|
import {
|
|
164
164
|
BitReader,
|
|
165
165
|
RTCM3_MESSAGE_NAMES,
|
|
@@ -174,7 +174,7 @@ import {
|
|
|
174
174
|
rtcm3Constellation,
|
|
175
175
|
updateStationMeta,
|
|
176
176
|
updateStreamStats
|
|
177
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-WP2JFDLA.js";
|
|
178
178
|
import {
|
|
179
179
|
ARC_GAP_FACTOR,
|
|
180
180
|
BAND_LABELS,
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
formatUTCTime,
|
|
197
197
|
getFreq,
|
|
198
198
|
gloFreq
|
|
199
|
-
} from "./chunk-
|
|
199
|
+
} from "./chunk-LWNTWBHB.js";
|
|
200
200
|
import {
|
|
201
201
|
computeAllPositions,
|
|
202
202
|
computeDop,
|
|
@@ -207,7 +207,7 @@ import {
|
|
|
207
207
|
keplerPosition,
|
|
208
208
|
navTimesFromEph,
|
|
209
209
|
selectEphemeris
|
|
210
|
-
} from "./chunk-
|
|
210
|
+
} from "./chunk-4YN353Q7.js";
|
|
211
211
|
import {
|
|
212
212
|
clampUnit,
|
|
213
213
|
ecefToGeodetic,
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
connectToMountpoint,
|
|
226
226
|
fetchSourcetable,
|
|
227
227
|
parseSourcetable
|
|
228
|
-
} from "./chunk-
|
|
228
|
+
} from "./chunk-BJHTBYNG.js";
|
|
229
229
|
export {
|
|
230
230
|
ARC_GAP_FACTOR,
|
|
231
231
|
BAND_LABELS,
|
package/dist/ntrip.cjs
CHANGED
|
@@ -124,14 +124,18 @@ async function ntripFetch(proxyUrl, path, headers, signal) {
|
|
|
124
124
|
} catch (err) {
|
|
125
125
|
if (err instanceof Error && err.name === "AbortError") throw err;
|
|
126
126
|
const message = err instanceof Error ? err.message : "The service may be temporarily unavailable.";
|
|
127
|
-
throw new Error(`Could not reach the NTRIP proxy: ${message}`, {
|
|
127
|
+
throw new Error(`Could not reach the NTRIP proxy: ${message}`, {
|
|
128
|
+
cause: err
|
|
129
|
+
});
|
|
128
130
|
}
|
|
129
131
|
}
|
|
130
132
|
async function fetchSourcetable(proxyUrl, info, signal) {
|
|
131
133
|
const headers = ntripHeaders(info);
|
|
132
134
|
const res = await ntripFetch(proxyUrl, "/", headers, signal);
|
|
133
135
|
if (res.status === 401) {
|
|
134
|
-
throw new Error(
|
|
136
|
+
throw new Error(
|
|
137
|
+
"Authentication required. Please provide valid credentials."
|
|
138
|
+
);
|
|
135
139
|
}
|
|
136
140
|
if (!res.ok) {
|
|
137
141
|
throw new Error(`Caster returned ${res.status} ${res.statusText}`);
|
|
@@ -143,7 +147,12 @@ async function connectToMountpoint(proxyUrl, info, signal) {
|
|
|
143
147
|
const headers = ntripHeaders(info);
|
|
144
148
|
const controller = new AbortController();
|
|
145
149
|
const combinedSignal = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
|
|
146
|
-
const res = await ntripFetch(
|
|
150
|
+
const res = await ntripFetch(
|
|
151
|
+
proxyUrl,
|
|
152
|
+
`/${info.mountpoint}`,
|
|
153
|
+
headers,
|
|
154
|
+
combinedSignal
|
|
155
|
+
);
|
|
147
156
|
if (res.status === 401) {
|
|
148
157
|
throw new Error("Authentication required for this mountpoint.");
|
|
149
158
|
}
|
|
@@ -154,7 +163,9 @@ async function connectToMountpoint(proxyUrl, info, signal) {
|
|
|
154
163
|
throw new Error(`Caster returned ${res.status} ${res.statusText}`);
|
|
155
164
|
}
|
|
156
165
|
if (!res.body) {
|
|
157
|
-
throw new Error(
|
|
166
|
+
throw new Error(
|
|
167
|
+
"No response body \u2014 streaming not supported by this environment."
|
|
168
|
+
);
|
|
158
169
|
}
|
|
159
170
|
return {
|
|
160
171
|
reader: res.body.getReader(),
|
package/dist/ntrip.js
CHANGED
package/dist/orbit.cjs
CHANGED
|
@@ -102,10 +102,7 @@ function keplerPosition(eph, t) {
|
|
|
102
102
|
}
|
|
103
103
|
const sinE = Math.sin(Ek);
|
|
104
104
|
const cosE = Math.cos(Ek);
|
|
105
|
-
const vk = Math.atan2(
|
|
106
|
-
Math.sqrt(1 - eph.e * eph.e) * sinE,
|
|
107
|
-
cosE - eph.e
|
|
108
|
-
);
|
|
105
|
+
const vk = Math.atan2(Math.sqrt(1 - eph.e * eph.e) * sinE, cosE - eph.e);
|
|
109
106
|
const phik = vk + eph.omega;
|
|
110
107
|
const sin2phi = Math.sin(2 * phik);
|
|
111
108
|
const cos2phi = Math.cos(2 * phik);
|
|
@@ -268,7 +265,10 @@ function invert4x4(m) {
|
|
|
268
265
|
let det = a[0] * inv[0] + a[1] * inv[4] + a[2] * inv[8] + a[3] * inv[12];
|
|
269
266
|
if (Math.abs(det) < 1e-20) return null;
|
|
270
267
|
det = 1 / det;
|
|
271
|
-
const result = Array.from(
|
|
268
|
+
const result = Array.from(
|
|
269
|
+
{ length: 4 },
|
|
270
|
+
() => new Array(4).fill(0)
|
|
271
|
+
);
|
|
272
272
|
for (let i = 0; i < 4; i++) {
|
|
273
273
|
for (let j = 0; j < 4; j++) {
|
|
274
274
|
result[i][j] = inv[i * 4 + j] * det;
|
|
@@ -385,10 +385,16 @@ var GAL_EPOCH_MS = GPS_EPOCH_MS;
|
|
|
385
385
|
function ephInfoToEphemeris(info) {
|
|
386
386
|
const sys = info.prn.charAt(0);
|
|
387
387
|
if (sys === "R") {
|
|
388
|
-
if (info.x === void 0 || info.y === void 0 || info.z === void 0)
|
|
389
|
-
|
|
388
|
+
if (info.x === void 0 || info.y === void 0 || info.z === void 0)
|
|
389
|
+
return null;
|
|
390
|
+
if (info.vx === void 0 || info.vy === void 0 || info.vz === void 0)
|
|
391
|
+
return null;
|
|
390
392
|
const now = new Date(info.lastReceived);
|
|
391
|
-
const utcMidnight = Date.UTC(
|
|
393
|
+
const utcMidnight = Date.UTC(
|
|
394
|
+
now.getUTCFullYear(),
|
|
395
|
+
now.getUTCMonth(),
|
|
396
|
+
now.getUTCDate()
|
|
397
|
+
);
|
|
392
398
|
const tbSec = (info.tb ?? 0) * 900;
|
|
393
399
|
const moscowOffset = 3 * 3600;
|
|
394
400
|
const tocMs = utcMidnight + (tbSec - moscowOffset) * 1e3;
|
|
@@ -413,7 +419,8 @@ function ephInfoToEphemeris(info) {
|
|
|
413
419
|
freqNum: info.freqChannel ?? 0
|
|
414
420
|
};
|
|
415
421
|
}
|
|
416
|
-
if (info.sqrtA === void 0 || info.eccentricity === void 0 || info.inclination === void 0 || info.omega0 === void 0 || info.argPerigee === void 0 || info.meanAnomaly === void 0 || info.toe === void 0 || info.week === void 0)
|
|
422
|
+
if (info.sqrtA === void 0 || info.eccentricity === void 0 || info.inclination === void 0 || info.omega0 === void 0 || info.argPerigee === void 0 || info.meanAnomaly === void 0 || info.toe === void 0 || info.week === void 0)
|
|
423
|
+
return null;
|
|
417
424
|
let epochMs;
|
|
418
425
|
const tocSec = info.toc ?? info.toe;
|
|
419
426
|
if (sys === "C") {
|
package/dist/orbit.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris } from './nav-BAI1a9vK.cjs';
|
|
2
|
-
import { E as EphemerisInfo } from './ephemeris-
|
|
2
|
+
import { E as EphemerisInfo } from './ephemeris-C10stHhM.cjs';
|
|
3
3
|
export { e as ecefToGeodetic, g as geodeticToEcef } from './ecef-CF0uAysr.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/orbit.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris } from './nav-BAI1a9vK.js';
|
|
2
|
-
import { E as EphemerisInfo } from './ephemeris-
|
|
2
|
+
import { E as EphemerisInfo } from './ephemeris-C10stHhM.js';
|
|
3
3
|
export { e as ecefToGeodetic, g as geodeticToEcef } from './ecef-CF0uAysr.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/orbit.js
CHANGED
package/dist/rinex.cjs
CHANGED
|
@@ -78,10 +78,20 @@ function parseCrxDataLine(line, ntype) {
|
|
|
78
78
|
if (token.length >= 3 && token[1] === "&") {
|
|
79
79
|
const arcOrder = parseInt(token[0]);
|
|
80
80
|
const value = parseInt(token.substring(2));
|
|
81
|
-
fields.push({
|
|
81
|
+
fields.push({
|
|
82
|
+
empty: false,
|
|
83
|
+
init: true,
|
|
84
|
+
arcOrder,
|
|
85
|
+
value: isNaN(value) ? 0 : value
|
|
86
|
+
});
|
|
82
87
|
} else {
|
|
83
88
|
const value = parseInt(token);
|
|
84
|
-
fields.push({
|
|
89
|
+
fields.push({
|
|
90
|
+
empty: false,
|
|
91
|
+
init: false,
|
|
92
|
+
arcOrder: -1,
|
|
93
|
+
value: isNaN(value) ? 0 : value
|
|
94
|
+
});
|
|
85
95
|
}
|
|
86
96
|
}
|
|
87
97
|
const flagStr = pos < line.length ? line.substring(pos) : "";
|
|
@@ -91,7 +101,10 @@ function crxDecompress(prev, field) {
|
|
|
91
101
|
if (field.init) {
|
|
92
102
|
const a = new Array(Math.max(field.arcOrder + 1, 1)).fill(0);
|
|
93
103
|
a[0] = field.value;
|
|
94
|
-
return {
|
|
104
|
+
return {
|
|
105
|
+
state: { accum: a, order: 0, arcOrder: field.arcOrder },
|
|
106
|
+
result: field.value
|
|
107
|
+
};
|
|
95
108
|
}
|
|
96
109
|
if (!prev) {
|
|
97
110
|
return { state: { accum: [0], order: 0, arcOrder: 0 }, result: 0 };
|
|
@@ -104,7 +117,10 @@ function crxDecompress(prev, field) {
|
|
|
104
117
|
for (let k = order; k >= 1; k--) {
|
|
105
118
|
accum[k - 1] += accum[k];
|
|
106
119
|
}
|
|
107
|
-
return {
|
|
120
|
+
return {
|
|
121
|
+
state: { accum, order, arcOrder: prev.arcOrder },
|
|
122
|
+
result: accum[0]
|
|
123
|
+
};
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
// src/rinex/format.ts
|
|
@@ -137,7 +153,9 @@ var CHUNK_SIZE = 2 * 1024 * 1024;
|
|
|
137
153
|
var yieldToMain = () => new Promise((r) => setTimeout(r, 0));
|
|
138
154
|
var noYield = () => Promise.resolve();
|
|
139
155
|
var SYSTEM_ORDER = ["G", "R", "E", "C", "J", "I", "S"];
|
|
140
|
-
var SYSTEM_RANK = Object.fromEntries(
|
|
156
|
+
var SYSTEM_RANK = Object.fromEntries(
|
|
157
|
+
SYSTEM_ORDER.map((s, i) => [s, i])
|
|
158
|
+
);
|
|
141
159
|
function systemCmp(a, b) {
|
|
142
160
|
const ra = SYSTEM_RANK[a.charAt(0)] ?? 99;
|
|
143
161
|
const rb = SYSTEM_RANK[b.charAt(0)] ?? 99;
|
|
@@ -323,7 +341,11 @@ function parseEpochLine3(line) {
|
|
|
323
341
|
const wholeSec = Math.floor(sc);
|
|
324
342
|
const ms = Math.round((sc - wholeSec) * 1e3);
|
|
325
343
|
const time = Date.UTC(yr, mo - 1, dy, hr, mn, wholeSec, ms);
|
|
326
|
-
return {
|
|
344
|
+
return {
|
|
345
|
+
time,
|
|
346
|
+
flag: isNaN(flag) ? 0 : flag,
|
|
347
|
+
numSats: isNaN(numSats) ? 0 : numSats
|
|
348
|
+
};
|
|
327
349
|
}
|
|
328
350
|
function parseEpochLine2(line) {
|
|
329
351
|
const yr2 = parseInt(line.substring(1, 3));
|
|
@@ -345,7 +367,12 @@ function parseEpochLine2(line) {
|
|
|
345
367
|
const id = satPart.substring(i, i + 3).trim();
|
|
346
368
|
if (id) satIds.push(id);
|
|
347
369
|
}
|
|
348
|
-
return {
|
|
370
|
+
return {
|
|
371
|
+
time,
|
|
372
|
+
flag: isNaN(flag) ? 0 : flag,
|
|
373
|
+
numSats: isNaN(numSats) ? 0 : numSats,
|
|
374
|
+
satIds
|
|
375
|
+
};
|
|
349
376
|
}
|
|
350
377
|
async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode) {
|
|
351
378
|
const skipEpochs = !!workerMode;
|
|
@@ -398,16 +425,19 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
398
425
|
if (!skipEpochs) {
|
|
399
426
|
const snrBySys = {};
|
|
400
427
|
for (const [sys, vals] of Object.entries(snrPerSystemAccum)) {
|
|
401
|
-
if (vals.length > 0)
|
|
428
|
+
if (vals.length > 0)
|
|
429
|
+
snrBySys[sys] = vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
402
430
|
}
|
|
403
431
|
const meanSnr = snrValues.length > 0 ? snrValues.reduce((a, b) => a + b, 0) / snrValues.length : null;
|
|
404
432
|
const snrPerSat = {};
|
|
405
433
|
for (const [prn, vals] of Object.entries(snrPerSatAccum)) {
|
|
406
|
-
if (vals.length > 0)
|
|
434
|
+
if (vals.length > 0)
|
|
435
|
+
snrPerSat[prn] = vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
407
436
|
}
|
|
408
437
|
const snrPerSatBand = {};
|
|
409
438
|
for (const [key, vals] of Object.entries(snrPerSatBandAccum)) {
|
|
410
|
-
if (vals.length > 0)
|
|
439
|
+
if (vals.length > 0)
|
|
440
|
+
snrPerSatBand[key] = vals.reduce((a, b) => a + b, 0) / vals.length;
|
|
411
441
|
}
|
|
412
442
|
epochs.push({
|
|
413
443
|
time: epochInfo.time,
|
|
@@ -452,7 +482,8 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
452
482
|
const codes = header.obsTypes[sys] ?? [];
|
|
453
483
|
if (onSatObs && epochInfo) {
|
|
454
484
|
const values = new Array(codes.length);
|
|
455
|
-
for (let i = 0; i < codes.length; i++)
|
|
485
|
+
for (let i = 0; i < codes.length; i++)
|
|
486
|
+
values[i] = readObsValue(obsLine, i);
|
|
456
487
|
if (!skipEpochs) {
|
|
457
488
|
for (const { idx, band } of getSnrIndices(sys)) {
|
|
458
489
|
const val = values[idx] ?? null;
|
|
@@ -689,7 +720,10 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
689
720
|
v2SnrBandInfo = snrIndicesWithBandV2(header.obsTypes);
|
|
690
721
|
v2SatIndex = 0;
|
|
691
722
|
v2CurrentSatLine = 0;
|
|
692
|
-
const continuationLines = Math.max(
|
|
723
|
+
const continuationLines = Math.max(
|
|
724
|
+
0,
|
|
725
|
+
Math.ceil((info.numSats - 12) / 12)
|
|
726
|
+
);
|
|
693
727
|
if (continuationLines > 0) {
|
|
694
728
|
v2ContinuationSatsRemaining = continuationLines;
|
|
695
729
|
} else {
|
|
@@ -729,7 +763,9 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
729
763
|
const magic = new Uint8Array(await file.slice(0, 2).arrayBuffer());
|
|
730
764
|
const isGz = magic[0] === 31 && magic[1] === 139;
|
|
731
765
|
if (magic[0] === 31 && magic[1] === 157) {
|
|
732
|
-
throw new Error(
|
|
766
|
+
throw new Error(
|
|
767
|
+
"Unix compress (.Z) files are not supported. Please decompress first (e.g. uncompress or gzip -d)."
|
|
768
|
+
);
|
|
733
769
|
}
|
|
734
770
|
if (isGz) {
|
|
735
771
|
let bytesRead = 0;
|
|
@@ -745,7 +781,9 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
745
781
|
if (done) break;
|
|
746
782
|
bytesRead += value.byteLength;
|
|
747
783
|
processChunkText(decoder.decode(value, { stream: true }), false);
|
|
748
|
-
onProgress?.(
|
|
784
|
+
onProgress?.(
|
|
785
|
+
Math.min(99, Math.round(bytesRead / (file.size * 4) * 100))
|
|
786
|
+
);
|
|
749
787
|
await yield_();
|
|
750
788
|
}
|
|
751
789
|
processChunkText(decoder.decode(), true);
|
|
@@ -755,7 +793,10 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
755
793
|
const end = Math.min(offset + CHUNK_SIZE, file.size);
|
|
756
794
|
const slice = file.slice(offset, end);
|
|
757
795
|
const arrayBuf = await slice.arrayBuffer();
|
|
758
|
-
processChunkText(
|
|
796
|
+
processChunkText(
|
|
797
|
+
decoder.decode(arrayBuf, { stream: end < file.size }),
|
|
798
|
+
false
|
|
799
|
+
);
|
|
759
800
|
onProgress?.(Math.min(99, Math.round(end / file.size * 100)));
|
|
760
801
|
await yield_();
|
|
761
802
|
}
|
|
@@ -763,19 +804,27 @@ async function parseRinexStream(file, onProgress, signal, onSatObs, workerMode)
|
|
|
763
804
|
processChunkText("", true);
|
|
764
805
|
}
|
|
765
806
|
}
|
|
766
|
-
if (epochInfo && satLinesRemaining === 0 && crxPhase === "epoch")
|
|
767
|
-
|
|
807
|
+
if (epochInfo && satLinesRemaining === 0 && crxPhase === "epoch")
|
|
808
|
+
finishEpoch();
|
|
809
|
+
if (!header)
|
|
810
|
+
throw new Error("No valid RINEX header found (missing END OF HEADER).");
|
|
768
811
|
onProgress?.(100);
|
|
769
|
-
return {
|
|
812
|
+
return {
|
|
813
|
+
header,
|
|
814
|
+
epochs,
|
|
815
|
+
stats: computeStats(header, epochs, satellitesSeen)
|
|
816
|
+
};
|
|
770
817
|
}
|
|
771
818
|
function computeStats(header, epochs, satellitesSeen) {
|
|
772
819
|
const n = epochs.length;
|
|
773
820
|
const startTime = n > 0 ? new Date(epochs[0].time) : header.timeOfFirstObs;
|
|
774
821
|
const endTime = n > 0 ? new Date(epochs[n - 1].time) : header.timeOfLastObs;
|
|
775
822
|
let duration = null;
|
|
776
|
-
if (startTime && endTime)
|
|
823
|
+
if (startTime && endTime)
|
|
824
|
+
duration = (endTime.getTime() - startTime.getTime()) / 1e3;
|
|
777
825
|
let interval = header.interval;
|
|
778
|
-
if (interval === null && n >= 2)
|
|
826
|
+
if (interval === null && n >= 2)
|
|
827
|
+
interval = (epochs[1].time - epochs[0].time) / 1e3;
|
|
779
828
|
const uniqueSatsPerSystem = {};
|
|
780
829
|
let totalUnique = 0;
|
|
781
830
|
const systems = [];
|
|
@@ -830,10 +879,18 @@ var WarningAccumulator = class {
|
|
|
830
879
|
);
|
|
831
880
|
}
|
|
832
881
|
if (!header.antType) {
|
|
833
|
-
this.add(
|
|
882
|
+
this.add(
|
|
883
|
+
"MISSING_ANT_TYPE",
|
|
884
|
+
"info",
|
|
885
|
+
"Missing antenna type (ANT # / TYPE)"
|
|
886
|
+
);
|
|
834
887
|
}
|
|
835
888
|
if (!header.receiverType) {
|
|
836
|
-
this.add(
|
|
889
|
+
this.add(
|
|
890
|
+
"MISSING_REC_TYPE",
|
|
891
|
+
"info",
|
|
892
|
+
"Missing receiver type (REC # / TYPE / VERS)"
|
|
893
|
+
);
|
|
837
894
|
}
|
|
838
895
|
if (!header.markerName) {
|
|
839
896
|
this.add("MISSING_MARKER", "info", "Missing marker name (MARKER NAME)");
|
|
@@ -842,7 +899,11 @@ var WarningAccumulator = class {
|
|
|
842
899
|
this.add("MISSING_INTERVAL", "info", "No observation interval in header");
|
|
843
900
|
}
|
|
844
901
|
if (Object.keys(header.obsTypes).length === 0) {
|
|
845
|
-
this.add(
|
|
902
|
+
this.add(
|
|
903
|
+
"NO_OBS_TYPES",
|
|
904
|
+
"error",
|
|
905
|
+
"No observation types defined in header"
|
|
906
|
+
);
|
|
846
907
|
}
|
|
847
908
|
}
|
|
848
909
|
setInterval(intervalMs) {
|
|
@@ -909,7 +970,12 @@ var WarningAccumulator = class {
|
|
|
909
970
|
};
|
|
910
971
|
const range = ranges[sys];
|
|
911
972
|
if (!range) {
|
|
912
|
-
this.add(
|
|
973
|
+
this.add(
|
|
974
|
+
"UNKNOWN_SYSTEM",
|
|
975
|
+
"info",
|
|
976
|
+
"Unknown satellite system letter",
|
|
977
|
+
prn
|
|
978
|
+
);
|
|
913
979
|
} else if (num < range[0] || num > range[1]) {
|
|
914
980
|
this.add(
|
|
915
981
|
"PRN_OUT_OF_RANGE",
|
|
@@ -999,7 +1065,15 @@ var R4_MSG_LINES = {
|
|
|
999
1065
|
EOP: 3,
|
|
1000
1066
|
ION: 3
|
|
1001
1067
|
};
|
|
1002
|
-
var SUPPORTED_EPH_MSGS = /* @__PURE__ */ new Set([
|
|
1068
|
+
var SUPPORTED_EPH_MSGS = /* @__PURE__ */ new Set([
|
|
1069
|
+
"LNAV",
|
|
1070
|
+
"INAV",
|
|
1071
|
+
"FNAV",
|
|
1072
|
+
"D1",
|
|
1073
|
+
"D2",
|
|
1074
|
+
"SBAS",
|
|
1075
|
+
"FDMA"
|
|
1076
|
+
]);
|
|
1003
1077
|
function parseFloat19(s) {
|
|
1004
1078
|
return parseFloat(s.trim().replace(/[dD]/g, "E"));
|
|
1005
1079
|
}
|
|
@@ -1206,9 +1280,25 @@ function parseNavFile(text) {
|
|
|
1206
1280
|
}
|
|
1207
1281
|
if (dataLines2.length === numDataLines2) {
|
|
1208
1282
|
if (sys2 === "R" || sys2 === "S") {
|
|
1209
|
-
ephemerides.push(
|
|
1283
|
+
ephemerides.push(
|
|
1284
|
+
buildStateVectorEphemeris(
|
|
1285
|
+
sys2,
|
|
1286
|
+
prn2,
|
|
1287
|
+
parsed.date,
|
|
1288
|
+
parsed.values,
|
|
1289
|
+
dataLines2
|
|
1290
|
+
)
|
|
1291
|
+
);
|
|
1210
1292
|
} else if (sys2 === "G" || sys2 === "E" || sys2 === "C" || sys2 === "J" || sys2 === "I") {
|
|
1211
|
-
ephemerides.push(
|
|
1293
|
+
ephemerides.push(
|
|
1294
|
+
buildKeplerEphemeris(
|
|
1295
|
+
sys2,
|
|
1296
|
+
prn2,
|
|
1297
|
+
parsed.date,
|
|
1298
|
+
parsed.values,
|
|
1299
|
+
dataLines2
|
|
1300
|
+
)
|
|
1301
|
+
);
|
|
1212
1302
|
}
|
|
1213
1303
|
}
|
|
1214
1304
|
i++;
|
|
@@ -1244,9 +1334,13 @@ function parseNavFile(text) {
|
|
|
1244
1334
|
}
|
|
1245
1335
|
if (dataLines.length === numDataLines) {
|
|
1246
1336
|
if (sys === "R" || sys === "S") {
|
|
1247
|
-
ephemerides.push(
|
|
1337
|
+
ephemerides.push(
|
|
1338
|
+
buildStateVectorEphemeris(sys, prn, date, epochVals, dataLines)
|
|
1339
|
+
);
|
|
1248
1340
|
} else if (sys === "G" || sys === "E" || sys === "C" || sys === "J" || sys === "I") {
|
|
1249
|
-
ephemerides.push(
|
|
1341
|
+
ephemerides.push(
|
|
1342
|
+
buildKeplerEphemeris(sys, prn, date, epochVals, dataLines)
|
|
1343
|
+
);
|
|
1250
1344
|
}
|
|
1251
1345
|
}
|
|
1252
1346
|
i++;
|
package/dist/rinex.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
padR,
|
|
8
8
|
parseNavFile,
|
|
9
9
|
writeRinexNav
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W4YMQKWH.js";
|
|
11
11
|
import {
|
|
12
12
|
SYSTEM_ORDER,
|
|
13
13
|
crxDecompress,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
parseRinexStream,
|
|
17
17
|
systemCmp,
|
|
18
18
|
systemName
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-HBLU2EJ4.js";
|
|
20
|
+
import "./chunk-LWNTWBHB.js";
|
|
21
21
|
export {
|
|
22
22
|
EMPTY_WARNINGS,
|
|
23
23
|
SYSTEM_ORDER,
|
package/dist/rtcm3.cjs
CHANGED
|
@@ -43,21 +43,18 @@ var BitReader = class {
|
|
|
43
43
|
constructor(data) {
|
|
44
44
|
this.data = data;
|
|
45
45
|
}
|
|
46
|
-
/** Read `n` bits as unsigned integer (max
|
|
46
|
+
/** Read `n` bits as unsigned integer (max 53). */
|
|
47
47
|
readU(n) {
|
|
48
48
|
if (n === 0) return 0;
|
|
49
49
|
let val = 0;
|
|
50
50
|
for (let i = 0; i < n; i++) {
|
|
51
51
|
const byteIdx = this.bitPos + i >> 3;
|
|
52
52
|
const bitIdx = 7 - (this.bitPos + i & 7);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} else {
|
|
56
|
-
val <<= 1;
|
|
57
|
-
}
|
|
53
|
+
const bit = byteIdx < this.data.length ? this.data[byteIdx] >> bitIdx & 1 : 0;
|
|
54
|
+
val = val * 2 + bit;
|
|
58
55
|
}
|
|
59
56
|
this.bitPos += n;
|
|
60
|
-
return val
|
|
57
|
+
return val;
|
|
61
58
|
}
|
|
62
59
|
/** Read `n` bits as signed (two's complement) integer. */
|
|
63
60
|
readS(n) {
|
|
@@ -68,9 +65,9 @@ var BitReader = class {
|
|
|
68
65
|
/** Read `n` bits as sign-magnitude integer (MSB = sign, rest = magnitude). */
|
|
69
66
|
readSM(n) {
|
|
70
67
|
const val = this.readU(n);
|
|
71
|
-
const
|
|
72
|
-
const mag = val
|
|
73
|
-
return
|
|
68
|
+
const half = 2 ** (n - 1);
|
|
69
|
+
const mag = val % half;
|
|
70
|
+
return val >= half ? -mag : mag;
|
|
74
71
|
}
|
|
75
72
|
/** Skip `n` bits. */
|
|
76
73
|
skip(n) {
|
|
@@ -864,17 +861,14 @@ var BitReader2 = class {
|
|
|
864
861
|
this.data = data;
|
|
865
862
|
this.pos = startBit;
|
|
866
863
|
}
|
|
867
|
-
/** Read unsigned value of numBits bits */
|
|
864
|
+
/** Read unsigned value of numBits bits (max 53) */
|
|
868
865
|
u(numBits) {
|
|
869
866
|
let val = 0;
|
|
870
867
|
for (let i = 0; i < numBits; i++) {
|
|
871
868
|
const byteIdx = this.pos + i >>> 3;
|
|
872
869
|
const bitIdx = 7 - (this.pos + i & 7);
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
} else {
|
|
876
|
-
val <<= 1;
|
|
877
|
-
}
|
|
870
|
+
const bit = byteIdx < this.data.length ? this.data[byteIdx] >>> bitIdx & 1 : 0;
|
|
871
|
+
val = val * 2 + bit;
|
|
878
872
|
}
|
|
879
873
|
this.pos += numBits;
|
|
880
874
|
return val;
|
|
@@ -882,8 +876,8 @@ var BitReader2 = class {
|
|
|
882
876
|
/** Read signed value (two's complement) */
|
|
883
877
|
s(numBits) {
|
|
884
878
|
const raw = this.u(numBits);
|
|
885
|
-
const
|
|
886
|
-
return
|
|
879
|
+
const half = 2 ** (numBits - 1);
|
|
880
|
+
return raw >= half ? raw - 2 ** numBits : raw;
|
|
887
881
|
}
|
|
888
882
|
/** Skip bits */
|
|
889
883
|
skip(n) {
|
|
@@ -1018,7 +1012,6 @@ function decodeMsmFull(frame) {
|
|
|
1018
1012
|
const rdop = new Float64Array(numSat);
|
|
1019
1013
|
if (variant === 4 || variant === 6) {
|
|
1020
1014
|
for (let j = 0; j < numSat; j++) rrint[j] = bits.u(8);
|
|
1021
|
-
for (let j = 0; j < numSat; j++) extsat[j] = bits.u(4);
|
|
1022
1015
|
for (let j = 0; j < numSat; j++) rrmod[j] = bits.u(10) / 1024;
|
|
1023
1016
|
} else {
|
|
1024
1017
|
for (let j = 0; j < numSat; j++) rrint[j] = bits.u(8);
|
|
@@ -1044,27 +1037,27 @@ function decodeMsmFull(frame) {
|
|
|
1044
1037
|
cp.fill(-1e30);
|
|
1045
1038
|
dop.fill(-1e30);
|
|
1046
1039
|
if (variant === 4) {
|
|
1047
|
-
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(15) /
|
|
1048
|
-
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(22) /
|
|
1040
|
+
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(15) / 2 ** 24;
|
|
1041
|
+
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(22) / 2 ** 29;
|
|
1049
1042
|
for (let i = 0; i < activeCells; i++) ll[i] = bits.u(4);
|
|
1050
1043
|
for (let i = 0; i < activeCells; i++) hc[i] = bits.u(1);
|
|
1051
1044
|
for (let i = 0; i < activeCells; i++) cnr[i] = bits.u(6);
|
|
1052
1045
|
} else if (variant === 5) {
|
|
1053
|
-
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(15) /
|
|
1054
|
-
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(22) /
|
|
1046
|
+
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(15) / 2 ** 24;
|
|
1047
|
+
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(22) / 2 ** 29;
|
|
1055
1048
|
for (let i = 0; i < activeCells; i++) ll[i] = bits.u(4);
|
|
1056
1049
|
for (let i = 0; i < activeCells; i++) hc[i] = bits.u(1);
|
|
1057
1050
|
for (let i = 0; i < activeCells; i++) cnr[i] = bits.u(6);
|
|
1058
1051
|
for (let i = 0; i < activeCells; i++) dop[i] = bits.s(15) * 1e-4;
|
|
1059
1052
|
} else if (variant === 6) {
|
|
1060
|
-
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(20) /
|
|
1061
|
-
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(24) /
|
|
1053
|
+
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(20) / 2 ** 29;
|
|
1054
|
+
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(24) / 2 ** 31;
|
|
1062
1055
|
for (let i = 0; i < activeCells; i++) ll[i] = bits.u(10);
|
|
1063
1056
|
for (let i = 0; i < activeCells; i++) hc[i] = bits.u(1);
|
|
1064
1057
|
for (let i = 0; i < activeCells; i++) cnr[i] = bits.u(10) / 16;
|
|
1065
1058
|
} else {
|
|
1066
|
-
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(20) /
|
|
1067
|
-
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(24) /
|
|
1059
|
+
for (let i = 0; i < activeCells; i++) psr[i] = bits.s(20) / 2 ** 29;
|
|
1060
|
+
for (let i = 0; i < activeCells; i++) cp[i] = bits.s(24) / 2 ** 31;
|
|
1068
1061
|
for (let i = 0; i < activeCells; i++) ll[i] = bits.u(10);
|
|
1069
1062
|
for (let i = 0; i < activeCells; i++) hc[i] = bits.u(1);
|
|
1070
1063
|
for (let i = 0; i < activeCells; i++) cnr[i] = bits.u(10) / 16;
|
package/dist/rtcm3.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-
|
|
2
|
-
export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-
|
|
1
|
+
import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-C10stHhM.cjs';
|
|
2
|
+
export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-C10stHhM.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Full RTCM3 MSM4-7 decoder — extracts pseudorange, carrier phase,
|
package/dist/rtcm3.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-
|
|
2
|
-
export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-
|
|
1
|
+
import { a as Rtcm3Frame, E as EphemerisInfo } from './ephemeris-C10stHhM.js';
|
|
2
|
+
export { B as BitReader, R as Rtcm3Decoder, d as decodeEphemeris, r as readString } from './ephemeris-C10stHhM.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Full RTCM3 MSM4-7 decoder — extracts pseudorange, carrier phase,
|
package/dist/rtcm3.js
CHANGED
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
rtcm3Constellation,
|
|
13
13
|
updateStationMeta,
|
|
14
14
|
updateStreamStats
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-WP2JFDLA.js";
|
|
16
|
+
import "./chunk-LWNTWBHB.js";
|
|
17
17
|
export {
|
|
18
18
|
BitReader,
|
|
19
19
|
RTCM3_MESSAGE_NAMES,
|