gnss-js 0.1.1 → 1.0.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 (88) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +171 -5
  3. package/dist/analysis.cjs +1381 -0
  4. package/dist/analysis.d.cts +211 -0
  5. package/dist/analysis.d.ts +211 -0
  6. package/dist/analysis.js +14 -0
  7. package/dist/antex.cjs +239 -0
  8. package/dist/antex.d.cts +77 -0
  9. package/dist/antex.d.ts +77 -0
  10. package/dist/antex.js +8 -0
  11. package/dist/chunk-354IRDOG.js +239 -0
  12. package/dist/chunk-37QNKGTC.js +65 -0
  13. package/dist/chunk-5CMSYIYM.js +214 -0
  14. package/dist/chunk-5S5MONFK.js +0 -0
  15. package/dist/chunk-6FAL6P4G.js +12 -0
  16. package/dist/{index.mjs → chunk-7NOFXKET.js} +179 -198
  17. package/dist/chunk-CB6EOOLA.js +753 -0
  18. package/dist/chunk-HKN3PUGN.js +800 -0
  19. package/dist/chunk-IS4UUDBV.js +577 -0
  20. package/dist/chunk-K7WZQFBV.js +236 -0
  21. package/dist/chunk-LEEU5OIO.js +75 -0
  22. package/dist/chunk-PRSZIWKM.js +1482 -0
  23. package/dist/chunk-SDRRAJT5.js +433 -0
  24. package/dist/chunk-WR7LCB52.js +143 -0
  25. package/dist/chunk-Y3R57B5P.js +473 -0
  26. package/dist/chunk-YDMYO3YK.js +220 -0
  27. package/dist/constants.cjs +394 -0
  28. package/dist/constants.d.cts +14 -0
  29. package/dist/constants.d.ts +14 -0
  30. package/dist/constants.js +103 -0
  31. package/dist/coordinates.cjs +334 -0
  32. package/dist/coordinates.d.cts +81 -0
  33. package/dist/coordinates.d.ts +81 -0
  34. package/dist/coordinates.js +39 -0
  35. package/dist/ecef-CF0uAysr.d.cts +40 -0
  36. package/dist/ecef-CF0uAysr.d.ts +40 -0
  37. package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
  38. package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
  39. package/dist/gnss-BT6ulR17.d.cts +56 -0
  40. package/dist/gnss-C-tgoYNa.d.ts +56 -0
  41. package/dist/index.cjs +6286 -0
  42. package/dist/index.d.cts +17 -0
  43. package/dist/index.d.ts +17 -89
  44. package/dist/index.js +355 -479
  45. package/dist/nav-BAI1a9vK.d.cts +108 -0
  46. package/dist/nav-BAI1a9vK.d.ts +108 -0
  47. package/dist/nmea.cjs +247 -0
  48. package/dist/nmea.d.cts +37 -0
  49. package/dist/nmea.d.ts +37 -0
  50. package/dist/nmea.js +12 -0
  51. package/dist/ntrip.cjs +169 -0
  52. package/dist/ntrip.d.cts +98 -0
  53. package/dist/ntrip.d.ts +98 -0
  54. package/dist/ntrip.js +10 -0
  55. package/dist/orbit.cjs +504 -0
  56. package/dist/orbit.d.cts +117 -0
  57. package/dist/orbit.d.ts +117 -0
  58. package/dist/orbit.js +29 -0
  59. package/dist/parser-JPjjFgeP.d.cts +73 -0
  60. package/dist/parser-JPjjFgeP.d.ts +73 -0
  61. package/dist/rinex.cjs +1375 -0
  62. package/dist/rinex.d.cts +116 -0
  63. package/dist/rinex.d.ts +116 -0
  64. package/dist/rinex.js +37 -0
  65. package/dist/rtcm3.cjs +1519 -0
  66. package/dist/rtcm3.d.cts +143 -0
  67. package/dist/rtcm3.d.ts +143 -0
  68. package/dist/rtcm3.js +31 -0
  69. package/dist/signals.cjs +858 -0
  70. package/dist/signals.d.cts +93 -0
  71. package/dist/signals.d.ts +93 -0
  72. package/dist/signals.js +70 -0
  73. package/dist/time-DnI1VpE8.d.cts +33 -0
  74. package/dist/time-DnI1VpE8.d.ts +33 -0
  75. package/dist/time.cjs +585 -0
  76. package/dist/time.d.cts +307 -0
  77. package/dist/time.d.ts +307 -0
  78. package/dist/time.js +154 -0
  79. package/package.json +112 -12
  80. package/.prettierrc +0 -5
  81. package/dist/index.d.mts +0 -89
  82. package/jest.config.js +0 -6
  83. package/test/functions.test.js +0 -69
  84. package/test/gnss-scales.test.js +0 -95
  85. package/test/julian.test.js +0 -41
  86. package/test/rinex.test.js +0 -11
  87. package/test/test.js +0 -11
  88. package/test/utc.test.js +0 -30
@@ -0,0 +1,211 @@
1
+ import { R as RinexHeader } from './parser-JPjjFgeP.cjs';
2
+ import { O as OnSlipDetected } from './gnss-BT6ulR17.cjs';
3
+
4
+ /**
5
+ * Multipath analysis from RINEX dual-frequency observations.
6
+ *
7
+ * Computes code-multipath (MP) combinations:
8
+ * MP_i = C_i - (1 + 2/(α-1))·L_i·λ_i + (2/(α-1))·L_j·λ_j
9
+ * where α = (f_i/f_j)², C = pseudorange (m), L = carrier phase (cycles), λ = wavelength.
10
+ *
11
+ * Arc-mean debiasing removes carrier-phase ambiguity per continuous arc.
12
+ */
13
+
14
+ interface MultipathPoint {
15
+ /** Epoch time in milliseconds. */
16
+ time: number;
17
+ /** Code multipath combination value in meters. */
18
+ mp: number;
19
+ }
20
+ interface MultipathSeries {
21
+ /** Satellite PRN, e.g. "G01". */
22
+ prn: string;
23
+ /** System letter, e.g. "G". */
24
+ system: string;
25
+ /** Primary band digit, e.g. "1". */
26
+ band: string;
27
+ /** Reference band digit used in dual-frequency combination, e.g. "2". */
28
+ refBand: string;
29
+ /** Human-readable label, e.g. "MP1 L1-L2". */
30
+ label: string;
31
+ /** Time series of multipath values. */
32
+ points: MultipathPoint[];
33
+ /** RMS of the multipath series in meters. */
34
+ rms: number;
35
+ }
36
+ interface MultipathSignalStat {
37
+ /** Human-readable label, e.g. "MP1 L1-L2 (GPS)". */
38
+ label: string;
39
+ /** System letter, e.g. "G". */
40
+ system: string;
41
+ /** Primary band digit. */
42
+ band: string;
43
+ /** Reference band digit. */
44
+ refBand: string;
45
+ /** RMS multipath in meters (aggregated across satellites). */
46
+ rms: number;
47
+ /** Total number of multipath observations. */
48
+ count: number;
49
+ /** Number of distinct satellites contributing. */
50
+ satellites: number;
51
+ }
52
+ interface MultipathResult {
53
+ /** Per-satellite multipath time series. */
54
+ series: MultipathSeries[];
55
+ /** Aggregated per-signal statistics. */
56
+ signalStats: MultipathSignalStat[];
57
+ }
58
+ declare class MultipathAccumulator {
59
+ private state;
60
+ private results;
61
+ private interval;
62
+ private obsIndices;
63
+ private gloChannels;
64
+ constructor(header: RinexHeader);
65
+ /** Observation callback — wire this into parseRinexStream. */
66
+ onObservation: (time: number, prn: string, _codes: string[], values: (number | null)[]) => void;
67
+ private pushMp;
68
+ /** External cycle-slip notification — close affected arcs for this PRN. */
69
+ notifySlip(_time: number, prn: string, bands: Set<string>): void;
70
+ private closeArc;
71
+ /** Finalize: close remaining arcs and compute statistics. */
72
+ finalize(): MultipathResult;
73
+ }
74
+
75
+ /**
76
+ * Cycle slip detection from RINEX carrier phase observations.
77
+ *
78
+ * Detection hierarchy (per frequency pair):
79
+ * 1. Melbourne-Wübbena (MW): uses both code (C) and phase (L) on two bands.
80
+ * MW = φ_WL − P_NL / λ_WL (wide-lane ambiguity, cycles)
81
+ * Smoothed with running mean — a deviation > threshold flags a slip.
82
+ * Skipped for GLONASS (FDMA: per-satellite frequencies unknown).
83
+ * 2. Geometry-Free (GF): L1·λ1 − L2·λ2 (requires only phase on two bands).
84
+ * Removes geometry but retains ionospheric signature.
85
+ * 3. Single-frequency phase-code (SF): |Δφ_m − ΔP| between consecutive epochs.
86
+ * Removes satellite motion via code; only works when code is available.
87
+ */
88
+
89
+ interface CycleSlipEvent {
90
+ /** Epoch time in milliseconds. */
91
+ time: number;
92
+ /** Satellite PRN, e.g. "G01". */
93
+ prn: string;
94
+ /** Detection method and bands, e.g. "MW L1-L2", "GF L1-L2", or "L1" (single-freq). */
95
+ signal: string;
96
+ /**
97
+ * Slip magnitude. Units depend on detection method:
98
+ * - MW (Melbourne-Wübbena): wide-lane cycles
99
+ * - GF (geometry-free): meters
100
+ * - SF (single-frequency): meters
101
+ */
102
+ magnitude: number;
103
+ }
104
+ interface CycleSlipSignalStats {
105
+ /** Human label, e.g. "MW L1-L2 (GPS)". */
106
+ label: string;
107
+ /** System letter, e.g. "G". */
108
+ system: string;
109
+ /** Total cycle slips detected for this signal combination. */
110
+ totalSlips: number;
111
+ /** Number of distinct satellites with data. */
112
+ satellites: number;
113
+ /** Total observation epochs for this combination. */
114
+ totalEpochs: number;
115
+ /** Slip rate: slips per 1000 epochs. */
116
+ slipRate: number;
117
+ }
118
+ interface CycleSlipResult {
119
+ events: CycleSlipEvent[];
120
+ signalStats: CycleSlipSignalStats[];
121
+ /** Per-satellite slip counts. Key = PRN, value = total slips. */
122
+ satSlipCounts: Record<string, number>;
123
+ }
124
+ declare class CycleSlipAccumulator {
125
+ private obsIndices;
126
+ private prev;
127
+ private events;
128
+ private interval;
129
+ /** GLONASS PRN → channel k for FDMA frequency computation. */
130
+ private gloChannels;
131
+ private onSlip?;
132
+ private signalEpochs;
133
+ private signalSlips;
134
+ private signalSats;
135
+ constructor(header: RinexHeader, onSlip?: OnSlipDetected);
136
+ private recordSlip;
137
+ private countEpoch;
138
+ /** Resolve frequency for a given PRN + band. Handles GLONASS FDMA. */
139
+ private getFreqForPrn;
140
+ onObservation: (time: number, prn: string, _codes: string[], values: (number | null)[]) => void;
141
+ finalize(): CycleSlipResult;
142
+ }
143
+
144
+ /**
145
+ * Data completeness analysis from RINEX observations.
146
+ *
147
+ * Tracks which observation codes are present (non-null) vs expected for each
148
+ * satellite in each epoch, computing per-satellite per-signal completeness.
149
+ */
150
+
151
+ interface CompleteSatSignal {
152
+ /** Satellite PRN, e.g. "G01". */
153
+ prn: string;
154
+ /** System letter, e.g. "G". */
155
+ system: string;
156
+ /** RINEX observation code, e.g. "C1C", "L1C", "S1C". */
157
+ code: string;
158
+ /** Band digit, e.g. "1". */
159
+ band: string;
160
+ /** Epochs where satellite was present and expected to transmit this signal. */
161
+ expected: number;
162
+ /** Epochs where this observation code had a non-null value. */
163
+ present: number;
164
+ /** Completeness percentage (0-100). */
165
+ percent: number;
166
+ }
167
+ interface CompleteSignalStats {
168
+ /** RINEX observation code, e.g. "C1C". */
169
+ code: string;
170
+ /** System letter, e.g. "G". */
171
+ system: string;
172
+ /** Human-readable label, e.g. "C1C (GPS L1)". */
173
+ label: string;
174
+ /** Total expected observations across all satellites. */
175
+ expected: number;
176
+ /** Total present (non-null) observations. */
177
+ present: number;
178
+ /** Completeness percentage (0-100). */
179
+ percent: number;
180
+ /** Number of distinct satellites contributing. */
181
+ satellites: number;
182
+ }
183
+ interface CompletenessResult {
184
+ /** Per-satellite per-signal completeness breakdown. */
185
+ cells: CompleteSatSignal[];
186
+ /** Aggregated per-signal statistics. */
187
+ signalStats: CompleteSignalStats[];
188
+ /** System letters present in the data. */
189
+ systems: string[];
190
+ }
191
+ declare class CompletenessAccumulator {
192
+ private data;
193
+ private header;
194
+ constructor(header: RinexHeader);
195
+ onObservation: (_time: number, prn: string, codes: string[], values: (number | null)[]) => void;
196
+ finalize(): CompletenessResult;
197
+ }
198
+
199
+ /**
200
+ * Combined quality analysis — runs cycle slip detection, data completeness,
201
+ * and multipath analysis in a single file re-parse pass.
202
+ */
203
+
204
+ interface QualityResult {
205
+ cycleSlips: CycleSlipResult;
206
+ completeness: CompletenessResult;
207
+ multipath: MultipathResult;
208
+ }
209
+ declare function analyzeQuality(file: File, header: RinexHeader, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<QualityResult>;
210
+
211
+ export { type CompleteSatSignal, type CompleteSignalStats, CompletenessAccumulator, type CompletenessResult, CycleSlipAccumulator, type CycleSlipEvent, type CycleSlipResult, type CycleSlipSignalStats, MultipathAccumulator, type MultipathPoint, type MultipathResult, type MultipathSeries, type MultipathSignalStat, type QualityResult, analyzeQuality };
@@ -0,0 +1,211 @@
1
+ import { R as RinexHeader } from './parser-JPjjFgeP.js';
2
+ import { O as OnSlipDetected } from './gnss-C-tgoYNa.js';
3
+
4
+ /**
5
+ * Multipath analysis from RINEX dual-frequency observations.
6
+ *
7
+ * Computes code-multipath (MP) combinations:
8
+ * MP_i = C_i - (1 + 2/(α-1))·L_i·λ_i + (2/(α-1))·L_j·λ_j
9
+ * where α = (f_i/f_j)², C = pseudorange (m), L = carrier phase (cycles), λ = wavelength.
10
+ *
11
+ * Arc-mean debiasing removes carrier-phase ambiguity per continuous arc.
12
+ */
13
+
14
+ interface MultipathPoint {
15
+ /** Epoch time in milliseconds. */
16
+ time: number;
17
+ /** Code multipath combination value in meters. */
18
+ mp: number;
19
+ }
20
+ interface MultipathSeries {
21
+ /** Satellite PRN, e.g. "G01". */
22
+ prn: string;
23
+ /** System letter, e.g. "G". */
24
+ system: string;
25
+ /** Primary band digit, e.g. "1". */
26
+ band: string;
27
+ /** Reference band digit used in dual-frequency combination, e.g. "2". */
28
+ refBand: string;
29
+ /** Human-readable label, e.g. "MP1 L1-L2". */
30
+ label: string;
31
+ /** Time series of multipath values. */
32
+ points: MultipathPoint[];
33
+ /** RMS of the multipath series in meters. */
34
+ rms: number;
35
+ }
36
+ interface MultipathSignalStat {
37
+ /** Human-readable label, e.g. "MP1 L1-L2 (GPS)". */
38
+ label: string;
39
+ /** System letter, e.g. "G". */
40
+ system: string;
41
+ /** Primary band digit. */
42
+ band: string;
43
+ /** Reference band digit. */
44
+ refBand: string;
45
+ /** RMS multipath in meters (aggregated across satellites). */
46
+ rms: number;
47
+ /** Total number of multipath observations. */
48
+ count: number;
49
+ /** Number of distinct satellites contributing. */
50
+ satellites: number;
51
+ }
52
+ interface MultipathResult {
53
+ /** Per-satellite multipath time series. */
54
+ series: MultipathSeries[];
55
+ /** Aggregated per-signal statistics. */
56
+ signalStats: MultipathSignalStat[];
57
+ }
58
+ declare class MultipathAccumulator {
59
+ private state;
60
+ private results;
61
+ private interval;
62
+ private obsIndices;
63
+ private gloChannels;
64
+ constructor(header: RinexHeader);
65
+ /** Observation callback — wire this into parseRinexStream. */
66
+ onObservation: (time: number, prn: string, _codes: string[], values: (number | null)[]) => void;
67
+ private pushMp;
68
+ /** External cycle-slip notification — close affected arcs for this PRN. */
69
+ notifySlip(_time: number, prn: string, bands: Set<string>): void;
70
+ private closeArc;
71
+ /** Finalize: close remaining arcs and compute statistics. */
72
+ finalize(): MultipathResult;
73
+ }
74
+
75
+ /**
76
+ * Cycle slip detection from RINEX carrier phase observations.
77
+ *
78
+ * Detection hierarchy (per frequency pair):
79
+ * 1. Melbourne-Wübbena (MW): uses both code (C) and phase (L) on two bands.
80
+ * MW = φ_WL − P_NL / λ_WL (wide-lane ambiguity, cycles)
81
+ * Smoothed with running mean — a deviation > threshold flags a slip.
82
+ * Skipped for GLONASS (FDMA: per-satellite frequencies unknown).
83
+ * 2. Geometry-Free (GF): L1·λ1 − L2·λ2 (requires only phase on two bands).
84
+ * Removes geometry but retains ionospheric signature.
85
+ * 3. Single-frequency phase-code (SF): |Δφ_m − ΔP| between consecutive epochs.
86
+ * Removes satellite motion via code; only works when code is available.
87
+ */
88
+
89
+ interface CycleSlipEvent {
90
+ /** Epoch time in milliseconds. */
91
+ time: number;
92
+ /** Satellite PRN, e.g. "G01". */
93
+ prn: string;
94
+ /** Detection method and bands, e.g. "MW L1-L2", "GF L1-L2", or "L1" (single-freq). */
95
+ signal: string;
96
+ /**
97
+ * Slip magnitude. Units depend on detection method:
98
+ * - MW (Melbourne-Wübbena): wide-lane cycles
99
+ * - GF (geometry-free): meters
100
+ * - SF (single-frequency): meters
101
+ */
102
+ magnitude: number;
103
+ }
104
+ interface CycleSlipSignalStats {
105
+ /** Human label, e.g. "MW L1-L2 (GPS)". */
106
+ label: string;
107
+ /** System letter, e.g. "G". */
108
+ system: string;
109
+ /** Total cycle slips detected for this signal combination. */
110
+ totalSlips: number;
111
+ /** Number of distinct satellites with data. */
112
+ satellites: number;
113
+ /** Total observation epochs for this combination. */
114
+ totalEpochs: number;
115
+ /** Slip rate: slips per 1000 epochs. */
116
+ slipRate: number;
117
+ }
118
+ interface CycleSlipResult {
119
+ events: CycleSlipEvent[];
120
+ signalStats: CycleSlipSignalStats[];
121
+ /** Per-satellite slip counts. Key = PRN, value = total slips. */
122
+ satSlipCounts: Record<string, number>;
123
+ }
124
+ declare class CycleSlipAccumulator {
125
+ private obsIndices;
126
+ private prev;
127
+ private events;
128
+ private interval;
129
+ /** GLONASS PRN → channel k for FDMA frequency computation. */
130
+ private gloChannels;
131
+ private onSlip?;
132
+ private signalEpochs;
133
+ private signalSlips;
134
+ private signalSats;
135
+ constructor(header: RinexHeader, onSlip?: OnSlipDetected);
136
+ private recordSlip;
137
+ private countEpoch;
138
+ /** Resolve frequency for a given PRN + band. Handles GLONASS FDMA. */
139
+ private getFreqForPrn;
140
+ onObservation: (time: number, prn: string, _codes: string[], values: (number | null)[]) => void;
141
+ finalize(): CycleSlipResult;
142
+ }
143
+
144
+ /**
145
+ * Data completeness analysis from RINEX observations.
146
+ *
147
+ * Tracks which observation codes are present (non-null) vs expected for each
148
+ * satellite in each epoch, computing per-satellite per-signal completeness.
149
+ */
150
+
151
+ interface CompleteSatSignal {
152
+ /** Satellite PRN, e.g. "G01". */
153
+ prn: string;
154
+ /** System letter, e.g. "G". */
155
+ system: string;
156
+ /** RINEX observation code, e.g. "C1C", "L1C", "S1C". */
157
+ code: string;
158
+ /** Band digit, e.g. "1". */
159
+ band: string;
160
+ /** Epochs where satellite was present and expected to transmit this signal. */
161
+ expected: number;
162
+ /** Epochs where this observation code had a non-null value. */
163
+ present: number;
164
+ /** Completeness percentage (0-100). */
165
+ percent: number;
166
+ }
167
+ interface CompleteSignalStats {
168
+ /** RINEX observation code, e.g. "C1C". */
169
+ code: string;
170
+ /** System letter, e.g. "G". */
171
+ system: string;
172
+ /** Human-readable label, e.g. "C1C (GPS L1)". */
173
+ label: string;
174
+ /** Total expected observations across all satellites. */
175
+ expected: number;
176
+ /** Total present (non-null) observations. */
177
+ present: number;
178
+ /** Completeness percentage (0-100). */
179
+ percent: number;
180
+ /** Number of distinct satellites contributing. */
181
+ satellites: number;
182
+ }
183
+ interface CompletenessResult {
184
+ /** Per-satellite per-signal completeness breakdown. */
185
+ cells: CompleteSatSignal[];
186
+ /** Aggregated per-signal statistics. */
187
+ signalStats: CompleteSignalStats[];
188
+ /** System letters present in the data. */
189
+ systems: string[];
190
+ }
191
+ declare class CompletenessAccumulator {
192
+ private data;
193
+ private header;
194
+ constructor(header: RinexHeader);
195
+ onObservation: (_time: number, prn: string, codes: string[], values: (number | null)[]) => void;
196
+ finalize(): CompletenessResult;
197
+ }
198
+
199
+ /**
200
+ * Combined quality analysis — runs cycle slip detection, data completeness,
201
+ * and multipath analysis in a single file re-parse pass.
202
+ */
203
+
204
+ interface QualityResult {
205
+ cycleSlips: CycleSlipResult;
206
+ completeness: CompletenessResult;
207
+ multipath: MultipathResult;
208
+ }
209
+ declare function analyzeQuality(file: File, header: RinexHeader, onProgress?: (percent: number) => void, signal?: AbortSignal): Promise<QualityResult>;
210
+
211
+ export { type CompleteSatSignal, type CompleteSignalStats, CompletenessAccumulator, type CompletenessResult, CycleSlipAccumulator, type CycleSlipEvent, type CycleSlipResult, type CycleSlipSignalStats, MultipathAccumulator, type MultipathPoint, type MultipathResult, type MultipathSeries, type MultipathSignalStat, type QualityResult, analyzeQuality };
@@ -0,0 +1,14 @@
1
+ import {
2
+ CompletenessAccumulator,
3
+ CycleSlipAccumulator,
4
+ MultipathAccumulator,
5
+ analyzeQuality
6
+ } from "./chunk-Y3R57B5P.js";
7
+ import "./chunk-CB6EOOLA.js";
8
+ import "./chunk-354IRDOG.js";
9
+ export {
10
+ CompletenessAccumulator,
11
+ CycleSlipAccumulator,
12
+ MultipathAccumulator,
13
+ analyzeQuality
14
+ };
package/dist/antex.cjs ADDED
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/antex/index.ts
21
+ var antex_exports = {};
22
+ __export(antex_exports, {
23
+ frequencyLabel: () => frequencyLabel,
24
+ parseAntex: () => parseAntex
25
+ });
26
+ module.exports = __toCommonJS(antex_exports);
27
+ function label(line) {
28
+ return (line.length >= 80 ? line.substring(60, 80) : line.substring(60)).trimEnd();
29
+ }
30
+ function parseFloat10(s) {
31
+ return parseFloat(s) || 0;
32
+ }
33
+ function parseFloat6(s) {
34
+ return parseFloat(s) || 0;
35
+ }
36
+ function parseInt6(s) {
37
+ return parseInt(s, 10) || 0;
38
+ }
39
+ function parseValidityDate(line) {
40
+ const year = parseInt(line.substring(0, 6), 10);
41
+ const month = parseInt(line.substring(6, 12), 10);
42
+ const day = parseInt(line.substring(12, 18), 10);
43
+ const hour = parseInt(line.substring(18, 24), 10);
44
+ const min = parseInt(line.substring(24, 30), 10);
45
+ if (isNaN(year)) return "";
46
+ return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")} ${String(hour).padStart(2, "0")}:${String(min).padStart(2, "0")}`;
47
+ }
48
+ function parsePcvRow(line, offset, count) {
49
+ const vals = [];
50
+ for (let i = 0; i < count; i++) {
51
+ const start = offset + i * 8;
52
+ const s = line.substring(start, start + 8);
53
+ vals.push(parseFloat(s) || 0);
54
+ }
55
+ return vals;
56
+ }
57
+ function parseFrequencyBlock(lines, numZen, hasAzimuth, _numAzi) {
58
+ let frequency = "";
59
+ let pcoN = 0, pcoE = 0, pcoU = 0;
60
+ const pcvNoazi = [];
61
+ const pcv = [];
62
+ for (const line of lines) {
63
+ const lbl = label(line);
64
+ if (lbl === "START OF FREQUENCY") {
65
+ frequency = line.substring(3, 6).trim();
66
+ } else if (lbl === "NORTH / EAST / UP") {
67
+ pcoN = parseFloat10(line.substring(0, 10));
68
+ pcoE = parseFloat10(line.substring(10, 20));
69
+ pcoU = parseFloat10(line.substring(20, 30));
70
+ } else if (line.substring(3, 8) === "NOAZI") {
71
+ pcvNoazi.push(...parsePcvRow(line, 8, numZen));
72
+ } else if (lbl !== "END OF FREQUENCY" && lbl !== "START OF FREQUENCY") {
73
+ if (hasAzimuth && line.length > 8) {
74
+ const row = parsePcvRow(line, 8, numZen);
75
+ pcv.push(row);
76
+ }
77
+ }
78
+ }
79
+ return { frequency, pcoN, pcoE, pcoU, pcvNoazi, pcv };
80
+ }
81
+ function parseAntex(text) {
82
+ const allLines = text.split(/\r?\n/);
83
+ let version = 0;
84
+ let system = "";
85
+ let pcvType = "";
86
+ let refAntenna = "";
87
+ const comments = [];
88
+ const antennas = [];
89
+ let inHeader = true;
90
+ let inAntenna = false;
91
+ let inFreq = false;
92
+ let freqLines = [];
93
+ let type = "", serialNo = "", svnCode = "", cosparId = "";
94
+ let method = "", agency = "", date = "";
95
+ let numCalibrated = 0;
96
+ let dazi = 0, zen1 = 0, zen2 = 0, dzen = 0;
97
+ let sinexCode = "", validFrom = "", validUntil = "";
98
+ let frequencies = [];
99
+ let isSatellite = false;
100
+ for (const rawLine of allLines) {
101
+ const line = rawLine.length < 80 ? rawLine.padEnd(80) : rawLine;
102
+ const lbl = label(line);
103
+ if (inHeader) {
104
+ if (lbl === "ANTEX VERSION / SYST") {
105
+ version = parseFloat(line.substring(0, 8)) || 0;
106
+ system = line.substring(20, 21).trim();
107
+ } else if (lbl === "PCV TYPE / REFANT") {
108
+ pcvType = line.substring(0, 1).trim();
109
+ refAntenna = line.substring(20, 40).trim();
110
+ } else if (lbl === "COMMENT") {
111
+ comments.push(line.substring(0, 60).trim());
112
+ } else if (lbl === "END OF HEADER") {
113
+ inHeader = false;
114
+ }
115
+ continue;
116
+ }
117
+ if (lbl === "START OF ANTENNA") {
118
+ inAntenna = true;
119
+ type = "";
120
+ serialNo = "";
121
+ svnCode = "";
122
+ cosparId = "";
123
+ method = "";
124
+ agency = "";
125
+ date = "";
126
+ numCalibrated = 0;
127
+ dazi = 0;
128
+ zen1 = 0;
129
+ zen2 = 0;
130
+ dzen = 0;
131
+ sinexCode = "";
132
+ validFrom = "";
133
+ validUntil = "";
134
+ frequencies = [];
135
+ isSatellite = false;
136
+ continue;
137
+ }
138
+ if (!inAntenna) continue;
139
+ if (lbl === "END OF ANTENNA") {
140
+ antennas.push({
141
+ type,
142
+ serialNo,
143
+ svnCode,
144
+ cosparId,
145
+ isSatellite,
146
+ method,
147
+ agency,
148
+ numCalibrated,
149
+ date,
150
+ dazi,
151
+ zen1,
152
+ zen2,
153
+ dzen,
154
+ sinexCode,
155
+ validFrom,
156
+ validUntil,
157
+ frequencies
158
+ });
159
+ inAntenna = false;
160
+ continue;
161
+ }
162
+ if (lbl === "TYPE / SERIAL NO") {
163
+ type = line.substring(0, 20).trim();
164
+ serialNo = line.substring(20, 40).trim();
165
+ svnCode = line.substring(40, 50).trim();
166
+ cosparId = line.substring(50, 60).trim();
167
+ isSatellite = /^[GRECIJS]\d{2,3}$/.test(serialNo);
168
+ } else if (lbl === "METH / BY / # / DATE") {
169
+ method = line.substring(0, 20).trim();
170
+ agency = line.substring(20, 40).trim();
171
+ numCalibrated = parseInt6(line.substring(40, 46));
172
+ date = line.substring(50, 60).trim();
173
+ } else if (lbl === "DAZI") {
174
+ dazi = parseFloat6(line.substring(2, 8));
175
+ } else if (lbl === "ZEN1 / ZEN2 / DZEN") {
176
+ zen1 = parseFloat6(line.substring(2, 8));
177
+ zen2 = parseFloat6(line.substring(8, 14));
178
+ dzen = parseFloat6(line.substring(14, 20));
179
+ } else if (lbl === "SINEX CODE") {
180
+ sinexCode = line.substring(0, 10).trim();
181
+ } else if (lbl === "VALID FROM") {
182
+ validFrom = parseValidityDate(line);
183
+ } else if (lbl === "VALID UNTIL") {
184
+ validUntil = parseValidityDate(line);
185
+ } else if (lbl === "START OF FREQUENCY") {
186
+ inFreq = true;
187
+ freqLines = [line];
188
+ } else if (lbl === "END OF FREQUENCY") {
189
+ freqLines.push(line);
190
+ inFreq = false;
191
+ const numZen = dzen > 0 ? Math.round((zen2 - zen1) / dzen) + 1 : 0;
192
+ const hasAzimuth = dazi > 0;
193
+ const numAzi = hasAzimuth ? Math.round(360 / dazi) + 1 : 0;
194
+ frequencies.push(
195
+ parseFrequencyBlock(freqLines, numZen, hasAzimuth, numAzi)
196
+ );
197
+ } else if (lbl === "START OF FREQ RMS") {
198
+ inFreq = false;
199
+ } else if (inFreq) {
200
+ freqLines.push(line);
201
+ }
202
+ }
203
+ return { version, system, pcvType, refAntenna, comments, antennas };
204
+ }
205
+ var FREQ_LABELS = {
206
+ G01: "GPS L1",
207
+ G02: "GPS L2",
208
+ G05: "GPS L5",
209
+ R01: "GLO G1",
210
+ R02: "GLO G2",
211
+ R04: "GLO G1a",
212
+ R06: "GLO G2a",
213
+ E01: "GAL E1",
214
+ E05: "GAL E5a",
215
+ E06: "GAL E6",
216
+ E07: "GAL E5b",
217
+ E08: "GAL E5",
218
+ C01: "BDS B1",
219
+ C02: "BDS B1-2",
220
+ C05: "BDS B2a",
221
+ C06: "BDS B3",
222
+ C07: "BDS B2b",
223
+ C08: "BDS B2",
224
+ J01: "QZS L1",
225
+ J02: "QZS L2",
226
+ J05: "QZS L5",
227
+ J06: "QZS LEX",
228
+ S01: "SBS L1",
229
+ S05: "SBS L5",
230
+ I05: "NIC L5"
231
+ };
232
+ function frequencyLabel(code) {
233
+ return FREQ_LABELS[code] ?? code;
234
+ }
235
+ // Annotate the CommonJS export names for ESM import in node:
236
+ 0 && (module.exports = {
237
+ frequencyLabel,
238
+ parseAntex
239
+ });