gnss-js 1.62.0 → 1.64.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.
package/dist/index.cjs CHANGED
@@ -144,8 +144,11 @@ __export(src_exports, {
144
144
  dateToEpoch: () => dateToEpoch,
145
145
  decodeBinexEph: () => decodeBinexEph,
146
146
  decodeEphemeris: () => decodeEphemeris,
147
+ decodeIgsSsr: () => decodeIgsSsr,
148
+ decodeLegacyObs: () => decodeLegacyObs,
147
149
  decodeMsmFull: () => decodeMsmFull,
148
150
  decodeSbfNavigation: () => decodeSbfNavigation,
151
+ decodeSsr: () => decodeSsr,
149
152
  deg2dms: () => deg2dms,
150
153
  deg2rad: () => deg2rad,
151
154
  detrendIonoArcs: () => detrendIonoArcs,
@@ -238,6 +241,7 @@ __export(src_exports, {
238
241
  ionoFree: () => ionoFree,
239
242
  isSbasL1Preamble: () => isSbasL1Preamble,
240
243
  isSbasL5Correction: () => isSbasL5Correction,
244
+ isSsrMessage: () => isSsrMessage,
241
245
  keplerPosition: () => keplerPosition,
242
246
  klobucharDelay: () => klobucharDelay,
243
247
  lambdaReduction: () => lambdaReduction,
@@ -5019,6 +5023,302 @@ function decodeEphemeris(frame) {
5019
5023
  }
5020
5024
  }
5021
5025
 
5026
+ // src/rtcm3/igs-ssr.ts
5027
+ var UPDATE_INTERVAL_S = [
5028
+ 1,
5029
+ 2,
5030
+ 5,
5031
+ 10,
5032
+ 15,
5033
+ 30,
5034
+ 60,
5035
+ 120,
5036
+ 240,
5037
+ 300,
5038
+ 600,
5039
+ 900,
5040
+ 1800,
5041
+ 3600,
5042
+ 7200,
5043
+ 10800
5044
+ ];
5045
+ var SYSTEM_BY_BASE = {
5046
+ 20: "G",
5047
+ 40: "R",
5048
+ 60: "E",
5049
+ 80: "J",
5050
+ 100: "C",
5051
+ 120: "S"
5052
+ };
5053
+ var KIND_BY_OFFSET = {
5054
+ 1: "orbit",
5055
+ 2: "clock",
5056
+ 3: "combined",
5057
+ 4: "highRateClock",
5058
+ 5: "codeBias",
5059
+ 6: "phaseBias",
5060
+ 7: "ura"
5061
+ };
5062
+ var two = (n) => n.toString().padStart(2, "0");
5063
+ function prnFor(system, id) {
5064
+ if (system === "J") return `J${two(id)}`;
5065
+ if (system === "S") return `S${two(19 + id)}`;
5066
+ return `${system}${two(id)}`;
5067
+ }
5068
+ function ssrUraMm(v) {
5069
+ if (v === 0) return null;
5070
+ const cls = v >> 3 & 7;
5071
+ const val = v & 7;
5072
+ return 3 ** cls * (1 + val / 4) - 1;
5073
+ }
5074
+ function decodeIgsSsr(frame) {
5075
+ if (frame.messageType !== 4076) return null;
5076
+ const r = new BitReader(frame.payload);
5077
+ r.readU(12);
5078
+ const version = r.readU(3);
5079
+ const im = r.readU(8);
5080
+ if (im === 201) return decodeIono(r, version, im);
5081
+ const base = Math.floor(im / 20) * 20;
5082
+ const system = SYSTEM_BY_BASE[base];
5083
+ const kind = KIND_BY_OFFSET[im - base];
5084
+ if (!system || !kind) return null;
5085
+ const epochS = r.readU(20);
5086
+ const updateIntervalS = UPDATE_INTERVAL_S[r.readU(4)];
5087
+ const multipleMessage = r.readU(1) === 1;
5088
+ const iodSsr = r.readU(4);
5089
+ const providerId = r.readU(16);
5090
+ const solutionId = r.readU(4);
5091
+ const hasDatum = kind === "orbit" || kind === "combined";
5092
+ const referenceDatum = hasDatum ? r.readU(1) : void 0;
5093
+ let dispersiveConsistency;
5094
+ let mwConsistency;
5095
+ if (kind === "phaseBias") {
5096
+ dispersiveConsistency = r.readU(1) === 1;
5097
+ mwConsistency = r.readU(1) === 1;
5098
+ }
5099
+ const nsat = r.readU(6);
5100
+ const readOrbit = (s) => {
5101
+ s.iode = r.readU(8);
5102
+ s.deltaRadial = r.readS(22) * 1e-4;
5103
+ s.deltaAlongTrack = r.readS(20) * 4e-4;
5104
+ s.deltaCrossTrack = r.readS(20) * 4e-4;
5105
+ s.dotRadial = r.readS(21) * 1e-6;
5106
+ s.dotAlongTrack = r.readS(19) * 4e-6;
5107
+ s.dotCrossTrack = r.readS(19) * 4e-6;
5108
+ };
5109
+ const readClock2 = (s) => {
5110
+ s.c0 = r.readS(22) * 1e-4;
5111
+ s.c1 = r.readS(21) * 1e-6;
5112
+ s.c2 = r.readS(27) * 2e-8;
5113
+ };
5114
+ const satellites = [];
5115
+ for (let i = 0; i < nsat; i++) {
5116
+ const id = r.readU(6);
5117
+ const sat = { prn: prnFor(system, id) };
5118
+ if (kind === "orbit" || kind === "combined") readOrbit(sat);
5119
+ if (kind === "clock" || kind === "combined") readClock2(sat);
5120
+ else if (kind === "ura")
5121
+ sat.uraMm = ssrUraMm(r.readU(6));
5122
+ else if (kind === "highRateClock")
5123
+ sat.highRateClock = r.readS(22) * 1e-4;
5124
+ else if (kind === "codeBias") {
5125
+ const n = r.readU(5);
5126
+ const biases = [];
5127
+ for (let b = 0; b < n; b++) {
5128
+ const signal = r.readU(5);
5129
+ biases.push({
5130
+ signal,
5131
+ signalName: `#${signal}`,
5132
+ biasM: r.readS(14) * 0.01
5133
+ // IDF025 0.01 m
5134
+ });
5135
+ }
5136
+ sat.codeBiases = biases;
5137
+ } else if (kind === "phaseBias") {
5138
+ const n = r.readU(5);
5139
+ r.readU(9);
5140
+ r.readS(8);
5141
+ const biases = [];
5142
+ for (let b = 0; b < n; b++) {
5143
+ const signal = r.readU(5);
5144
+ const integer = r.readU(1) === 1;
5145
+ const wideLaneGroup = r.readU(2);
5146
+ const discontinuity = r.readU(4);
5147
+ const biasM = r.readS(20) * 1e-4;
5148
+ biases.push({ signal, integer, wideLaneGroup, discontinuity, biasM });
5149
+ }
5150
+ sat.phaseBiases = biases;
5151
+ }
5152
+ satellites.push(sat);
5153
+ }
5154
+ return {
5155
+ messageType: 4076,
5156
+ version,
5157
+ igsMessageNumber: im,
5158
+ system,
5159
+ kind,
5160
+ epochS,
5161
+ updateIntervalS,
5162
+ multipleMessage,
5163
+ referenceDatum,
5164
+ iodSsr,
5165
+ providerId,
5166
+ solutionId,
5167
+ dispersiveConsistency,
5168
+ mwConsistency,
5169
+ satellites
5170
+ };
5171
+ }
5172
+ function decodeIono(r, version, im) {
5173
+ const epochS = r.readU(20);
5174
+ const updateIntervalS = UPDATE_INTERVAL_S[r.readU(4)];
5175
+ const multipleMessage = r.readU(1) === 1;
5176
+ const iodSsr = r.readU(4);
5177
+ const providerId = r.readU(16);
5178
+ const solutionId = r.readU(4);
5179
+ const qualityTecu = r.readU(9) * 0.05;
5180
+ const nLayers = r.readU(2) + 1;
5181
+ const layers = [];
5182
+ for (let l = 0; l < nLayers; l++) {
5183
+ const heightKm = r.readU(8) * 10;
5184
+ const degree = r.readU(4) + 1;
5185
+ const order = r.readU(4) + 1;
5186
+ const N = degree;
5187
+ const M = order;
5188
+ const nCoef = (N + 1) * (N + 1) - (N - M) * (N - M + 1);
5189
+ const nCos = nCoef;
5190
+ let nSin = 0;
5191
+ for (let m = 1; m <= M; m++) nSin += N - m + 1;
5192
+ for (let i = 0; i < nCos + nSin; i++) r.readS(16);
5193
+ layers.push({ heightKm, degree, order, coefficientCount: nCos + nSin });
5194
+ }
5195
+ return {
5196
+ messageType: 4076,
5197
+ version,
5198
+ igsMessageNumber: im,
5199
+ system: "I",
5200
+ kind: "ionosphere",
5201
+ epochS,
5202
+ updateIntervalS,
5203
+ multipleMessage,
5204
+ iodSsr,
5205
+ providerId,
5206
+ solutionId,
5207
+ satellites: [],
5208
+ iono: { qualityTecu, layers }
5209
+ };
5210
+ }
5211
+
5212
+ // src/rtcm3/legacy-obs.ts
5213
+ var PRUNIT_GPS = 299792.458;
5214
+ var PRUNIT_GLO = 599584.916;
5215
+ var LAM_GPS_L1 = C_LIGHT / 157542e4;
5216
+ var LAM_GPS_L2 = C_LIGHT / 12276e5;
5217
+ var PPR_INVALID = -(2 ** 19);
5218
+ var PR21_INVALID = -(2 ** 13);
5219
+ function legacyLockSec(i) {
5220
+ if (i < 24) return i;
5221
+ if (i < 48) return 2 * i - 24;
5222
+ if (i < 72) return 4 * i - 120;
5223
+ if (i < 96) return 8 * i - 408;
5224
+ if (i < 120) return 16 * i - 1176;
5225
+ if (i < 127) return 32 * i - 3096;
5226
+ return 937;
5227
+ }
5228
+ var two2 = (n) => n.toString().padStart(2, "0");
5229
+ function decodeLegacyObs(frame) {
5230
+ const type = frame.messageType;
5231
+ const gps = type >= 1001 && type <= 1004;
5232
+ const glo = type >= 1009 && type <= 1012;
5233
+ if (!gps && !glo) return null;
5234
+ const ext = type === 1002 || type === 1004 || type === 1010 || type === 1012;
5235
+ const dual = type === 1003 || type === 1004 || type === 1011 || type === 1012;
5236
+ const system = gps ? "G" : "R";
5237
+ const r = new BitReader(frame.payload);
5238
+ r.readU(12);
5239
+ r.readU(12);
5240
+ let epochMs;
5241
+ let nsat;
5242
+ if (gps) {
5243
+ epochMs = r.readU(30);
5244
+ r.readU(1);
5245
+ nsat = r.readU(5);
5246
+ r.readU(1);
5247
+ r.readU(3);
5248
+ } else {
5249
+ const tk = r.readU(27);
5250
+ r.readU(1);
5251
+ nsat = r.readU(5);
5252
+ r.readU(1);
5253
+ r.readU(3);
5254
+ const gloDow = new Date(Date.now() + 3 * 36e5).getUTCDay();
5255
+ epochMs = (gloDow << 27 | tk) >>> 0;
5256
+ }
5257
+ const observations = [];
5258
+ for (let s = 0; s < nsat; s++) {
5259
+ const satId = r.readU(6);
5260
+ const code1 = r.readU(1);
5261
+ const freqCh = glo ? r.readU(5) : 0;
5262
+ const pr1raw = r.readU(gps ? 24 : 25);
5263
+ const ppr1 = r.readS(20);
5264
+ const lock1 = r.readU(7);
5265
+ let amb = 0;
5266
+ let cnr1 = 0;
5267
+ if (ext) {
5268
+ amb = r.readU(gps ? 8 : 7);
5269
+ cnr1 = r.readU(8);
5270
+ }
5271
+ let code2 = 0;
5272
+ let pr21 = 0;
5273
+ let ppr2 = 0;
5274
+ let lock2 = 0;
5275
+ let cnr2 = 0;
5276
+ if (dual) {
5277
+ code2 = r.readU(2);
5278
+ pr21 = r.readS(14);
5279
+ ppr2 = r.readS(20);
5280
+ lock2 = r.readU(7);
5281
+ if (ext) cnr2 = r.readU(8);
5282
+ }
5283
+ if (gps && (satId < 1 || satId > 32)) continue;
5284
+ if (glo && (satId < 1 || satId > 24)) continue;
5285
+ const prunit = gps ? PRUNIT_GPS : PRUNIT_GLO;
5286
+ const pr1 = pr1raw * 0.02 + amb * prunit;
5287
+ const k = freqCh - 7;
5288
+ const lamL1 = gps ? LAM_GPS_L1 : C_LIGHT / (GLO_F1_BASE + k * GLO_F1_STEP);
5289
+ const lamL2 = gps ? LAM_GPS_L2 : C_LIGHT / (GLO_F2_BASE + k * GLO_F2_STEP);
5290
+ const signals = [];
5291
+ {
5292
+ const sig = {
5293
+ rinexCode: gps ? code1 ? "1W" : "1C" : code1 ? "1P" : "1C",
5294
+ pseudorange: pr1,
5295
+ wavelength: lamL1,
5296
+ lockTime: legacyLockSec(lock1)
5297
+ };
5298
+ if (ppr1 !== PPR_INVALID) sig.phase = (pr1 + ppr1 * 5e-4) / lamL1;
5299
+ if (ext && cnr1 > 0) sig.cn0 = cnr1 * 0.25;
5300
+ signals.push(sig);
5301
+ }
5302
+ if (dual) {
5303
+ const sig = {
5304
+ rinexCode: gps ? code2 === 0 ? "2X" : "2W" : code2 === 0 ? "2C" : "2P",
5305
+ wavelength: lamL2,
5306
+ lockTime: legacyLockSec(lock2)
5307
+ };
5308
+ if (pr21 !== PR21_INVALID) sig.pseudorange = pr1 + pr21 * 0.02;
5309
+ if (ppr2 !== PPR_INVALID) sig.phase = (pr1 + ppr2 * 5e-4) / lamL2;
5310
+ if (ext && cnr2 > 0) sig.cn0 = cnr2 * 0.25;
5311
+ signals.push(sig);
5312
+ }
5313
+ observations.push({
5314
+ prn: `${system}${two2(satId)}`,
5315
+ system,
5316
+ signals
5317
+ });
5318
+ }
5319
+ return { messageType: type, epochMs, system, observations };
5320
+ }
5321
+
5022
5322
  // src/rtcm3/msm.ts
5023
5323
  var GPS_L1 = FREQ.G["1"];
5024
5324
  var GPS_L2 = FREQ.G["2"];
@@ -5553,6 +5853,144 @@ function resetGloFreqCache() {
5553
5853
  gloFreqNum.fill(-128);
5554
5854
  }
5555
5855
 
5856
+ // src/rtcm3/ssr.ts
5857
+ var UPDATE_INTERVAL_S2 = [
5858
+ 1,
5859
+ 2,
5860
+ 5,
5861
+ 10,
5862
+ 15,
5863
+ 30,
5864
+ 60,
5865
+ 120,
5866
+ 240,
5867
+ 300,
5868
+ 600,
5869
+ 900,
5870
+ 1800,
5871
+ 3600,
5872
+ 7200,
5873
+ 10800
5874
+ ];
5875
+ var GPS_SIGNAL = {
5876
+ 0: "L1 C/A",
5877
+ 1: "L1 P",
5878
+ 2: "L1 Z-tracking",
5879
+ 5: "L2 C/A",
5880
+ 6: "L2 semi-codeless",
5881
+ 7: "L2C(M)",
5882
+ 8: "L2C(L)",
5883
+ 9: "L2C(M+L)",
5884
+ 10: "L2 P",
5885
+ 11: "L2 Z-tracking",
5886
+ 14: "L5 I",
5887
+ 15: "L5 Q"
5888
+ };
5889
+ var GLO_SIGNAL = {
5890
+ 0: "G1 C/A",
5891
+ 1: "G1 P",
5892
+ 2: "G2 C/A",
5893
+ 3: "G2 P"
5894
+ };
5895
+ var SSR_KIND = {
5896
+ 1057: { system: "G", kind: "orbit" },
5897
+ 1058: { system: "G", kind: "clock" },
5898
+ 1059: { system: "G", kind: "codeBias" },
5899
+ 1060: { system: "G", kind: "combined" },
5900
+ 1061: { system: "G", kind: "ura" },
5901
+ 1062: { system: "G", kind: "highRateClock" },
5902
+ 1063: { system: "R", kind: "orbit" },
5903
+ 1064: { system: "R", kind: "clock" },
5904
+ 1065: { system: "R", kind: "codeBias" },
5905
+ 1066: { system: "R", kind: "combined" },
5906
+ 1067: { system: "R", kind: "ura" },
5907
+ 1068: { system: "R", kind: "highRateClock" }
5908
+ };
5909
+ function ssrUraMm2(v) {
5910
+ if (v === 0) return null;
5911
+ const cls = v >> 3 & 7;
5912
+ const val = v & 7;
5913
+ return 3 ** cls * (1 + val / 4) - 1;
5914
+ }
5915
+ var two3 = (n) => n.toString().padStart(2, "0");
5916
+ function decodeSsr(frame) {
5917
+ const spec = SSR_KIND[frame.messageType];
5918
+ if (!spec) return null;
5919
+ const { system, kind } = spec;
5920
+ const gps = system === "G";
5921
+ const r = new BitReader(frame.payload);
5922
+ r.readU(12);
5923
+ const epochS = r.readU(gps ? 20 : 17);
5924
+ const updateIntervalS = UPDATE_INTERVAL_S2[r.readU(4)];
5925
+ const multipleMessage = r.readU(1) === 1;
5926
+ const hasDatum = kind === "orbit" || kind === "combined";
5927
+ const referenceDatum = hasDatum ? r.readU(1) : void 0;
5928
+ const iodSsr = r.readU(4);
5929
+ const providerId = r.readU(16);
5930
+ const solutionId = r.readU(4);
5931
+ const nsat = r.readU(6);
5932
+ const sigName = gps ? GPS_SIGNAL : GLO_SIGNAL;
5933
+ const satellites = [];
5934
+ const readOrbit = (sat) => {
5935
+ sat.deltaRadial = r.readS(22) * 1e-4;
5936
+ sat.deltaAlongTrack = r.readS(20) * 4e-4;
5937
+ sat.deltaCrossTrack = r.readS(20) * 4e-4;
5938
+ sat.dotRadial = r.readS(21) * 1e-6;
5939
+ sat.dotAlongTrack = r.readS(19) * 4e-6;
5940
+ sat.dotCrossTrack = r.readS(19) * 4e-6;
5941
+ };
5942
+ const readClock2 = (sat) => {
5943
+ sat.c0 = r.readS(22) * 1e-4;
5944
+ sat.c1 = r.readS(21) * 1e-6;
5945
+ sat.c2 = r.readS(27) * 2e-8;
5946
+ };
5947
+ for (let i = 0; i < nsat; i++) {
5948
+ const satId = gps ? r.readU(6) : r.readU(5);
5949
+ const sat = { prn: `${system}${two3(satId)}` };
5950
+ if (kind === "orbit" || kind === "combined") {
5951
+ sat.iode = r.readU(8);
5952
+ readOrbit(sat);
5953
+ }
5954
+ if (kind === "combined") readClock2(sat);
5955
+ else if (kind === "clock") readClock2(sat);
5956
+ else if (kind === "ura")
5957
+ sat.uraMm = ssrUraMm2(r.readU(6));
5958
+ else if (kind === "highRateClock")
5959
+ sat.highRateClock = r.readS(22) * 1e-4;
5960
+ else if (kind === "codeBias") {
5961
+ const ncb = r.readU(5);
5962
+ const biases = [];
5963
+ for (let c = 0; c < ncb; c++) {
5964
+ const signal = r.readU(5);
5965
+ const biasM = r.readS(14) * 0.01;
5966
+ biases.push({
5967
+ signal,
5968
+ signalName: sigName[signal] ?? `#${signal}`,
5969
+ biasM
5970
+ });
5971
+ }
5972
+ sat.codeBiases = biases;
5973
+ }
5974
+ satellites.push(sat);
5975
+ }
5976
+ return {
5977
+ messageType: frame.messageType,
5978
+ system,
5979
+ kind,
5980
+ epochS,
5981
+ updateIntervalS,
5982
+ multipleMessage,
5983
+ referenceDatum,
5984
+ iodSsr,
5985
+ providerId,
5986
+ solutionId,
5987
+ satellites
5988
+ };
5989
+ }
5990
+ function isSsrMessage(messageType) {
5991
+ return messageType in SSR_KIND;
5992
+ }
5993
+
5556
5994
  // src/rtcm3/station.ts
5557
5995
  function createStationMeta() {
5558
5996
  return {
@@ -6349,7 +6787,7 @@ function weekOfToe(week, tow, toe) {
6349
6787
  if (toe - tow < -HALF_WEEK3) return week + 1;
6350
6788
  return week;
6351
6789
  }
6352
- var two = (n) => String(n).padStart(2, "0");
6790
+ var two4 = (n) => String(n).padStart(2, "0");
6353
6791
  function decodeGalInavWords(words) {
6354
6792
  if (words.length < 96) return null;
6355
6793
  const b = words;
@@ -6437,7 +6875,7 @@ function decodeGalInavWords(words) {
6437
6875
  const tocDate = gpsDate2(week, tocs);
6438
6876
  return {
6439
6877
  system: "E",
6440
- prn: `E${two(svid)}`,
6878
+ prn: `E${two4(svid)}`,
6441
6879
  toc: tocDate.getTime() / 1e3 % SEC_PER_WEEK5,
6442
6880
  tocDate,
6443
6881
  af0,
@@ -6545,7 +6983,7 @@ function decodeGalFnavPages(pages) {
6545
6983
  const tocDate = gpsDate2(week, tocs);
6546
6984
  return {
6547
6985
  system: "E",
6548
- prn: `E${two(svid)}`,
6986
+ prn: `E${two4(svid)}`,
6549
6987
  toc: tocDate.getTime() / 1e3 % SEC_PER_WEEK5,
6550
6988
  tocDate,
6551
6989
  af0,
@@ -6601,7 +7039,7 @@ var GalInavAssembler = class {
6601
7039
  sat.words[type * 16 + 15] = getBitU(page, 124, 8);
6602
7040
  if (type !== 5) return null;
6603
7041
  const eph = decodeGalInavWords(sat.words);
6604
- if (!eph || eph.prn !== `E${two(prn)}`) return null;
7042
+ if (!eph || eph.prn !== `E${two4(prn)}`) return null;
6605
7043
  const key = dedupKey(eph);
6606
7044
  if (key === sat.lastKey) return null;
6607
7045
  sat.lastKey = key;
@@ -6628,7 +7066,7 @@ var GalFnavAssembler = class {
6628
7066
  sat.words.set(page.subarray(0, 31), (type - 1) * 31);
6629
7067
  if (type !== 4) return null;
6630
7068
  const eph = decodeGalFnavPages(sat.words);
6631
- if (!eph || eph.prn !== `E${two(prn)}`) return null;
7069
+ if (!eph || eph.prn !== `E${two4(prn)}`) return null;
6632
7070
  const key = dedupKey(eph);
6633
7071
  if (key === sat.lastKey) return null;
6634
7072
  sat.lastKey = key;
@@ -6802,7 +7240,7 @@ var GloStringAssembler = class {
6802
7240
  // src/navbits/sbas.ts
6803
7241
  var GPS_EPOCH_MS7 = Date.UTC(1980, 0, 6);
6804
7242
  var MS_PER_WEEK3 = 7 * 86400 * 1e3;
6805
- var two2 = (n) => String(n).padStart(2, "0");
7243
+ var two5 = (n) => String(n).padStart(2, "0");
6806
7244
  var SBAS_MT_GEO_NAV = 9;
6807
7245
  function sbasMessageType(msg) {
6808
7246
  return getBitU(msg, 8, 6);
@@ -6821,7 +7259,7 @@ function decodeSbasGeoNav(msg, prn, week, tow) {
6821
7259
  const ura = getBitU(msg, 35, 4);
6822
7260
  return {
6823
7261
  system: "S",
6824
- prn: `S${two2(prn - 100)}`,
7262
+ prn: `S${two5(prn - 100)}`,
6825
7263
  tocDate: new Date(GPS_EPOCH_MS7 + week * MS_PER_WEEK3 + t0Sec * 1e3),
6826
7264
  tauN: getBitS(msg, 206, 12) * 2 ** -31,
6827
7265
  // a_Gf0, clock offset (s)
@@ -6845,7 +7283,7 @@ function decodeSbasGeoNav(msg, prn, week, tow) {
6845
7283
  // src/ubx/rawnav.ts
6846
7284
  var GPS_EPOCH_MS8 = Date.UTC(1980, 0, 6);
6847
7285
  var SEC_PER_WEEK7 = 7 * 86400;
6848
- var two3 = (n) => String(n).padStart(2, "0");
7286
+ var two6 = (n) => String(n).padStart(2, "0");
6849
7287
  function parseUbxRawNav(data, opts = {}) {
6850
7288
  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
6851
7289
  const ephemerides = [];
@@ -6921,7 +7359,7 @@ function parseUbxRawNav(data, opts = {}) {
6921
7359
  badParity++;
6922
7360
  continue;
6923
7361
  }
6924
- const eph = bds.push(`C${two3(svId)}`, sf);
7362
+ const eph = bds.push(`C${two6(svId)}`, sf);
6925
7363
  if (eph) ephemerides.push(eph);
6926
7364
  } else if (gnssId === 6) {
6927
7365
  if (p.length < 8 + 16) continue;
@@ -6940,7 +7378,7 @@ function parseUbxRawNav(data, opts = {}) {
6940
7378
  continue;
6941
7379
  }
6942
7380
  if (!refDate) continue;
6943
- const eph = glo.push(`R${two3(svId)}`, str2, refDate, p[3] - 7);
7381
+ const eph = glo.push(`R${two6(svId)}`, str2, refDate, p[3] - 7);
6944
7382
  if (eph) ephemerides.push(eph);
6945
7383
  } else if (gnssId === 1) {
6946
7384
  if (p.length < 8 + 32) continue;
@@ -7041,21 +7479,21 @@ var SIGNALS = {
7041
7479
  6: { 0: ["R", "1C"], 2: ["R", "2C"] }
7042
7480
  // GLONASS L1OF, L2OF
7043
7481
  };
7044
- function prnFor(gnssId, svId) {
7045
- const two9 = (n) => String(n).padStart(2, "0");
7482
+ function prnFor2(gnssId, svId) {
7483
+ const two12 = (n) => String(n).padStart(2, "0");
7046
7484
  switch (gnssId) {
7047
7485
  case 0:
7048
- return svId >= 1 && svId <= 32 ? `G${two9(svId)}` : null;
7486
+ return svId >= 1 && svId <= 32 ? `G${two12(svId)}` : null;
7049
7487
  case 1:
7050
- return svId >= 120 && svId <= 158 ? `S${two9(svId - 100)}` : null;
7488
+ return svId >= 120 && svId <= 158 ? `S${two12(svId - 100)}` : null;
7051
7489
  case 2:
7052
- return svId >= 1 && svId <= 36 ? `E${two9(svId)}` : null;
7490
+ return svId >= 1 && svId <= 36 ? `E${two12(svId)}` : null;
7053
7491
  case 3:
7054
- return svId >= 1 && svId <= 63 ? `C${two9(svId)}` : null;
7492
+ return svId >= 1 && svId <= 63 ? `C${two12(svId)}` : null;
7055
7493
  case 5:
7056
- return svId >= 1 && svId <= 10 ? `J${two9(svId)}` : null;
7494
+ return svId >= 1 && svId <= 10 ? `J${two12(svId)}` : null;
7057
7495
  case 6:
7058
- return svId >= 1 && svId <= 32 ? `R${two9(svId)}` : null;
7496
+ return svId >= 1 && svId <= 32 ? `R${two12(svId)}` : null;
7059
7497
  default:
7060
7498
  return null;
7061
7499
  }
@@ -7087,7 +7525,7 @@ function parseUbxRawx(data) {
7087
7525
  const svId = data[off + 21];
7088
7526
  const sigId = data[off + 22];
7089
7527
  const trkStat = data[off + 30];
7090
- const prn = prnFor(gnssId, svId);
7528
+ const prn = prnFor2(gnssId, svId);
7091
7529
  const sig = SIGNALS[gnssId]?.[sigId];
7092
7530
  if (!prn || !sig) continue;
7093
7531
  const prValid = (trkStat & 1) !== 0;
@@ -7158,22 +7596,22 @@ function scanSbfFrames(data, view, onBlock) {
7158
7596
  }
7159
7597
  return badCrc;
7160
7598
  }
7161
- var two4 = (n) => String(n).padStart(2, "0");
7599
+ var two7 = (n) => String(n).padStart(2, "0");
7162
7600
  function svidToPrn(svid) {
7163
- if (svid >= 1 && svid <= 37) return svid <= 32 ? `G${two4(svid)}` : null;
7164
- if (svid <= 61) return svid - 37 <= 27 ? `R${two4(svid - 37)}` : null;
7601
+ if (svid >= 1 && svid <= 37) return svid <= 32 ? `G${two7(svid)}` : null;
7602
+ if (svid <= 61) return svid - 37 <= 27 ? `R${two7(svid - 37)}` : null;
7165
7603
  if (svid <= 62) return null;
7166
- if (svid <= 68) return svid - 38 <= 27 ? `R${two4(svid - 38)}` : null;
7604
+ if (svid <= 68) return svid - 38 <= 27 ? `R${two7(svid - 38)}` : null;
7167
7605
  if (svid <= 70) return null;
7168
- if (svid <= 106) return svid - 70 <= 36 ? `E${two4(svid - 70)}` : null;
7606
+ if (svid <= 106) return svid - 70 <= 36 ? `E${two7(svid - 70)}` : null;
7169
7607
  if (svid <= 119) return null;
7170
- if (svid <= 140) return `S${two4(svid - 100)}`;
7171
- if (svid <= 180) return svid - 140 <= 50 ? `C${two4(svid - 140)}` : null;
7172
- if (svid <= 190) return `J${two4(svid - 180)}`;
7173
- if (svid <= 197) return svid - 190 <= 14 ? `I${two4(svid - 190)}` : null;
7174
- if (svid <= 215) return `S${two4(svid - 157)}`;
7175
- if (svid <= 222) return svid - 208 <= 14 ? `I${two4(svid - 208)}` : null;
7176
- if (svid <= 245) return svid - 182 <= 50 ? `C${two4(svid - 182)}` : null;
7608
+ if (svid <= 140) return `S${two7(svid - 100)}`;
7609
+ if (svid <= 180) return svid - 140 <= 50 ? `C${two7(svid - 140)}` : null;
7610
+ if (svid <= 190) return `J${two7(svid - 180)}`;
7611
+ if (svid <= 197) return svid - 190 <= 14 ? `I${two7(svid - 190)}` : null;
7612
+ if (svid <= 215) return `S${two7(svid - 157)}`;
7613
+ if (svid <= 222) return svid - 208 <= 14 ? `I${two7(svid - 208)}` : null;
7614
+ if (svid <= 245) return svid - 182 <= 50 ? `C${two7(svid - 182)}` : null;
7177
7615
  return null;
7178
7616
  }
7179
7617
 
@@ -8785,23 +9223,23 @@ var MEAS2_SIG = [
8785
9223
  ["J", "1E"],
8786
9224
  ["J", "5P"]
8787
9225
  ];
8788
- var two5 = (n) => String(n).padStart(2, "0");
9226
+ var two8 = (n) => String(n).padStart(2, "0");
8789
9227
  function m3Prn(navsys, svid) {
8790
9228
  switch (navsys) {
8791
9229
  case 0:
8792
- return svid < 32 ? `G${two5(svid + 1)}` : null;
9230
+ return svid < 32 ? `G${two8(svid + 1)}` : null;
8793
9231
  case 1:
8794
- return svid < 27 ? `R${two5(svid + 1)}` : null;
9232
+ return svid < 27 ? `R${two8(svid + 1)}` : null;
8795
9233
  case 2:
8796
- return svid < 36 ? `E${two5(svid + 1)}` : null;
9234
+ return svid < 36 ? `E${two8(svid + 1)}` : null;
8797
9235
  case 3:
8798
- return svid < 50 ? `C${two5(svid + 1)}` : null;
9236
+ return svid < 50 ? `C${two8(svid + 1)}` : null;
8799
9237
  case 4:
8800
- return svid <= 38 ? `S${two5(svid + 20)}` : null;
9238
+ return svid <= 38 ? `S${two8(svid + 20)}` : null;
8801
9239
  case 5:
8802
- return svid < 10 ? `J${two5(svid + 1)}` : null;
9240
+ return svid < 10 ? `J${two8(svid + 1)}` : null;
8803
9241
  case 6:
8804
- return svid < 14 ? `I${two5(svid + 1)}` : null;
9242
+ return svid < 14 ? `I${two8(svid + 1)}` : null;
8805
9243
  default:
8806
9244
  return null;
8807
9245
  }
@@ -10635,7 +11073,7 @@ var MS_PER_WEEK12 = SEC_PER_WEEK11 * 1e3;
10635
11073
  var SC2RAD = GPS_PI;
10636
11074
  var gpsMs4 = (week, sec) => GPS_EPOCH_MS20 + week * MS_PER_WEEK12 + sec * 1e3;
10637
11075
  var sowOf5 = (dateMs) => (dateMs / 1e3 % SEC_PER_WEEK11 + SEC_PER_WEEK11) % SEC_PER_WEEK11;
10638
- var two6 = (n) => String(n).padStart(2, "0");
11076
+ var two9 = (n) => String(n).padStart(2, "0");
10639
11077
  var Reader = class {
10640
11078
  constructor(view, start, le) {
10641
11079
  this.view = view;
@@ -10730,7 +11168,7 @@ function decodeGpsQzss(view, p, le, sys) {
10730
11168
  const tocDate = new Date(gpsMs4(week, toes));
10731
11169
  return {
10732
11170
  system: sys,
10733
- prn: `${sys}${two6(prn)}`,
11171
+ prn: `${sys}${two9(prn)}`,
10734
11172
  toc: sowOf5(tocDate.getTime()),
10735
11173
  tocDate,
10736
11174
  af0,
@@ -10763,7 +11201,7 @@ function decodeGalileo(view, p, le) {
10763
11201
  const tocDate = new Date(gpsMs4(week, toes));
10764
11202
  return {
10765
11203
  system: "E",
10766
- prn: `E${two6(prn)}`,
11204
+ prn: `E${two9(prn)}`,
10767
11205
  toc: sowOf5(tocDate.getTime()),
10768
11206
  tocDate,
10769
11207
  af0,
@@ -10801,7 +11239,7 @@ function decodeBeidou(view, p, le) {
10801
11239
  const tocDate = new Date(BDT_EPOCH_MS5 + week * MS_PER_WEEK12 + toes * 1e3);
10802
11240
  return {
10803
11241
  system: "C",
10804
- prn: `C${two6(prn)}`,
11242
+ prn: `C${two9(prn)}`,
10805
11243
  toc: sowOf5(tocDate.getTime()),
10806
11244
  tocDate,
10807
11245
  af0,
@@ -10841,7 +11279,7 @@ function decodeGlonass(view, p, le) {
10841
11279
  );
10842
11280
  return {
10843
11281
  system: "R",
10844
- prn: `R${two6(slot)}`,
11282
+ prn: `R${two9(slot)}`,
10845
11283
  tocDate,
10846
11284
  tauN,
10847
11285
  gammaN,
@@ -10880,7 +11318,7 @@ function decodeSbas(view, p, le) {
10880
11318
  if (prn < 120 || prn > 158) return null;
10881
11319
  return {
10882
11320
  system: "S",
10883
- prn: `S${two6(prn - 100)}`,
11321
+ prn: `S${two9(prn - 100)}`,
10884
11322
  tocDate: new Date(gpsMs4(week, toe)),
10885
11323
  tauN: af0,
10886
11324
  gammaN: af1,
@@ -11057,22 +11495,22 @@ var OBS_CODES = {
11057
11495
  ]
11058
11496
  // QZSS
11059
11497
  };
11060
- var two7 = (n) => String(n).padStart(2, "0");
11498
+ var two10 = (n) => String(n).padStart(2, "0");
11061
11499
  function obsPrn(sys, prn) {
11062
11500
  switch (sys) {
11063
11501
  case 0:
11064
- return prn >= 1 && prn <= 32 ? `G${two7(prn)}` : null;
11502
+ return prn >= 1 && prn <= 32 ? `G${two10(prn)}` : null;
11065
11503
  case 1:
11066
- return prn >= 1 && prn <= 27 ? `R${two7(prn)}` : null;
11504
+ return prn >= 1 && prn <= 27 ? `R${two10(prn)}` : null;
11067
11505
  case 2:
11068
- return prn >= 120 && prn <= 158 ? `S${two7(prn - 100)}` : null;
11506
+ return prn >= 120 && prn <= 158 ? `S${two10(prn - 100)}` : null;
11069
11507
  case 3:
11070
- return prn >= 1 && prn <= 36 ? `E${two7(prn)}` : null;
11508
+ return prn >= 1 && prn <= 36 ? `E${two10(prn)}` : null;
11071
11509
  case 4:
11072
- return prn >= 1 && prn <= 63 ? `C${two7(prn)}` : null;
11510
+ return prn >= 1 && prn <= 63 ? `C${two10(prn)}` : null;
11073
11511
  case 5:
11074
- if (prn >= 193 && prn <= 202) return `J${two7(prn - 192)}`;
11075
- return prn >= 1 && prn <= 10 ? `J${two7(prn)}` : null;
11512
+ if (prn >= 193 && prn <= 202) return `J${two10(prn - 192)}`;
11513
+ return prn >= 1 && prn <= 10 ? `J${two10(prn)}` : null;
11076
11514
  default:
11077
11515
  return null;
11078
11516
  }
@@ -13425,7 +13863,7 @@ var SEC_PER_WEEK12 = 604800;
13425
13863
  var MAXSBSAGEF = 30;
13426
13864
  var MAXSBSAGEL = 360;
13427
13865
  var MAXBAND = 10;
13428
- var two8 = (n) => String(n).padStart(2, "0");
13866
+ var two11 = (n) => String(n).padStart(2, "0");
13429
13867
  var VAR_FCORR = [
13430
13868
  0.052,
13431
13869
  0.0924,
@@ -13571,10 +14009,10 @@ var igpband2 = [
13571
14009
  ];
13572
14010
  var gpsSeconds = (week, tow) => week * SEC_PER_WEEK12 + tow;
13573
14011
  function maskPrn(i) {
13574
- if (i >= 1 && i <= 37) return `G${two8(i)}`;
13575
- if (i >= 38 && i <= 61) return `R${two8(i - 37)}`;
13576
- if (i >= 120 && i <= 138) return `S${two8(i - 100)}`;
13577
- if (i >= 193 && i <= 202) return `J${two8(i - 192)}`;
14012
+ if (i >= 1 && i <= 37) return `G${two11(i)}`;
14013
+ if (i >= 38 && i <= 61) return `R${two11(i - 37)}`;
14014
+ if (i >= 120 && i <= 138) return `S${two11(i - 100)}`;
14015
+ if (i >= 193 && i <= 202) return `J${two11(i - 192)}`;
13578
14016
  return null;
13579
14017
  }
13580
14018
  function ionppp(latRad, lonRad, azRad, elRad, re, hion) {
@@ -13613,7 +14051,7 @@ var SbasProcessor = class {
13613
14051
  if (week === 0) return -1;
13614
14052
  const type = sbasMessageType(msg);
13615
14053
  if (geoPrn != null && geoPrn >= 120 && geoPrn <= 158)
13616
- this.geoPrns.add(`S${two8(geoPrn - 100)}`);
14054
+ this.geoPrns.add(`S${two11(geoPrn - 100)}`);
13617
14055
  switch (type) {
13618
14056
  case 1:
13619
14057
  return this.decodeMask(msg) ? type : -1;
@@ -18162,8 +18600,11 @@ function computePsdDb(centerMHz, halfSpanChips, numPoints, psdFn, f0 = 1023e3, f
18162
18600
  dateToEpoch,
18163
18601
  decodeBinexEph,
18164
18602
  decodeEphemeris,
18603
+ decodeIgsSsr,
18604
+ decodeLegacyObs,
18165
18605
  decodeMsmFull,
18166
18606
  decodeSbfNavigation,
18607
+ decodeSsr,
18167
18608
  deg2dms,
18168
18609
  deg2rad,
18169
18610
  detrendIonoArcs,
@@ -18256,6 +18697,7 @@ function computePsdDb(centerMHz, halfSpanChips, numPoints, psdFn, f0 = 1023e3, f
18256
18697
  ionoFree,
18257
18698
  isSbasL1Preamble,
18258
18699
  isSbasL5Correction,
18700
+ isSsrMessage,
18259
18701
  keplerPosition,
18260
18702
  klobucharDelay,
18261
18703
  lambdaReduction,