gnss-js 1.11.0 → 1.13.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/rinex.d.ts CHANGED
@@ -135,4 +135,132 @@ interface IonexGrid {
135
135
  }
136
136
  declare function parseIonex(text: string): IonexGrid;
137
137
 
138
- export { type CrxField, type DiffState, EMPTY_WARNINGS, type IonexGrid, NavResult, RinexHeader, type RinexWarning, type RinexWarnings, WarningAccumulator, type WarningSeverity, crxDecompress, crxRepair, fmtF, hdrLine, padL, padR, parseCrxDataLine, parseIonex, writeRinexNav };
138
+ /**
139
+ * SP3-c/-d precise orbit and clock parser, with Lagrange interpolation
140
+ * for evaluating positions between the tabulated epochs.
141
+ *
142
+ * Positions are converted to meters (SP3 tabulates km), clocks to
143
+ * seconds (SP3 tabulates microseconds). Missing positions (all-zero
144
+ * coordinates) and the 999999.999999 bad-clock sentinel become null.
145
+ * Epoch tags are read in the file's own time scale (GPS for IGS/MGEX
146
+ * products) as epoch milliseconds, matching the convention of the
147
+ * RINEX parsers in this library.
148
+ */
149
+ interface Sp3Sample {
150
+ /** ECEF meters. */
151
+ x: number;
152
+ y: number;
153
+ z: number;
154
+ /** Satellite clock offset in seconds, or null when flagged bad. */
155
+ clk: number | null;
156
+ }
157
+ interface Sp3File {
158
+ version: string;
159
+ /** Epoch timestamps (ms). */
160
+ epochs: number[];
161
+ /** Tabulated interval in seconds (from the ## header line). */
162
+ intervalSec: number;
163
+ /** Time system from the %c line, e.g. 'GPS'. */
164
+ timeSystem: string;
165
+ /** prn → per-epoch samples (null where the satellite is missing). */
166
+ satellites: Record<string, (Sp3Sample | null)[]>;
167
+ }
168
+ declare function parseSp3(text: string): Sp3File;
169
+ /**
170
+ * Satellite position at an arbitrary time by Lagrange interpolation
171
+ * over the `order` nearest tabulated samples (default 9, the standard
172
+ * choice for 5–15 min SP3 tables; centimetre-level between nodes).
173
+ * Clock is interpolated linearly between the bracketing samples.
174
+ *
175
+ * Returns null outside the covered span, near data gaps, or when the
176
+ * satellite is absent.
177
+ */
178
+ declare function sp3Position(sp3: Sp3File, prn: string, tMs: number, order?: number): {
179
+ x: number;
180
+ y: number;
181
+ z: number;
182
+ clk: number | null;
183
+ } | null;
184
+
185
+ /**
186
+ * RINEX 3.04 / 4.01 observation file writer.
187
+ *
188
+ * The two formats share the same header layout and epoch record
189
+ * encoding — only the version line and the provenance comment differ
190
+ * (see obs-writer.test.ts, which pins this). RINEX 2.11 lives in
191
+ * obs-writer-v2.ts (different header records and epoch layout).
192
+ *
193
+ * Streams text through gzip compression so we never hold the full
194
+ * uncompressed output in memory. Returns a gzip-compressed Blob.
195
+ */
196
+
197
+ /**
198
+ * Compact epoch — stores observation values in Float64Arrays
199
+ * indexed by a per-system obs code registry (NaN = missing).
200
+ * ~10-15x less memory than Map-of-Maps.
201
+ */
202
+ interface CompactEpoch {
203
+ time: number;
204
+ sats: Map<string, Float64Array>;
205
+ }
206
+ /**
207
+ * Write RINEX 3.04 obs file from compact observations.
208
+ *
209
+ * The `obsTypes` map defines both the RINEX header declaration order and
210
+ * the Float64Array index order for each system.
211
+ */
212
+ declare function writeRinexObsBlob(header: RinexHeader, epochs: CompactEpoch[], obsTypes: Map<string, string[]>): Promise<Blob>;
213
+ /** Shared RINEX 3/4 implementation (also used by obs-writer-v4.ts). */
214
+ declare function writeModernObsBlob(header: RinexHeader, epochs: CompactEpoch[], obsTypes: Map<string, string[]>, opts: {
215
+ version: string;
216
+ comment: string;
217
+ }): Promise<Blob>;
218
+
219
+ /**
220
+ * RINEX 2.11 observation file writer.
221
+ *
222
+ * Converts RINEX 3 obs codes to RINEX 2 format and writes
223
+ * a valid RINEX 2.11 observation file.
224
+ */
225
+
226
+ /**
227
+ * Write RINEX 2.11 obs file from compact observations.
228
+ * Only GPS+GLONASS satellites are included (RINEX 2 limitation).
229
+ */
230
+ declare function writeRinex2ObsBlob(header: RinexHeader, epochs: CompactEpoch[], obsTypes: Map<string, string[]>): Promise<Blob>;
231
+
232
+ /**
233
+ * RINEX 4.01 observation file writer.
234
+ *
235
+ * RINEX 4 is structurally identical to RINEX 3 for our output — same
236
+ * header layout, same epoch record format. Only the version line and
237
+ * the provenance comment differ, so this delegates to the shared
238
+ * implementation in obs-writer.ts.
239
+ */
240
+
241
+ /** Write RINEX 4.01 obs file from compact observations. */
242
+ declare function writeRinex4ObsBlob(header: RinexHeader, epochs: CompactEpoch[], obsTypes: Map<string, string[]>): Promise<Blob>;
243
+
244
+ /**
245
+ * Shared plumbing for the RINEX 2/3/4 observation writers.
246
+ */
247
+
248
+ /**
249
+ * Batched line sink that streams text through gzip compression so the
250
+ * full uncompressed output is never held in memory.
251
+ *
252
+ * Callers decide when to `flush()` (the writers flush every N epochs);
253
+ * `finish()` flushes, closes the stream, and returns the Blob.
254
+ */
255
+ declare function createGzipLineSink(): {
256
+ push(line: string): void;
257
+ flush: () => Promise<void>;
258
+ finish(): Promise<Blob>;
259
+ };
260
+ /**
261
+ * Station / receiver / antenna header block — byte-identical across
262
+ * RINEX 2.11, 3.04, and 4.01.
263
+ */
264
+ declare function stationHeaderLines(header: RinexHeader): string[];
265
+
266
+ export { type CompactEpoch, type CrxField, type DiffState, EMPTY_WARNINGS, type IonexGrid, NavResult, RinexHeader, type RinexWarning, type RinexWarnings, type Sp3File, type Sp3Sample, WarningAccumulator, type WarningSeverity, createGzipLineSink, crxDecompress, crxRepair, fmtF, hdrLine, padL, padR, parseCrxDataLine, parseIonex, parseSp3, sp3Position, stationHeaderLines, writeModernObsBlob, writeRinex2ObsBlob, writeRinex4ObsBlob, writeRinexNav, writeRinexObsBlob };
package/dist/rinex.js CHANGED
@@ -1,14 +1,22 @@
1
1
  import {
2
2
  EMPTY_WARNINGS,
3
3
  WarningAccumulator,
4
+ createGzipLineSink,
4
5
  fmtF,
5
6
  hdrLine,
6
7
  padL,
7
8
  padR,
8
9
  parseIonex,
9
10
  parseNavFile,
10
- writeRinexNav
11
- } from "./chunk-77VUSDNI.js";
11
+ parseSp3,
12
+ sp3Position,
13
+ stationHeaderLines,
14
+ writeModernObsBlob,
15
+ writeRinex2ObsBlob,
16
+ writeRinex4ObsBlob,
17
+ writeRinexNav,
18
+ writeRinexObsBlob
19
+ } from "./chunk-HXF7XVW7.js";
12
20
  import {
13
21
  SYSTEM_ORDER,
14
22
  crxDecompress,
@@ -23,6 +31,7 @@ export {
23
31
  EMPTY_WARNINGS,
24
32
  SYSTEM_ORDER,
25
33
  WarningAccumulator,
34
+ createGzipLineSink,
26
35
  crxDecompress,
27
36
  crxRepair,
28
37
  fmtF,
@@ -33,7 +42,14 @@ export {
33
42
  parseIonex,
34
43
  parseNavFile,
35
44
  parseRinexStream,
45
+ parseSp3,
46
+ sp3Position,
47
+ stationHeaderLines,
36
48
  systemCmp,
37
49
  systemName,
38
- writeRinexNav
50
+ writeModernObsBlob,
51
+ writeRinex2ObsBlob,
52
+ writeRinex4ObsBlob,
53
+ writeRinexNav,
54
+ writeRinexObsBlob
39
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gnss-js",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Comprehensive GNSS library for JavaScript — time scales, coordinates, RINEX parsing, RTCM3 decoding, orbit computation, and signal analysis",
5
5
  "type": "module",
6
6
  "sideEffects": false,