gnss-js 0.1.2 → 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.
- package/LICENSE +23 -0
- package/README.md +171 -5
- package/dist/analysis.cjs +1381 -0
- package/dist/analysis.d.cts +211 -0
- package/dist/analysis.d.ts +211 -0
- package/dist/analysis.js +14 -0
- package/dist/antex.cjs +239 -0
- package/dist/antex.d.cts +77 -0
- package/dist/antex.d.ts +77 -0
- package/dist/antex.js +8 -0
- package/dist/chunk-354IRDOG.js +239 -0
- package/dist/chunk-37QNKGTC.js +65 -0
- package/dist/chunk-5CMSYIYM.js +214 -0
- package/dist/chunk-5S5MONFK.js +0 -0
- package/dist/chunk-6FAL6P4G.js +12 -0
- package/dist/chunk-7NOFXKET.js +433 -0
- package/dist/chunk-CB6EOOLA.js +753 -0
- package/dist/chunk-HKN3PUGN.js +800 -0
- package/dist/chunk-IS4UUDBV.js +577 -0
- package/dist/chunk-K7WZQFBV.js +236 -0
- package/dist/chunk-LEEU5OIO.js +75 -0
- package/dist/chunk-PRSZIWKM.js +1482 -0
- package/dist/chunk-SDRRAJT5.js +433 -0
- package/dist/chunk-WR7LCB52.js +143 -0
- package/dist/chunk-Y3R57B5P.js +473 -0
- package/dist/chunk-YDMYO3YK.js +220 -0
- package/dist/constants.cjs +394 -0
- package/dist/constants.d.cts +14 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.js +103 -0
- package/dist/coordinates.cjs +334 -0
- package/dist/coordinates.d.cts +81 -0
- package/dist/coordinates.d.ts +81 -0
- package/dist/coordinates.js +39 -0
- package/dist/ecef-CF0uAysr.d.cts +40 -0
- package/dist/ecef-CF0uAysr.d.ts +40 -0
- package/dist/ephemeris-BUWzfmBy.d.cts +114 -0
- package/dist/ephemeris-BUWzfmBy.d.ts +114 -0
- package/dist/gnss-BT6ulR17.d.cts +56 -0
- package/dist/gnss-C-tgoYNa.d.ts +56 -0
- package/dist/index.cjs +5774 -78
- package/dist/index.d.cts +17 -96
- package/dist/index.d.ts +17 -96
- package/dist/index.js +352 -415
- package/dist/nav-BAI1a9vK.d.cts +108 -0
- package/dist/nav-BAI1a9vK.d.ts +108 -0
- package/dist/nmea.cjs +247 -0
- package/dist/nmea.d.cts +37 -0
- package/dist/nmea.d.ts +37 -0
- package/dist/nmea.js +12 -0
- package/dist/ntrip.cjs +169 -0
- package/dist/ntrip.d.cts +98 -0
- package/dist/ntrip.d.ts +98 -0
- package/dist/ntrip.js +10 -0
- package/dist/orbit.cjs +504 -0
- package/dist/orbit.d.cts +117 -0
- package/dist/orbit.d.ts +117 -0
- package/dist/orbit.js +29 -0
- package/dist/parser-JPjjFgeP.d.cts +73 -0
- package/dist/parser-JPjjFgeP.d.ts +73 -0
- package/dist/rinex.cjs +1375 -0
- package/dist/rinex.d.cts +116 -0
- package/dist/rinex.d.ts +116 -0
- package/dist/rinex.js +37 -0
- package/dist/rtcm3.cjs +1519 -0
- package/dist/rtcm3.d.cts +143 -0
- package/dist/rtcm3.d.ts +143 -0
- package/dist/rtcm3.js +31 -0
- package/dist/signals.cjs +858 -0
- package/dist/signals.d.cts +93 -0
- package/dist/signals.d.ts +93 -0
- package/dist/signals.js +70 -0
- package/dist/time-DnI1VpE8.d.cts +33 -0
- package/dist/time-DnI1VpE8.d.ts +33 -0
- package/dist/time.cjs +585 -0
- package/dist/time.d.cts +307 -0
- package/dist/time.d.ts +307 -0
- package/dist/time.js +154 -0
- package/package.json +112 -14
- package/.prettierrc +0 -5
- package/jest.config.ts +0 -9
- package/test/functions.test.ts +0 -63
- package/test/gnss-scales.test.ts +0 -95
- package/test/julian.test.ts +0 -145
- package/test/rinex.test.ts +0 -11
- package/test/test.ts +0 -10
- package/test/utc.test.ts +0 -25
package/dist/antex.d.cts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANTEX 1.4 (Antenna Exchange Format) parser.
|
|
3
|
+
* Parses receiver and satellite antenna calibration files containing
|
|
4
|
+
* Phase Center Offsets (PCO) and Phase Center Variations (PCV).
|
|
5
|
+
*/
|
|
6
|
+
interface FrequencyData {
|
|
7
|
+
/** Frequency code, e.g. "G01", "E05" */
|
|
8
|
+
frequency: string;
|
|
9
|
+
/** Phase Center Offset — North/X component (mm) */
|
|
10
|
+
pcoN: number;
|
|
11
|
+
/** Phase Center Offset — East/Y component (mm) */
|
|
12
|
+
pcoE: number;
|
|
13
|
+
/** Phase Center Offset — Up/Z component (mm) */
|
|
14
|
+
pcoU: number;
|
|
15
|
+
/** Non-azimuth-dependent PCV values (mm), length = numZen */
|
|
16
|
+
pcvNoazi: number[];
|
|
17
|
+
/**
|
|
18
|
+
* Azimuth-dependent PCV grid (mm).
|
|
19
|
+
* Rows = azimuths (0..360 step dazi), cols = zenith angles.
|
|
20
|
+
* Empty when dazi === 0 (no azimuth dependence).
|
|
21
|
+
*/
|
|
22
|
+
pcv: number[][];
|
|
23
|
+
}
|
|
24
|
+
interface AntennaEntry {
|
|
25
|
+
/** Antenna type name (20 chars, e.g. "LEIAR20 LEIM") */
|
|
26
|
+
type: string;
|
|
27
|
+
/** Serial number or satellite code (e.g. "G05", or blank for type-mean) */
|
|
28
|
+
serialNo: string;
|
|
29
|
+
/** SVN code (satellites only, optional) */
|
|
30
|
+
svnCode: string;
|
|
31
|
+
/** COSPAR ID (satellites only, optional) */
|
|
32
|
+
cosparId: string;
|
|
33
|
+
/** Whether this is a satellite antenna (vs receiver) */
|
|
34
|
+
isSatellite: boolean;
|
|
35
|
+
/** Calibration method */
|
|
36
|
+
method: string;
|
|
37
|
+
/** Agency that performed calibration */
|
|
38
|
+
agency: string;
|
|
39
|
+
/** Number of individual antennas calibrated */
|
|
40
|
+
numCalibrated: number;
|
|
41
|
+
/** Calibration date string */
|
|
42
|
+
date: string;
|
|
43
|
+
/** Azimuth increment (degrees). 0 = no azimuth dependence. */
|
|
44
|
+
dazi: number;
|
|
45
|
+
/** Zenith/nadir start angle (degrees) */
|
|
46
|
+
zen1: number;
|
|
47
|
+
/** Zenith/nadir end angle (degrees) */
|
|
48
|
+
zen2: number;
|
|
49
|
+
/** Zenith/nadir increment (degrees) */
|
|
50
|
+
dzen: number;
|
|
51
|
+
/** SINEX code (optional) */
|
|
52
|
+
sinexCode: string;
|
|
53
|
+
/** Valid-from date (optional) */
|
|
54
|
+
validFrom: string;
|
|
55
|
+
/** Valid-until date (optional) */
|
|
56
|
+
validUntil: string;
|
|
57
|
+
/** Per-frequency calibration data */
|
|
58
|
+
frequencies: FrequencyData[];
|
|
59
|
+
}
|
|
60
|
+
interface AntexFile {
|
|
61
|
+
/** Format version (e.g. 1.4) */
|
|
62
|
+
version: number;
|
|
63
|
+
/** Satellite system flag ('G','R','E','C','J','S','M') */
|
|
64
|
+
system: string;
|
|
65
|
+
/** PCV type: 'A' (absolute) or 'R' (relative) */
|
|
66
|
+
pcvType: string;
|
|
67
|
+
/** Reference antenna type (for relative values) */
|
|
68
|
+
refAntenna: string;
|
|
69
|
+
/** Header comments */
|
|
70
|
+
comments: string[];
|
|
71
|
+
/** All antenna entries in the file */
|
|
72
|
+
antennas: AntennaEntry[];
|
|
73
|
+
}
|
|
74
|
+
declare function parseAntex(text: string): AntexFile;
|
|
75
|
+
declare function frequencyLabel(code: string): string;
|
|
76
|
+
|
|
77
|
+
export { type AntennaEntry, type AntexFile, type FrequencyData, frequencyLabel, parseAntex };
|
package/dist/antex.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ANTEX 1.4 (Antenna Exchange Format) parser.
|
|
3
|
+
* Parses receiver and satellite antenna calibration files containing
|
|
4
|
+
* Phase Center Offsets (PCO) and Phase Center Variations (PCV).
|
|
5
|
+
*/
|
|
6
|
+
interface FrequencyData {
|
|
7
|
+
/** Frequency code, e.g. "G01", "E05" */
|
|
8
|
+
frequency: string;
|
|
9
|
+
/** Phase Center Offset — North/X component (mm) */
|
|
10
|
+
pcoN: number;
|
|
11
|
+
/** Phase Center Offset — East/Y component (mm) */
|
|
12
|
+
pcoE: number;
|
|
13
|
+
/** Phase Center Offset — Up/Z component (mm) */
|
|
14
|
+
pcoU: number;
|
|
15
|
+
/** Non-azimuth-dependent PCV values (mm), length = numZen */
|
|
16
|
+
pcvNoazi: number[];
|
|
17
|
+
/**
|
|
18
|
+
* Azimuth-dependent PCV grid (mm).
|
|
19
|
+
* Rows = azimuths (0..360 step dazi), cols = zenith angles.
|
|
20
|
+
* Empty when dazi === 0 (no azimuth dependence).
|
|
21
|
+
*/
|
|
22
|
+
pcv: number[][];
|
|
23
|
+
}
|
|
24
|
+
interface AntennaEntry {
|
|
25
|
+
/** Antenna type name (20 chars, e.g. "LEIAR20 LEIM") */
|
|
26
|
+
type: string;
|
|
27
|
+
/** Serial number or satellite code (e.g. "G05", or blank for type-mean) */
|
|
28
|
+
serialNo: string;
|
|
29
|
+
/** SVN code (satellites only, optional) */
|
|
30
|
+
svnCode: string;
|
|
31
|
+
/** COSPAR ID (satellites only, optional) */
|
|
32
|
+
cosparId: string;
|
|
33
|
+
/** Whether this is a satellite antenna (vs receiver) */
|
|
34
|
+
isSatellite: boolean;
|
|
35
|
+
/** Calibration method */
|
|
36
|
+
method: string;
|
|
37
|
+
/** Agency that performed calibration */
|
|
38
|
+
agency: string;
|
|
39
|
+
/** Number of individual antennas calibrated */
|
|
40
|
+
numCalibrated: number;
|
|
41
|
+
/** Calibration date string */
|
|
42
|
+
date: string;
|
|
43
|
+
/** Azimuth increment (degrees). 0 = no azimuth dependence. */
|
|
44
|
+
dazi: number;
|
|
45
|
+
/** Zenith/nadir start angle (degrees) */
|
|
46
|
+
zen1: number;
|
|
47
|
+
/** Zenith/nadir end angle (degrees) */
|
|
48
|
+
zen2: number;
|
|
49
|
+
/** Zenith/nadir increment (degrees) */
|
|
50
|
+
dzen: number;
|
|
51
|
+
/** SINEX code (optional) */
|
|
52
|
+
sinexCode: string;
|
|
53
|
+
/** Valid-from date (optional) */
|
|
54
|
+
validFrom: string;
|
|
55
|
+
/** Valid-until date (optional) */
|
|
56
|
+
validUntil: string;
|
|
57
|
+
/** Per-frequency calibration data */
|
|
58
|
+
frequencies: FrequencyData[];
|
|
59
|
+
}
|
|
60
|
+
interface AntexFile {
|
|
61
|
+
/** Format version (e.g. 1.4) */
|
|
62
|
+
version: number;
|
|
63
|
+
/** Satellite system flag ('G','R','E','C','J','S','M') */
|
|
64
|
+
system: string;
|
|
65
|
+
/** PCV type: 'A' (absolute) or 'R' (relative) */
|
|
66
|
+
pcvType: string;
|
|
67
|
+
/** Reference antenna type (for relative values) */
|
|
68
|
+
refAntenna: string;
|
|
69
|
+
/** Header comments */
|
|
70
|
+
comments: string[];
|
|
71
|
+
/** All antenna entries in the file */
|
|
72
|
+
antennas: AntennaEntry[];
|
|
73
|
+
}
|
|
74
|
+
declare function parseAntex(text: string): AntexFile;
|
|
75
|
+
declare function frequencyLabel(code: string): string;
|
|
76
|
+
|
|
77
|
+
export { type AntennaEntry, type AntexFile, type FrequencyData, frequencyLabel, parseAntex };
|
package/dist/antex.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// src/constants/gnss.ts
|
|
2
|
+
var SYSTEM_NAMES = {
|
|
3
|
+
G: "GPS",
|
|
4
|
+
R: "GLONASS",
|
|
5
|
+
E: "Galileo",
|
|
6
|
+
C: "BeiDou",
|
|
7
|
+
J: "QZSS",
|
|
8
|
+
I: "NavIC",
|
|
9
|
+
S: "SBAS"
|
|
10
|
+
};
|
|
11
|
+
var SYS_SHORT = {
|
|
12
|
+
G: "GPS",
|
|
13
|
+
R: "GLO",
|
|
14
|
+
E: "GAL",
|
|
15
|
+
C: "BDS",
|
|
16
|
+
J: "QZS",
|
|
17
|
+
I: "NIC",
|
|
18
|
+
S: "SBS"
|
|
19
|
+
};
|
|
20
|
+
var C_LIGHT = 299792458;
|
|
21
|
+
var FREQ = {
|
|
22
|
+
G: { "1": 157542e4, "2": 12276e5, "5": 117645e4 },
|
|
23
|
+
R: { "3": 1202025e3 },
|
|
24
|
+
E: { "1": 157542e4, "5": 117645e4, "6": 127875e4, "7": 120714e4, "8": 1191795e3 },
|
|
25
|
+
C: { "1": 157542e4, "2": 1561098e3, "5": 117645e4, "6": 126852e4, "7": 120714e4 },
|
|
26
|
+
J: { "1": 157542e4, "2": 12276e5, "5": 117645e4, "6": 127875e4 },
|
|
27
|
+
I: { "5": 117645e4, "9": 2492028e3 },
|
|
28
|
+
S: { "1": 157542e4, "5": 117645e4 }
|
|
29
|
+
};
|
|
30
|
+
var BAND_LABELS = {
|
|
31
|
+
G: { "1": "L1", "2": "L2", "5": "L5" },
|
|
32
|
+
R: { "1": "G1", "2": "G2", "3": "G3" },
|
|
33
|
+
E: { "1": "E1", "5": "E5a", "6": "E6", "7": "E5b", "8": "E5" },
|
|
34
|
+
C: { "1": "B1C", "2": "B1I", "5": "B2a", "6": "B3I", "7": "B2I" },
|
|
35
|
+
J: { "1": "L1", "2": "L2", "5": "L5", "6": "L6" },
|
|
36
|
+
I: { "5": "L5", "9": "S" },
|
|
37
|
+
S: { "1": "L1", "5": "L5" }
|
|
38
|
+
};
|
|
39
|
+
var DUAL_FREQ_PAIRS = {
|
|
40
|
+
G: [["1", "2"], ["1", "5"]],
|
|
41
|
+
R: [["1", "2"], ["1", "3"]],
|
|
42
|
+
E: [["1", "5"], ["1", "7"], ["1", "6"]],
|
|
43
|
+
C: [["2", "7"], ["2", "6"], ["1", "5"]],
|
|
44
|
+
J: [["1", "2"], ["1", "5"]],
|
|
45
|
+
I: [["5", "9"]],
|
|
46
|
+
S: [["1", "5"]]
|
|
47
|
+
};
|
|
48
|
+
var GLO_F1_BASE = 1602e6;
|
|
49
|
+
var GLO_F1_STEP = 562500;
|
|
50
|
+
var GLO_F2_BASE = 1246e6;
|
|
51
|
+
var GLO_F2_STEP = 437500;
|
|
52
|
+
var GLO_F3 = 1202025e3;
|
|
53
|
+
var GLO_CHANNEL_FALLBACK = {
|
|
54
|
+
R01: 1,
|
|
55
|
+
R02: -4,
|
|
56
|
+
R03: 5,
|
|
57
|
+
R04: 6,
|
|
58
|
+
R05: 1,
|
|
59
|
+
R06: -4,
|
|
60
|
+
R07: 5,
|
|
61
|
+
R08: 6,
|
|
62
|
+
R09: -2,
|
|
63
|
+
R10: -7,
|
|
64
|
+
R11: 0,
|
|
65
|
+
R12: -1,
|
|
66
|
+
R13: -2,
|
|
67
|
+
R14: -7,
|
|
68
|
+
R15: 0,
|
|
69
|
+
R16: -1,
|
|
70
|
+
R17: 4,
|
|
71
|
+
R18: -3,
|
|
72
|
+
R19: 3,
|
|
73
|
+
R20: 2,
|
|
74
|
+
R21: 4,
|
|
75
|
+
R22: -3,
|
|
76
|
+
R23: 3,
|
|
77
|
+
R24: 2
|
|
78
|
+
};
|
|
79
|
+
function buildGloChannelMap(slots) {
|
|
80
|
+
if (Object.keys(slots).length === 0) return { ...GLO_CHANNEL_FALLBACK };
|
|
81
|
+
const map = {};
|
|
82
|
+
for (const [slot, k] of Object.entries(slots)) {
|
|
83
|
+
map[`R${String(slot).padStart(2, "0")}`] = k;
|
|
84
|
+
}
|
|
85
|
+
return map;
|
|
86
|
+
}
|
|
87
|
+
function gloFreq(gloChannels, prn, band) {
|
|
88
|
+
const k = gloChannels[prn];
|
|
89
|
+
if (k === void 0) return void 0;
|
|
90
|
+
if (band === "1") return GLO_F1_BASE + k * GLO_F1_STEP;
|
|
91
|
+
if (band === "2") return GLO_F2_BASE + k * GLO_F2_STEP;
|
|
92
|
+
if (band === "3") return GLO_F3;
|
|
93
|
+
return void 0;
|
|
94
|
+
}
|
|
95
|
+
function getFreq(gloChannels, prn, band) {
|
|
96
|
+
const sys = prn[0];
|
|
97
|
+
if (sys === "R") return gloFreq(gloChannels, prn, band);
|
|
98
|
+
return FREQ[sys]?.[band];
|
|
99
|
+
}
|
|
100
|
+
var BDS_SATELLITES = [
|
|
101
|
+
{ prn: "C01", phase: "BDS-2", orbit: "GEO" },
|
|
102
|
+
{ prn: "C02", phase: "BDS-2", orbit: "GEO" },
|
|
103
|
+
{ prn: "C03", phase: "BDS-2", orbit: "GEO" },
|
|
104
|
+
{ prn: "C04", phase: "BDS-2", orbit: "GEO" },
|
|
105
|
+
{ prn: "C05", phase: "BDS-2", orbit: "GEO" },
|
|
106
|
+
{ prn: "C06", phase: "BDS-2", orbit: "IGSO" },
|
|
107
|
+
{ prn: "C07", phase: "BDS-2", orbit: "IGSO" },
|
|
108
|
+
{ prn: "C08", phase: "BDS-2", orbit: "IGSO" },
|
|
109
|
+
{ prn: "C09", phase: "BDS-2", orbit: "IGSO" },
|
|
110
|
+
{ prn: "C10", phase: "BDS-2", orbit: "IGSO" },
|
|
111
|
+
{ prn: "C13", phase: "BDS-2", orbit: "IGSO" },
|
|
112
|
+
{ prn: "C16", phase: "BDS-2", orbit: "IGSO" },
|
|
113
|
+
{ prn: "C11", phase: "BDS-2", orbit: "MEO" },
|
|
114
|
+
{ prn: "C12", phase: "BDS-2", orbit: "MEO" },
|
|
115
|
+
{ prn: "C14", phase: "BDS-2", orbit: "MEO" },
|
|
116
|
+
{ prn: "C19", phase: "BDS-3", orbit: "MEO" },
|
|
117
|
+
{ prn: "C20", phase: "BDS-3", orbit: "MEO" },
|
|
118
|
+
{ prn: "C21", phase: "BDS-3", orbit: "MEO" },
|
|
119
|
+
{ prn: "C22", phase: "BDS-3", orbit: "MEO" },
|
|
120
|
+
{ prn: "C23", phase: "BDS-3", orbit: "MEO" },
|
|
121
|
+
{ prn: "C24", phase: "BDS-3", orbit: "MEO" },
|
|
122
|
+
{ prn: "C25", phase: "BDS-3", orbit: "MEO" },
|
|
123
|
+
{ prn: "C26", phase: "BDS-3", orbit: "MEO" },
|
|
124
|
+
{ prn: "C27", phase: "BDS-3", orbit: "MEO" },
|
|
125
|
+
{ prn: "C28", phase: "BDS-3", orbit: "MEO" },
|
|
126
|
+
{ prn: "C29", phase: "BDS-3", orbit: "MEO" },
|
|
127
|
+
{ prn: "C30", phase: "BDS-3", orbit: "MEO" },
|
|
128
|
+
{ prn: "C32", phase: "BDS-3", orbit: "MEO" },
|
|
129
|
+
{ prn: "C33", phase: "BDS-3", orbit: "MEO" },
|
|
130
|
+
{ prn: "C34", phase: "BDS-3", orbit: "MEO" },
|
|
131
|
+
{ prn: "C35", phase: "BDS-3", orbit: "MEO" },
|
|
132
|
+
{ prn: "C36", phase: "BDS-3", orbit: "MEO" },
|
|
133
|
+
{ prn: "C37", phase: "BDS-3", orbit: "MEO" },
|
|
134
|
+
{ prn: "C41", phase: "BDS-3", orbit: "MEO" },
|
|
135
|
+
{ prn: "C42", phase: "BDS-3", orbit: "MEO" },
|
|
136
|
+
{ prn: "C43", phase: "BDS-3", orbit: "MEO" },
|
|
137
|
+
{ prn: "C44", phase: "BDS-3", orbit: "MEO" },
|
|
138
|
+
{ prn: "C45", phase: "BDS-3", orbit: "MEO" },
|
|
139
|
+
{ prn: "C46", phase: "BDS-3", orbit: "MEO" },
|
|
140
|
+
{ prn: "C38", phase: "BDS-3", orbit: "IGSO" },
|
|
141
|
+
{ prn: "C39", phase: "BDS-3", orbit: "IGSO" },
|
|
142
|
+
{ prn: "C40", phase: "BDS-3", orbit: "IGSO" },
|
|
143
|
+
{ prn: "C59", phase: "BDS-3", orbit: "GEO" },
|
|
144
|
+
{ prn: "C60", phase: "BDS-3", orbit: "GEO" },
|
|
145
|
+
{ prn: "C61", phase: "BDS-3", orbit: "GEO" }
|
|
146
|
+
];
|
|
147
|
+
var ATTR_PRIORITY = {
|
|
148
|
+
X: 8,
|
|
149
|
+
C: 7,
|
|
150
|
+
S: 6,
|
|
151
|
+
L: 6,
|
|
152
|
+
Q: 6,
|
|
153
|
+
I: 5,
|
|
154
|
+
B: 5,
|
|
155
|
+
D: 4,
|
|
156
|
+
Z: 3,
|
|
157
|
+
P: 2,
|
|
158
|
+
W: 1
|
|
159
|
+
};
|
|
160
|
+
function attrRank(code) {
|
|
161
|
+
return ATTR_PRIORITY[code[2] ?? ""] ?? 3;
|
|
162
|
+
}
|
|
163
|
+
function buildObsIndices(header) {
|
|
164
|
+
const result = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const [sys, codes] of Object.entries(header.obsTypes)) {
|
|
166
|
+
if (sys === "_v2") continue;
|
|
167
|
+
const lIdx = /* @__PURE__ */ new Map();
|
|
168
|
+
const lRank = /* @__PURE__ */ new Map();
|
|
169
|
+
const cIdx = /* @__PURE__ */ new Map();
|
|
170
|
+
const cRank = /* @__PURE__ */ new Map();
|
|
171
|
+
for (let i = 0; i < codes.length; i++) {
|
|
172
|
+
const code = codes[i];
|
|
173
|
+
const type = code[0];
|
|
174
|
+
const band = code[1];
|
|
175
|
+
if (!band) continue;
|
|
176
|
+
const rank = attrRank(code);
|
|
177
|
+
if (type === "L" && rank > (lRank.get(band) ?? -1)) {
|
|
178
|
+
lIdx.set(band, i);
|
|
179
|
+
lRank.set(band, rank);
|
|
180
|
+
}
|
|
181
|
+
if ((type === "C" || type === "P") && rank > (cRank.get(band) ?? -1)) {
|
|
182
|
+
cIdx.set(band, i);
|
|
183
|
+
cRank.set(band, rank);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const bandMap = /* @__PURE__ */ new Map();
|
|
187
|
+
for (const [band, li] of lIdx) {
|
|
188
|
+
bandMap.set(band, { L: li, C: cIdx.get(band) ?? null });
|
|
189
|
+
}
|
|
190
|
+
if (bandMap.size > 0) result.set(sys, bandMap);
|
|
191
|
+
}
|
|
192
|
+
const v2codes = header.obsTypes["_v2"];
|
|
193
|
+
if (v2codes) {
|
|
194
|
+
const lIdx = /* @__PURE__ */ new Map();
|
|
195
|
+
const cIdx = /* @__PURE__ */ new Map();
|
|
196
|
+
for (let i = 0; i < v2codes.length; i++) {
|
|
197
|
+
const code = v2codes[i];
|
|
198
|
+
const type = code[0];
|
|
199
|
+
const band = code[1];
|
|
200
|
+
if (!band) continue;
|
|
201
|
+
if (type === "L" && !lIdx.has(band)) lIdx.set(band, i);
|
|
202
|
+
if ((type === "C" || type === "P") && !cIdx.has(band)) cIdx.set(band, i);
|
|
203
|
+
}
|
|
204
|
+
const bandMap = /* @__PURE__ */ new Map();
|
|
205
|
+
for (const [band, li] of lIdx) {
|
|
206
|
+
bandMap.set(band, { L: li, C: cIdx.get(band) ?? null });
|
|
207
|
+
}
|
|
208
|
+
if (bandMap.size > 0) result.set("_v2", bandMap);
|
|
209
|
+
}
|
|
210
|
+
return result;
|
|
211
|
+
}
|
|
212
|
+
var ARC_GAP_FACTOR = 5;
|
|
213
|
+
var DEFAULT_ELEV_MASK_DEG = 5;
|
|
214
|
+
function formatUTCTime(d) {
|
|
215
|
+
return `${String(d.getUTCHours()).padStart(2, "0")}:${String(d.getUTCMinutes()).padStart(2, "0")}:${String(d.getUTCSeconds()).padStart(2, "0")}`;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
SYSTEM_NAMES,
|
|
220
|
+
SYS_SHORT,
|
|
221
|
+
C_LIGHT,
|
|
222
|
+
FREQ,
|
|
223
|
+
BAND_LABELS,
|
|
224
|
+
DUAL_FREQ_PAIRS,
|
|
225
|
+
GLO_F1_BASE,
|
|
226
|
+
GLO_F1_STEP,
|
|
227
|
+
GLO_F2_BASE,
|
|
228
|
+
GLO_F2_STEP,
|
|
229
|
+
GLO_F3,
|
|
230
|
+
GLO_CHANNEL_FALLBACK,
|
|
231
|
+
buildGloChannelMap,
|
|
232
|
+
gloFreq,
|
|
233
|
+
getFreq,
|
|
234
|
+
BDS_SATELLITES,
|
|
235
|
+
buildObsIndices,
|
|
236
|
+
ARC_GAP_FACTOR,
|
|
237
|
+
DEFAULT_ELEV_MASK_DEG,
|
|
238
|
+
formatUTCTime
|
|
239
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WGS84_ECCENTRICITY_SQUARED,
|
|
3
|
+
WGS84_SEMI_MAJOR_AXIS
|
|
4
|
+
} from "./chunk-6FAL6P4G.js";
|
|
5
|
+
|
|
6
|
+
// src/coordinates/ecef.ts
|
|
7
|
+
function clampUnit(x) {
|
|
8
|
+
return x < -1 ? -1 : x > 1 ? 1 : x;
|
|
9
|
+
}
|
|
10
|
+
function geodeticToEcef(lat, lon, h) {
|
|
11
|
+
const N = WGS84_SEMI_MAJOR_AXIS / Math.sqrt(1 - WGS84_ECCENTRICITY_SQUARED * Math.sin(lat) ** 2);
|
|
12
|
+
const x = (N + h) * Math.cos(lat) * Math.cos(lon);
|
|
13
|
+
const y = (N + h) * Math.cos(lat) * Math.sin(lon);
|
|
14
|
+
const z = ((1 - WGS84_ECCENTRICITY_SQUARED) * N + h) * Math.sin(lat);
|
|
15
|
+
return [x, y, z];
|
|
16
|
+
}
|
|
17
|
+
function ecefToGeodetic(x, y, z) {
|
|
18
|
+
const lon = Math.atan2(y, x);
|
|
19
|
+
const p = Math.sqrt(x * x + y * y);
|
|
20
|
+
if (p < 1e-10) {
|
|
21
|
+
const b = WGS84_SEMI_MAJOR_AXIS * Math.sqrt(1 - WGS84_ECCENTRICITY_SQUARED);
|
|
22
|
+
const lat2 = z >= 0 ? Math.PI / 2 : -Math.PI / 2;
|
|
23
|
+
const alt2 = Math.abs(z) - b;
|
|
24
|
+
return [lat2, lon, alt2];
|
|
25
|
+
}
|
|
26
|
+
let lat = Math.atan2(z, p * (1 - WGS84_ECCENTRICITY_SQUARED));
|
|
27
|
+
let N;
|
|
28
|
+
for (let i = 0; i < 10; i++) {
|
|
29
|
+
const sinLat2 = Math.sin(lat);
|
|
30
|
+
N = WGS84_SEMI_MAJOR_AXIS / Math.sqrt(1 - WGS84_ECCENTRICITY_SQUARED * sinLat2 * sinLat2);
|
|
31
|
+
const prevLat = lat;
|
|
32
|
+
lat = Math.atan2(z + WGS84_ECCENTRICITY_SQUARED * N * sinLat2, p);
|
|
33
|
+
if (Math.abs(lat - prevLat) < 1e-15) break;
|
|
34
|
+
}
|
|
35
|
+
const sinLat = Math.sin(lat);
|
|
36
|
+
N = WGS84_SEMI_MAJOR_AXIS / Math.sqrt(1 - WGS84_ECCENTRICITY_SQUARED * sinLat * sinLat);
|
|
37
|
+
const alt = p / Math.cos(lat) - N;
|
|
38
|
+
return [lat, lon, alt];
|
|
39
|
+
}
|
|
40
|
+
function getEnuDifference(x, y, z, xRef, yRef, zRef) {
|
|
41
|
+
const [latRef, lonRef] = ecefToGeodetic(xRef, yRef, zRef);
|
|
42
|
+
const deltaX = x - xRef;
|
|
43
|
+
const deltaY = y - yRef;
|
|
44
|
+
const deltaZ = z - zRef;
|
|
45
|
+
const deltaE = -Math.sin(lonRef) * deltaX + Math.cos(lonRef) * deltaY;
|
|
46
|
+
const deltaN = -Math.cos(lonRef) * Math.sin(latRef) * deltaX - Math.sin(lonRef) * Math.sin(latRef) * deltaY + Math.cos(latRef) * deltaZ;
|
|
47
|
+
const deltaU = Math.cos(lonRef) * Math.cos(latRef) * deltaX + Math.sin(lonRef) * Math.cos(latRef) * deltaY + Math.sin(latRef) * deltaZ;
|
|
48
|
+
return [deltaE, deltaN, deltaU];
|
|
49
|
+
}
|
|
50
|
+
function getAer(x, y, z, xRef, yRef, zRef) {
|
|
51
|
+
const slant = Math.sqrt((x - xRef) ** 2 + (y - yRef) ** 2 + (z - zRef) ** 2);
|
|
52
|
+
if (!slant) return [0, 0, 0];
|
|
53
|
+
const [deltaE, deltaN, deltaU] = getEnuDifference(x, y, z, xRef, yRef, zRef);
|
|
54
|
+
const elevation = Math.asin(clampUnit(deltaU / slant));
|
|
55
|
+
const azimuth = Math.atan2(deltaE, deltaN);
|
|
56
|
+
return [elevation, azimuth, slant];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
clampUnit,
|
|
61
|
+
geodeticToEcef,
|
|
62
|
+
ecefToGeodetic,
|
|
63
|
+
getEnuDifference,
|
|
64
|
+
getAer
|
|
65
|
+
};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
// src/antex/index.ts
|
|
2
|
+
function label(line) {
|
|
3
|
+
return (line.length >= 80 ? line.substring(60, 80) : line.substring(60)).trimEnd();
|
|
4
|
+
}
|
|
5
|
+
function parseFloat10(s) {
|
|
6
|
+
return parseFloat(s) || 0;
|
|
7
|
+
}
|
|
8
|
+
function parseFloat6(s) {
|
|
9
|
+
return parseFloat(s) || 0;
|
|
10
|
+
}
|
|
11
|
+
function parseInt6(s) {
|
|
12
|
+
return parseInt(s, 10) || 0;
|
|
13
|
+
}
|
|
14
|
+
function parseValidityDate(line) {
|
|
15
|
+
const year = parseInt(line.substring(0, 6), 10);
|
|
16
|
+
const month = parseInt(line.substring(6, 12), 10);
|
|
17
|
+
const day = parseInt(line.substring(12, 18), 10);
|
|
18
|
+
const hour = parseInt(line.substring(18, 24), 10);
|
|
19
|
+
const min = parseInt(line.substring(24, 30), 10);
|
|
20
|
+
if (isNaN(year)) return "";
|
|
21
|
+
return `${year}-${String(month).padStart(2, "0")}-${String(day).padStart(2, "0")} ${String(hour).padStart(2, "0")}:${String(min).padStart(2, "0")}`;
|
|
22
|
+
}
|
|
23
|
+
function parsePcvRow(line, offset, count) {
|
|
24
|
+
const vals = [];
|
|
25
|
+
for (let i = 0; i < count; i++) {
|
|
26
|
+
const start = offset + i * 8;
|
|
27
|
+
const s = line.substring(start, start + 8);
|
|
28
|
+
vals.push(parseFloat(s) || 0);
|
|
29
|
+
}
|
|
30
|
+
return vals;
|
|
31
|
+
}
|
|
32
|
+
function parseFrequencyBlock(lines, numZen, hasAzimuth, _numAzi) {
|
|
33
|
+
let frequency = "";
|
|
34
|
+
let pcoN = 0, pcoE = 0, pcoU = 0;
|
|
35
|
+
const pcvNoazi = [];
|
|
36
|
+
const pcv = [];
|
|
37
|
+
for (const line of lines) {
|
|
38
|
+
const lbl = label(line);
|
|
39
|
+
if (lbl === "START OF FREQUENCY") {
|
|
40
|
+
frequency = line.substring(3, 6).trim();
|
|
41
|
+
} else if (lbl === "NORTH / EAST / UP") {
|
|
42
|
+
pcoN = parseFloat10(line.substring(0, 10));
|
|
43
|
+
pcoE = parseFloat10(line.substring(10, 20));
|
|
44
|
+
pcoU = parseFloat10(line.substring(20, 30));
|
|
45
|
+
} else if (line.substring(3, 8) === "NOAZI") {
|
|
46
|
+
pcvNoazi.push(...parsePcvRow(line, 8, numZen));
|
|
47
|
+
} else if (lbl !== "END OF FREQUENCY" && lbl !== "START OF FREQUENCY") {
|
|
48
|
+
if (hasAzimuth && line.length > 8) {
|
|
49
|
+
const row = parsePcvRow(line, 8, numZen);
|
|
50
|
+
pcv.push(row);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return { frequency, pcoN, pcoE, pcoU, pcvNoazi, pcv };
|
|
55
|
+
}
|
|
56
|
+
function parseAntex(text) {
|
|
57
|
+
const allLines = text.split(/\r?\n/);
|
|
58
|
+
let version = 0;
|
|
59
|
+
let system = "";
|
|
60
|
+
let pcvType = "";
|
|
61
|
+
let refAntenna = "";
|
|
62
|
+
const comments = [];
|
|
63
|
+
const antennas = [];
|
|
64
|
+
let inHeader = true;
|
|
65
|
+
let inAntenna = false;
|
|
66
|
+
let inFreq = false;
|
|
67
|
+
let freqLines = [];
|
|
68
|
+
let type = "", serialNo = "", svnCode = "", cosparId = "";
|
|
69
|
+
let method = "", agency = "", date = "";
|
|
70
|
+
let numCalibrated = 0;
|
|
71
|
+
let dazi = 0, zen1 = 0, zen2 = 0, dzen = 0;
|
|
72
|
+
let sinexCode = "", validFrom = "", validUntil = "";
|
|
73
|
+
let frequencies = [];
|
|
74
|
+
let isSatellite = false;
|
|
75
|
+
for (const rawLine of allLines) {
|
|
76
|
+
const line = rawLine.length < 80 ? rawLine.padEnd(80) : rawLine;
|
|
77
|
+
const lbl = label(line);
|
|
78
|
+
if (inHeader) {
|
|
79
|
+
if (lbl === "ANTEX VERSION / SYST") {
|
|
80
|
+
version = parseFloat(line.substring(0, 8)) || 0;
|
|
81
|
+
system = line.substring(20, 21).trim();
|
|
82
|
+
} else if (lbl === "PCV TYPE / REFANT") {
|
|
83
|
+
pcvType = line.substring(0, 1).trim();
|
|
84
|
+
refAntenna = line.substring(20, 40).trim();
|
|
85
|
+
} else if (lbl === "COMMENT") {
|
|
86
|
+
comments.push(line.substring(0, 60).trim());
|
|
87
|
+
} else if (lbl === "END OF HEADER") {
|
|
88
|
+
inHeader = false;
|
|
89
|
+
}
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (lbl === "START OF ANTENNA") {
|
|
93
|
+
inAntenna = true;
|
|
94
|
+
type = "";
|
|
95
|
+
serialNo = "";
|
|
96
|
+
svnCode = "";
|
|
97
|
+
cosparId = "";
|
|
98
|
+
method = "";
|
|
99
|
+
agency = "";
|
|
100
|
+
date = "";
|
|
101
|
+
numCalibrated = 0;
|
|
102
|
+
dazi = 0;
|
|
103
|
+
zen1 = 0;
|
|
104
|
+
zen2 = 0;
|
|
105
|
+
dzen = 0;
|
|
106
|
+
sinexCode = "";
|
|
107
|
+
validFrom = "";
|
|
108
|
+
validUntil = "";
|
|
109
|
+
frequencies = [];
|
|
110
|
+
isSatellite = false;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (!inAntenna) continue;
|
|
114
|
+
if (lbl === "END OF ANTENNA") {
|
|
115
|
+
antennas.push({
|
|
116
|
+
type,
|
|
117
|
+
serialNo,
|
|
118
|
+
svnCode,
|
|
119
|
+
cosparId,
|
|
120
|
+
isSatellite,
|
|
121
|
+
method,
|
|
122
|
+
agency,
|
|
123
|
+
numCalibrated,
|
|
124
|
+
date,
|
|
125
|
+
dazi,
|
|
126
|
+
zen1,
|
|
127
|
+
zen2,
|
|
128
|
+
dzen,
|
|
129
|
+
sinexCode,
|
|
130
|
+
validFrom,
|
|
131
|
+
validUntil,
|
|
132
|
+
frequencies
|
|
133
|
+
});
|
|
134
|
+
inAntenna = false;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (lbl === "TYPE / SERIAL NO") {
|
|
138
|
+
type = line.substring(0, 20).trim();
|
|
139
|
+
serialNo = line.substring(20, 40).trim();
|
|
140
|
+
svnCode = line.substring(40, 50).trim();
|
|
141
|
+
cosparId = line.substring(50, 60).trim();
|
|
142
|
+
isSatellite = /^[GRECIJS]\d{2,3}$/.test(serialNo);
|
|
143
|
+
} else if (lbl === "METH / BY / # / DATE") {
|
|
144
|
+
method = line.substring(0, 20).trim();
|
|
145
|
+
agency = line.substring(20, 40).trim();
|
|
146
|
+
numCalibrated = parseInt6(line.substring(40, 46));
|
|
147
|
+
date = line.substring(50, 60).trim();
|
|
148
|
+
} else if (lbl === "DAZI") {
|
|
149
|
+
dazi = parseFloat6(line.substring(2, 8));
|
|
150
|
+
} else if (lbl === "ZEN1 / ZEN2 / DZEN") {
|
|
151
|
+
zen1 = parseFloat6(line.substring(2, 8));
|
|
152
|
+
zen2 = parseFloat6(line.substring(8, 14));
|
|
153
|
+
dzen = parseFloat6(line.substring(14, 20));
|
|
154
|
+
} else if (lbl === "SINEX CODE") {
|
|
155
|
+
sinexCode = line.substring(0, 10).trim();
|
|
156
|
+
} else if (lbl === "VALID FROM") {
|
|
157
|
+
validFrom = parseValidityDate(line);
|
|
158
|
+
} else if (lbl === "VALID UNTIL") {
|
|
159
|
+
validUntil = parseValidityDate(line);
|
|
160
|
+
} else if (lbl === "START OF FREQUENCY") {
|
|
161
|
+
inFreq = true;
|
|
162
|
+
freqLines = [line];
|
|
163
|
+
} else if (lbl === "END OF FREQUENCY") {
|
|
164
|
+
freqLines.push(line);
|
|
165
|
+
inFreq = false;
|
|
166
|
+
const numZen = dzen > 0 ? Math.round((zen2 - zen1) / dzen) + 1 : 0;
|
|
167
|
+
const hasAzimuth = dazi > 0;
|
|
168
|
+
const numAzi = hasAzimuth ? Math.round(360 / dazi) + 1 : 0;
|
|
169
|
+
frequencies.push(
|
|
170
|
+
parseFrequencyBlock(freqLines, numZen, hasAzimuth, numAzi)
|
|
171
|
+
);
|
|
172
|
+
} else if (lbl === "START OF FREQ RMS") {
|
|
173
|
+
inFreq = false;
|
|
174
|
+
} else if (inFreq) {
|
|
175
|
+
freqLines.push(line);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return { version, system, pcvType, refAntenna, comments, antennas };
|
|
179
|
+
}
|
|
180
|
+
var FREQ_LABELS = {
|
|
181
|
+
G01: "GPS L1",
|
|
182
|
+
G02: "GPS L2",
|
|
183
|
+
G05: "GPS L5",
|
|
184
|
+
R01: "GLO G1",
|
|
185
|
+
R02: "GLO G2",
|
|
186
|
+
R04: "GLO G1a",
|
|
187
|
+
R06: "GLO G2a",
|
|
188
|
+
E01: "GAL E1",
|
|
189
|
+
E05: "GAL E5a",
|
|
190
|
+
E06: "GAL E6",
|
|
191
|
+
E07: "GAL E5b",
|
|
192
|
+
E08: "GAL E5",
|
|
193
|
+
C01: "BDS B1",
|
|
194
|
+
C02: "BDS B1-2",
|
|
195
|
+
C05: "BDS B2a",
|
|
196
|
+
C06: "BDS B3",
|
|
197
|
+
C07: "BDS B2b",
|
|
198
|
+
C08: "BDS B2",
|
|
199
|
+
J01: "QZS L1",
|
|
200
|
+
J02: "QZS L2",
|
|
201
|
+
J05: "QZS L5",
|
|
202
|
+
J06: "QZS LEX",
|
|
203
|
+
S01: "SBS L1",
|
|
204
|
+
S05: "SBS L5",
|
|
205
|
+
I05: "NIC L5"
|
|
206
|
+
};
|
|
207
|
+
function frequencyLabel(code) {
|
|
208
|
+
return FREQ_LABELS[code] ?? code;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export {
|
|
212
|
+
parseAntex,
|
|
213
|
+
frequencyLabel
|
|
214
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/constants/wgs84.ts
|
|
2
|
+
var WGS84_SEMI_MAJOR_AXIS = 6378137;
|
|
3
|
+
var WGS84_SEMI_MINOR_AXIS = 6356752314245e-6;
|
|
4
|
+
var WGS84_FLATTENING = 1 / 298.257223563;
|
|
5
|
+
var WGS84_ECCENTRICITY_SQUARED = 0.006694379990197;
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
WGS84_SEMI_MAJOR_AXIS,
|
|
9
|
+
WGS84_SEMI_MINOR_AXIS,
|
|
10
|
+
WGS84_FLATTENING,
|
|
11
|
+
WGS84_ECCENTRICITY_SQUARED
|
|
12
|
+
};
|