gnss-js 1.0.0 → 1.1.0

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.
Files changed (39) hide show
  1. package/README.md +26 -0
  2. package/dist/analysis.cjs +143 -36
  3. package/dist/analysis.js +3 -3
  4. package/dist/{chunk-HKN3PUGN.js → chunk-5SPJH4MG.js} +35 -26
  5. package/dist/{chunk-WR7LCB52.js → chunk-BJHTBYNG.js} +15 -4
  6. package/dist/{chunk-Y3R57B5P.js → chunk-G3N4S3DM.js} +37 -8
  7. package/dist/{chunk-PRSZIWKM.js → chunk-JDO3LEPC.js} +100 -132
  8. package/dist/{chunk-K7WZQFBV.js → chunk-MIIM4LDY.js} +4 -1
  9. package/dist/{chunk-CB6EOOLA.js → chunk-OZCYOM5D.js} +70 -21
  10. package/dist/{chunk-SDRRAJT5.js → chunk-PGHDJFQK.js} +31 -14
  11. package/dist/{chunk-IS4UUDBV.js → chunk-W4YMQKWH.js} +54 -9
  12. package/dist/{chunk-354IRDOG.js → chunk-W5WKEV7U.js} +39 -9
  13. package/dist/constants.cjs +39 -9
  14. package/dist/constants.js +26 -26
  15. package/dist/coordinates.cjs +4 -1
  16. package/dist/coordinates.js +1 -1
  17. package/dist/{ephemeris-BUWzfmBy.d.cts → ephemeris-Ohl6NAfw.d.cts} +12 -2
  18. package/dist/{ephemeris-BUWzfmBy.d.ts → ephemeris-Ohl6NAfw.d.ts} +12 -2
  19. package/dist/index.cjs +366 -220
  20. package/dist/index.d.cts +2 -2
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +40 -34
  23. package/dist/ntrip.cjs +15 -4
  24. package/dist/ntrip.js +1 -1
  25. package/dist/orbit.cjs +31 -14
  26. package/dist/orbit.d.cts +1 -1
  27. package/dist/orbit.d.ts +1 -1
  28. package/dist/orbit.js +2 -1
  29. package/dist/rinex.cjs +123 -29
  30. package/dist/rinex.js +3 -3
  31. package/dist/rtcm3.cjs +123 -131
  32. package/dist/rtcm3.d.cts +9 -3
  33. package/dist/rtcm3.d.ts +9 -3
  34. package/dist/rtcm3.js +9 -2
  35. package/dist/signals.cjs +55 -26
  36. package/dist/signals.d.cts +26 -26
  37. package/dist/signals.d.ts +26 -26
  38. package/dist/signals.js +2 -1
  39. package/package.json +1 -2
package/dist/index.d.cts CHANGED
@@ -7,8 +7,8 @@ export { c as clampUnit, e as ecefToGeodetic, g as geodeticToEcef, a as getAer,
7
7
  export { CrxField, DiffState, EMPTY_WARNINGS, RinexWarning, RinexWarnings, WarningAccumulator, WarningSeverity, crxDecompress, crxRepair, fmtF, hdrLine, padL, padR, parseCrxDataLine, writeRinexNav } from './rinex.cjs';
8
8
  export { E as EpochSummary, P as ParseOptions, R as RinexHeader, a as RinexResult, b as RinexStats, S as SYSTEM_ORDER, c as SatObsCallback, p as parseRinexStream, s as systemCmp, d as systemName } from './parser-JPjjFgeP.cjs';
9
9
  export { E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris, N as NavHeader, a as NavResult, p as parseNavFile } from './nav-BAI1a9vK.cjs';
10
- export { B as BitReader, E as EphemerisInfo, R as Rtcm3Decoder, a as Rtcm3Frame, d as decodeEphemeris, r as readString } from './ephemeris-BUWzfmBy.cjs';
11
- export { MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, StationMeta, StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, updateStationMeta, updateStreamStats } from './rtcm3.cjs';
10
+ export { B as BitReader, E as EphemerisInfo, R as Rtcm3DebugHandler, a as Rtcm3Decoder, b as Rtcm3Frame, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-Ohl6NAfw.cjs';
11
+ export { MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, StationMeta, StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats } from './rtcm3.cjs';
12
12
  export { AllPositionsData, DopValues, EpochSkyData, SatAzEl, SatPoint, SatPosition, computeAllPositions, computeDop, computeLiveSkyPositions, computeSatPosition, ecefToAzEl, glonassPosition, keplerPosition, navTimesFromEph, selectEphemeris } from './orbit.cjs';
13
13
  export { NtripCaster, NtripConnectionInfo, NtripNetwork, NtripStream, NtripStreamConnection, NtripVersion, Sourcetable, SourcetableEntry, connectToMountpoint, fetchSourcetable, parseSourcetable } from './ntrip.cjs';
14
14
  export { CompleteSatSignal, CompleteSignalStats, CompletenessAccumulator, CompletenessResult, CycleSlipAccumulator, CycleSlipEvent, CycleSlipResult, CycleSlipSignalStats, MultipathAccumulator, MultipathPoint, MultipathResult, MultipathSeries, MultipathSignalStat, QualityResult, analyzeQuality } from './analysis.cjs';
package/dist/index.d.ts CHANGED
@@ -7,8 +7,8 @@ export { c as clampUnit, e as ecefToGeodetic, g as geodeticToEcef, a as getAer,
7
7
  export { CrxField, DiffState, EMPTY_WARNINGS, RinexWarning, RinexWarnings, WarningAccumulator, WarningSeverity, crxDecompress, crxRepair, fmtF, hdrLine, padL, padR, parseCrxDataLine, writeRinexNav } from './rinex.js';
8
8
  export { E as EpochSummary, P as ParseOptions, R as RinexHeader, a as RinexResult, b as RinexStats, S as SYSTEM_ORDER, c as SatObsCallback, p as parseRinexStream, s as systemCmp, d as systemName } from './parser-JPjjFgeP.js';
9
9
  export { E as Ephemeris, G as GlonassEphemeris, K as KeplerEphemeris, N as NavHeader, a as NavResult, p as parseNavFile } from './nav-BAI1a9vK.js';
10
- export { B as BitReader, E as EphemerisInfo, R as Rtcm3Decoder, a as Rtcm3Frame, d as decodeEphemeris, r as readString } from './ephemeris-BUWzfmBy.js';
11
- export { MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, StationMeta, StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, updateStationMeta, updateStreamStats } from './rtcm3.js';
10
+ export { B as BitReader, E as EphemerisInfo, R as Rtcm3DebugHandler, a as Rtcm3Decoder, b as Rtcm3Frame, d as decodeEphemeris, r as readString, c as reportDecodeError, s as setRtcm3DebugHandler } from './ephemeris-Ohl6NAfw.js';
11
+ export { MessageTypeStats, MsmEpoch, MsmSatObs, MsmSignal, RTCM3_MESSAGE_NAMES, SatCn0, SignalCn0, StationMeta, StreamStats, createStationMeta, createStreamStats, decodeMsmFull, msmEpochToDate, resetGloFreqCache, rtcm3Constellation, setGloFreqNumber, updateStationMeta, updateStreamStats } from './rtcm3.js';
12
12
  export { AllPositionsData, DopValues, EpochSkyData, SatAzEl, SatPoint, SatPosition, computeAllPositions, computeDop, computeLiveSkyPositions, computeSatPosition, ecefToAzEl, glonassPosition, keplerPosition, navTimesFromEph, selectEphemeris } from './orbit.js';
13
13
  export { NtripCaster, NtripConnectionInfo, NtripNetwork, NtripStream, NtripStreamConnection, NtripVersion, Sourcetable, SourcetableEntry, connectToMountpoint, fetchSourcetable, parseSourcetable } from './ntrip.js';
14
14
  export { CompleteSatSignal, CompleteSignalStats, CompletenessAccumulator, CompletenessResult, CycleSlipAccumulator, CycleSlipEvent, CycleSlipResult, CycleSlipSignalStats, MultipathAccumulator, MultipathPoint, MultipathResult, MultipathSeries, MultipathSignalStat, QualityResult, analyzeQuality } from './analysis.js';
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  CycleSlipAccumulator,
4
4
  MultipathAccumulator,
5
5
  analyzeQuality
6
- } from "./chunk-Y3R57B5P.js";
6
+ } from "./chunk-G3N4S3DM.js";
7
7
  import {
8
8
  frequencyLabel,
9
9
  parseAntex
@@ -48,7 +48,7 @@ import {
48
48
  phiBOCc,
49
49
  phiBOCs,
50
50
  phiBPSK
51
- } from "./chunk-HKN3PUGN.js";
51
+ } from "./chunk-5SPJH4MG.js";
52
52
  import {
53
53
  Scale,
54
54
  getBdsTime,
@@ -114,33 +114,8 @@ import {
114
114
  rad2deg,
115
115
  rhumbLine,
116
116
  vincenty
117
- } from "./chunk-K7WZQFBV.js";
117
+ } from "./chunk-MIIM4LDY.js";
118
118
  import "./chunk-5S5MONFK.js";
119
- import {
120
- DAYS_MJD2000_MJD,
121
- DAYS_MJD_JULIAN,
122
- MILLISECONDS_GPS_TAI,
123
- MILLISECONDS_IN_DAY,
124
- MILLISECONDS_IN_HOUR,
125
- MILLISECONDS_IN_MINUTE,
126
- MILLISECONDS_IN_SECOND,
127
- MILLISECONDS_IN_WEEK,
128
- MILLISECONDS_TT_TAI,
129
- RINEX_CODES,
130
- SECONDS_IN_DAY,
131
- SECONDS_IN_HOUR,
132
- SECONDS_IN_MINUTE,
133
- SECONDS_IN_WEEK,
134
- START_BDS_TIME,
135
- START_GAL_TIME,
136
- START_GLO_LEAP,
137
- START_GPS_TIME,
138
- START_JULIAN_TAI,
139
- START_MJD_UNIX_SECONDS,
140
- START_NTP_TIME,
141
- START_TAI_TIME,
142
- START_UNIX_TIME
143
- } from "./chunk-LEEU5OIO.js";
144
119
  import {
145
120
  EMPTY_WARNINGS,
146
121
  WarningAccumulator,
@@ -150,7 +125,7 @@ import {
150
125
  padR,
151
126
  parseNavFile,
152
127
  writeRinexNav
153
- } from "./chunk-IS4UUDBV.js";
128
+ } from "./chunk-W4YMQKWH.js";
154
129
  import {
155
130
  SYSTEM_ORDER,
156
131
  crxDecompress,
@@ -159,7 +134,7 @@ import {
159
134
  parseRinexStream,
160
135
  systemCmp,
161
136
  systemName
162
- } from "./chunk-CB6EOOLA.js";
137
+ } from "./chunk-OZCYOM5D.js";
163
138
  import {
164
139
  BitReader,
165
140
  RTCM3_MESSAGE_NAMES,
@@ -170,11 +145,14 @@ import {
170
145
  decodeMsmFull,
171
146
  msmEpochToDate,
172
147
  readString,
148
+ reportDecodeError,
173
149
  resetGloFreqCache,
174
150
  rtcm3Constellation,
151
+ setGloFreqNumber,
152
+ setRtcm3DebugHandler,
175
153
  updateStationMeta,
176
154
  updateStreamStats
177
- } from "./chunk-PRSZIWKM.js";
155
+ } from "./chunk-JDO3LEPC.js";
178
156
  import {
179
157
  ARC_GAP_FACTOR,
180
158
  BAND_LABELS,
@@ -196,7 +174,7 @@ import {
196
174
  formatUTCTime,
197
175
  getFreq,
198
176
  gloFreq
199
- } from "./chunk-354IRDOG.js";
177
+ } from "./chunk-W5WKEV7U.js";
200
178
  import {
201
179
  computeAllPositions,
202
180
  computeDop,
@@ -207,7 +185,7 @@ import {
207
185
  keplerPosition,
208
186
  navTimesFromEph,
209
187
  selectEphemeris
210
- } from "./chunk-SDRRAJT5.js";
188
+ } from "./chunk-PGHDJFQK.js";
211
189
  import {
212
190
  clampUnit,
213
191
  ecefToGeodetic,
@@ -221,11 +199,36 @@ import {
221
199
  WGS84_SEMI_MAJOR_AXIS,
222
200
  WGS84_SEMI_MINOR_AXIS
223
201
  } from "./chunk-6FAL6P4G.js";
202
+ import {
203
+ DAYS_MJD2000_MJD,
204
+ DAYS_MJD_JULIAN,
205
+ MILLISECONDS_GPS_TAI,
206
+ MILLISECONDS_IN_DAY,
207
+ MILLISECONDS_IN_HOUR,
208
+ MILLISECONDS_IN_MINUTE,
209
+ MILLISECONDS_IN_SECOND,
210
+ MILLISECONDS_IN_WEEK,
211
+ MILLISECONDS_TT_TAI,
212
+ RINEX_CODES,
213
+ SECONDS_IN_DAY,
214
+ SECONDS_IN_HOUR,
215
+ SECONDS_IN_MINUTE,
216
+ SECONDS_IN_WEEK,
217
+ START_BDS_TIME,
218
+ START_GAL_TIME,
219
+ START_GLO_LEAP,
220
+ START_GPS_TIME,
221
+ START_JULIAN_TAI,
222
+ START_MJD_UNIX_SECONDS,
223
+ START_NTP_TIME,
224
+ START_TAI_TIME,
225
+ START_UNIX_TIME
226
+ } from "./chunk-LEEU5OIO.js";
224
227
  import {
225
228
  connectToMountpoint,
226
229
  fetchSourcetable,
227
230
  parseSourcetable
228
- } from "./chunk-WR7LCB52.js";
231
+ } from "./chunk-BJHTBYNG.js";
229
232
  export {
230
233
  ARC_GAP_FACTOR,
231
234
  BAND_LABELS,
@@ -413,10 +416,13 @@ export {
413
416
  phiBPSK,
414
417
  rad2deg,
415
418
  readString,
419
+ reportDecodeError,
416
420
  resetGloFreqCache,
417
421
  rhumbLine,
418
422
  rtcm3Constellation,
419
423
  selectEphemeris,
424
+ setGloFreqNumber,
425
+ setRtcm3DebugHandler,
420
426
  systemCmp,
421
427
  systemName,
422
428
  updateStationMeta,
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}`, { cause: err });
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("Authentication required. Please provide valid credentials.");
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(proxyUrl, `/${info.mountpoint}`, headers, combinedSignal);
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("No response body \u2014 streaming not supported by this environment.");
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
@@ -2,7 +2,7 @@ import {
2
2
  connectToMountpoint,
3
3
  fetchSourcetable,
4
4
  parseSourcetable
5
- } from "./chunk-WR7LCB52.js";
5
+ } from "./chunk-BJHTBYNG.js";
6
6
  export {
7
7
  connectToMountpoint,
8
8
  fetchSourcetable,
package/dist/orbit.cjs CHANGED
@@ -71,12 +71,18 @@ function ecefToGeodetic(x, y, z) {
71
71
  return [lat, lon, alt];
72
72
  }
73
73
 
74
+ // src/constants/time.ts
75
+ var START_GPS_TIME = /* @__PURE__ */ new Date("1980-01-06T00:00:00Z");
76
+ var START_BDS_TIME = /* @__PURE__ */ new Date("2006-01-01T00:00:14Z");
77
+
74
78
  // src/orbit/index.ts
75
79
  var GM_GPS = 3986005e8;
76
80
  var GM_GAL = 3986004418e5;
77
81
  var GM_BDS = 3986004418e5;
78
82
  var GM_GLO = 39860044e7;
79
83
  var OMEGA_E = 72921151467e-15;
84
+ var BDS_GEO_MAX_INCLINATION_RAD = 0.1;
85
+ var BDS_GEO_MIN_SEMIMAJOR_AXIS_M = 4e7;
80
86
  var AE_GLO = 6378136;
81
87
  var J2_GLO = 108263e-8;
82
88
  var TWO_PI = 2 * Math.PI;
@@ -102,10 +108,7 @@ function keplerPosition(eph, t) {
102
108
  }
103
109
  const sinE = Math.sin(Ek);
104
110
  const cosE = Math.cos(Ek);
105
- const vk = Math.atan2(
106
- Math.sqrt(1 - eph.e * eph.e) * sinE,
107
- cosE - eph.e
108
- );
111
+ const vk = Math.atan2(Math.sqrt(1 - eph.e * eph.e) * sinE, cosE - eph.e);
109
112
  const phik = vk + eph.omega;
110
113
  const sin2phi = Math.sin(2 * phik);
111
114
  const cos2phi = Math.cos(2 * phik);
@@ -117,7 +120,7 @@ function keplerPosition(eph, t) {
117
120
  const ik = eph.i0 + dik + eph.idot * tk;
118
121
  const xp = rk * Math.cos(uk);
119
122
  const yp = rk * Math.sin(uk);
120
- const isBdsGeo = eph.system === "C" && Math.abs(eph.i0) < 0.1 && a > 4e7;
123
+ const isBdsGeo = eph.system === "C" && Math.abs(eph.i0) < BDS_GEO_MAX_INCLINATION_RAD && a > BDS_GEO_MIN_SEMIMAJOR_AXIS_M;
121
124
  if (isBdsGeo) {
122
125
  const omegak2 = eph.omega0 + eph.omegaDot * tk - OMEGA_E * eph.toe;
123
126
  const cosO2 = Math.cos(omegak2);
@@ -268,7 +271,10 @@ function invert4x4(m) {
268
271
  let det = a[0] * inv[0] + a[1] * inv[4] + a[2] * inv[8] + a[3] * inv[12];
269
272
  if (Math.abs(det) < 1e-20) return null;
270
273
  det = 1 / det;
271
- const result = Array.from({ length: 4 }, () => new Array(4).fill(0));
274
+ const result = Array.from(
275
+ { length: 4 },
276
+ () => new Array(4).fill(0)
277
+ );
272
278
  for (let i = 0; i < 4; i++) {
273
279
  for (let j = 0; j < 4; j++) {
274
280
  result[i][j] = inv[i * 4 + j] * det;
@@ -295,9 +301,10 @@ function computeSatPosition(eph, timeMs) {
295
301
  if (eph.system === "R" || eph.system === "S") {
296
302
  return glonassPosition(eph, timeMs / 1e3);
297
303
  }
298
- const GPS_EPOCH = Date.UTC(1980, 0, 6);
304
+ const GPS_EPOCH = START_GPS_TIME.getTime();
299
305
  const gpsSeconds = (timeMs - GPS_EPOCH) / 1e3;
300
- const tow = gpsSeconds % (7 * 86400);
306
+ let tow = gpsSeconds % (7 * 86400);
307
+ if (eph.system === "C") tow = (tow - 14 + 604800) % 604800;
301
308
  return keplerPosition(eph, tow);
302
309
  }
303
310
  function navTimesFromEph(ephs) {
@@ -379,16 +386,22 @@ function selectBest(ephs, timeMs) {
379
386
  }
380
387
  return best;
381
388
  }
382
- var GPS_EPOCH_MS = Date.UTC(1980, 0, 6);
383
- var BDS_EPOCH_MS = Date.UTC(2006, 0, 1);
389
+ var GPS_EPOCH_MS = START_GPS_TIME.getTime();
390
+ var BDS_EPOCH_MS = START_BDS_TIME.getTime();
384
391
  var GAL_EPOCH_MS = GPS_EPOCH_MS;
385
392
  function ephInfoToEphemeris(info) {
386
393
  const sys = info.prn.charAt(0);
387
394
  if (sys === "R") {
388
- if (info.x === void 0 || info.y === void 0 || info.z === void 0) return null;
389
- if (info.vx === void 0 || info.vy === void 0 || info.vz === void 0) return null;
395
+ if (info.x === void 0 || info.y === void 0 || info.z === void 0)
396
+ return null;
397
+ if (info.vx === void 0 || info.vy === void 0 || info.vz === void 0)
398
+ return null;
390
399
  const now = new Date(info.lastReceived);
391
- const utcMidnight = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
400
+ const utcMidnight = Date.UTC(
401
+ now.getUTCFullYear(),
402
+ now.getUTCMonth(),
403
+ now.getUTCDate()
404
+ );
392
405
  const tbSec = (info.tb ?? 0) * 900;
393
406
  const moscowOffset = 3 * 3600;
394
407
  const tocMs = utcMidnight + (tbSec - moscowOffset) * 1e3;
@@ -413,7 +426,11 @@ function ephInfoToEphemeris(info) {
413
426
  freqNum: info.freqChannel ?? 0
414
427
  };
415
428
  }
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) return null;
429
+ 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)
430
+ return null;
431
+ if (info.eccentricity < 0 || info.eccentricity >= 1 || info.sqrtA < 3e3 || info.sqrtA > 9e3 || info.toe < 0 || info.toe > 604800) {
432
+ return null;
433
+ }
417
434
  let epochMs;
418
435
  const tocSec = info.toc ?? info.toe;
419
436
  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-BUWzfmBy.cjs';
2
+ import { E as EphemerisInfo } from './ephemeris-Ohl6NAfw.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-BUWzfmBy.js';
2
+ import { E as EphemerisInfo } from './ephemeris-Ohl6NAfw.js';
3
3
  export { e as ecefToGeodetic, g as geodeticToEcef } from './ecef-CF0uAysr.js';
4
4
 
5
5
  /**
package/dist/orbit.js CHANGED
@@ -8,12 +8,13 @@ import {
8
8
  keplerPosition,
9
9
  navTimesFromEph,
10
10
  selectEphemeris
11
- } from "./chunk-SDRRAJT5.js";
11
+ } from "./chunk-PGHDJFQK.js";
12
12
  import {
13
13
  ecefToGeodetic,
14
14
  geodeticToEcef
15
15
  } from "./chunk-37QNKGTC.js";
16
16
  import "./chunk-6FAL6P4G.js";
17
+ import "./chunk-LEEU5OIO.js";
17
18
  export {
18
19
  computeAllPositions,
19
20
  computeDop,
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({ empty: false, init: true, arcOrder, value: isNaN(value) ? 0 : value });
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({ empty: false, init: false, arcOrder: -1, value: isNaN(value) ? 0 : value });
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 { state: { accum: a, order: 0, arcOrder: field.arcOrder }, result: field.value };
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 { state: { accum, order, arcOrder: prev.arcOrder }, result: accum[0] };
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(SYSTEM_ORDER.map((s, i) => [s, i]));
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 { time, flag: isNaN(flag) ? 0 : flag, numSats: isNaN(numSats) ? 0 : numSats };
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 { time, flag: isNaN(flag) ? 0 : flag, numSats: isNaN(numSats) ? 0 : numSats, satIds };
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) snrBySys[sys] = vals.reduce((a, b) => a + b, 0) / vals.length;
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) snrPerSat[prn] = vals.reduce((a, b) => a + b, 0) / vals.length;
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) snrPerSatBand[key] = vals.reduce((a, b) => a + b, 0) / vals.length;
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++) values[i] = readObsValue(obsLine, 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(0, Math.ceil((info.numSats - 12) / 12));
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("Unix compress (.Z) files are not supported. Please decompress first (e.g. uncompress or gzip -d).");
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?.(Math.min(99, Math.round(bytesRead / (file.size * 4) * 100)));
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(decoder.decode(arrayBuf, { stream: end < file.size }), false);
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") finishEpoch();
767
- if (!header) throw new Error("No valid RINEX header found (missing END OF HEADER).");
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 { header, epochs, stats: computeStats(header, epochs, satellitesSeen) };
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) duration = (endTime.getTime() - startTime.getTime()) / 1e3;
823
+ if (startTime && endTime)
824
+ duration = (endTime.getTime() - startTime.getTime()) / 1e3;
777
825
  let interval = header.interval;
778
- if (interval === null && n >= 2) interval = (epochs[1].time - epochs[0].time) / 1e3;
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("MISSING_ANT_TYPE", "info", "Missing antenna type (ANT # / TYPE)");
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("MISSING_REC_TYPE", "info", "Missing receiver type (REC # / TYPE / VERS)");
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("NO_OBS_TYPES", "error", "No observation types defined in header");
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("UNKNOWN_SYSTEM", "info", "Unknown satellite system letter", prn);
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(["LNAV", "INAV", "FNAV", "D1", "D2", "SBAS", "FDMA"]);
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(buildStateVectorEphemeris(sys2, prn2, parsed.date, parsed.values, dataLines2));
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(buildKeplerEphemeris(sys2, prn2, parsed.date, parsed.values, dataLines2));
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(buildStateVectorEphemeris(sys, prn, date, epochVals, dataLines));
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(buildKeplerEphemeris(sys, prn, date, epochVals, dataLines));
1341
+ ephemerides.push(
1342
+ buildKeplerEphemeris(sys, prn, date, epochVals, dataLines)
1343
+ );
1250
1344
  }
1251
1345
  }
1252
1346
  i++;