58#define LLI_BOCTRK 0x04
62#define FILEPATHSEP '/'
68#define SQR(x) ((x) * (x))
72#define MAXRNXLEN (16 * MAXOBSTYPE + 4)
73#define MAXPOSHEAD 1024
85 2.4, 3.4, 4.85, 6.85, 9.65, 13.65, 24.0, 48.0,
86 96.0, 192.0, 384.0, 768.0, 1536.0, 3072.0, 6144.0, 0.0};
88 2.0, 2.8, 4.0, 5.7, 8.0, 11.3, 16.0, 32.0,
89 64.0, 128.0, 256.0, 512.0, 1024.0, 2048.0, 4096.0, 8192.0};
102static void setstr(
char* dst,
const char* src,
int n) {
105 while (*q && q < src + n) {
109 while (p >= dst && *p ==
' ') {
116 if (tt < -302400.0) {
142 sprintf(str,
"%04.0f%02.0f%02.0f %02.0f%02.0f%02.0f UTC", ep[0], ep[1], ep[2], ep[3], ep[4], ep[5]);
147 switch (
satsys(sat, &prn)) {
149 sprintf(code,
"G%02d", prn -
MINPRNGPS + 1);
152 sprintf(code,
"R%02d", prn -
MINPRNGLO + 1);
155 sprintf(code,
"E%02d", prn -
MINPRNGAL + 1);
158 sprintf(code,
"S%02d", prn - 100);
161 sprintf(code,
"J%02d", prn -
MINPRNQZS + 1);
164 sprintf(code,
"C%02d", prn -
MINPRNCMP + 1);
167 sprintf(code,
"I%02d", prn -
MINPRNIRN + 1);
179 for (i = 0; i < 15; i++) {
192 return 0.5 + (sisa - 50) * 0.02;
195 return 1.0 + (sisa - 75) * 0.04;
198 return 2.0 + (sisa - 100) * 0.16;
204 if (value < 0.0 || value > 6.0) {
206 }
else if (value <= 0.5) {
207 return (
int)(value / 0.01);
208 }
else if (value <= 1.0) {
209 return (
int)((value - 0.5) / 0.02) + 50;
210 }
else if (value <= 2.0) {
211 return (
int)((value - 1.0) / 0.04) + 75;
213 return ((
int)(value - 2.0) / 0.16) + 100;
226 for (i = 0; i < 3; i++) {
229 for (i = 0; i < 3; i++) {
239static void convcode(
int ver,
int sys,
const char* str,
char* type) {
242 if (!strcmp(str,
"P1")) {
244 sprintf(type,
"%c1W",
'C');
246 sprintf(type,
"%c1P",
'C');
248 }
else if (!strcmp(str,
"P2")) {
250 sprintf(type,
"%c2W",
'C');
252 sprintf(type,
"%c2P",
'C');
254 }
else if (!strcmp(str,
"C1")) {
258 sprintf(type,
"%c1C",
'C');
260 sprintf(type,
"%c1C",
'C');
262 sprintf(type,
"%c1X",
'C');
264 sprintf(type,
"%c1C",
'C');
266 sprintf(type,
"%c1C",
'C');
268 }
else if (!strcmp(str,
"C2")) {
271 sprintf(type,
"%c2W",
'C');
273 sprintf(type,
"%c2X",
'C');
276 sprintf(type,
"%c2C",
'C');
278 sprintf(type,
"%c2X",
'C');
280 sprintf(type,
"%c2X",
'C');
282 }
else if (ver >= 2.12 && str[1] ==
'A') {
284 sprintf(type,
"%c1C", str[0]);
286 sprintf(type,
"%c1C", str[0]);
288 sprintf(type,
"%c1C", str[0]);
290 sprintf(type,
"%c1C", str[0]);
292 }
else if (ver >= 2.12 && str[1] ==
'B') {
294 sprintf(type,
"%c1X", str[0]);
296 sprintf(type,
"%c1X", str[0]);
298 }
else if (ver >= 2.12 && str[1] ==
'C') {
300 sprintf(type,
"%c2X", str[0]);
302 sprintf(type,
"%c2X", str[0]);
304 }
else if (ver >= 2.12 && str[1] ==
'D') {
306 sprintf(type,
"%c2C", str[0]);
308 }
else if (ver >= 2.12 && str[1] ==
'1') {
310 sprintf(type,
"%c1W", str[0]);
312 sprintf(type,
"%c1P", str[0]);
314 sprintf(type,
"%c1X", str[0]);
316 sprintf(type,
"%c2X", str[0]);
318 }
else if (ver < 2.12 && str[1] ==
'1') {
320 sprintf(type,
"%c1C", str[0]);
322 sprintf(type,
"%c1C", str[0]);
324 sprintf(type,
"%c1X", str[0]);
326 sprintf(type,
"%c1C", str[0]);
328 sprintf(type,
"%c1C", str[0]);
330 }
else if (str[1] ==
'2') {
332 sprintf(type,
"%c2W", str[0]);
334 sprintf(type,
"%c2P", str[0]);
336 sprintf(type,
"%c2X", str[0]);
338 sprintf(type,
"%c2X", str[0]);
340 }
else if (str[1] ==
'5') {
342 sprintf(type,
"%c5X", str[0]);
344 sprintf(type,
"%c5X", str[0]);
346 sprintf(type,
"%c5X", str[0]);
348 sprintf(type,
"%c5X", str[0]);
350 }
else if (str[1] ==
'6') {
352 sprintf(type,
"%c6X", str[0]);
354 sprintf(type,
"%c6X", str[0]);
356 sprintf(type,
"%c6X", str[0]);
358 }
else if (str[1] ==
'7') {
360 sprintf(type,
"%c7X", str[0]);
362 sprintf(type,
"%c7X", str[0]);
364 }
else if (str[1] ==
'8') {
366 sprintf(type,
"%c8X", str[0]);
369 trace(NULL, 3,
"convcode: ver=%.2f sys=%2d type= %s -> %s\n", ver / 100.0, sys, str, type);
374 const char frqcodes[] =
"1256789";
375 const char* defcodes[] = {
385 int i, j, k, n, nt, prn, fcn;
387 char *label = buff + 60, str[4];
389 trace(NULL, 4,
"decode_obsh: ver=%.2f\n", ver / 100.0);
391 if (strstr(label,
"MARKER NAME")) {
395 }
else if (strstr(label,
"MARKER NUMBER")) {
399 }
else if (strstr(label,
"MARKER TYPE")) {
401 }
else if (strstr(label,
"OBSERVER / AGENCY")) {
403 }
else if (strstr(label,
"REC # / TYPE / VERS")) {
409 }
else if (strstr(label,
"ANT # / TYPE")) {
414 }
else if (strstr(label,
"APPROX POSITION XYZ")) {
416 for (i = 0, j = 0; i < 3; i++, j += 14) {
420 }
else if (strstr(label,
"ANTENNA: DELTA H/E/N")) {
422 for (i = 0, j = 0; i < 3; i++, j += 14) {
425 sta->
del[2] = del[0];
426 sta->
del[0] = del[1];
427 sta->
del[1] = del[2];
429 }
else if (strstr(label,
"ANTENNA: DELTA X/Y/Z")) {
431 }
else if (strstr(label,
"ANTENNA: PHASECENTER")) {
433 }
else if (strstr(label,
"ANTENNA: B.SIGHT XYZ")) {
435 }
else if (strstr(label,
"ANTENNA: ZERODIR AZI")) {
437 }
else if (strstr(label,
"ANTENNA: ZERODIR XYZ")) {
439 }
else if (strstr(label,
"CENTER OF MASS: XYZ")) {
441 }
else if (strstr(label,
"SYS / # / OBS TYPES")) {
442 if (!(p = strchr(
syscodes, buff[0]))) {
443 trace(NULL, 2,
"invalid system code: sys=%c\n", buff[0]);
448 for (j = nt = 0, k = 7; j < n; j++, k += 4) {
456 setstr(tobs[i][nt++], buff + k, 3);
462 if (i == 5 && ver == 302) {
463 for (j = 0; j < nt; j++) {
464 if (tobs[i][j][1] ==
'1') {
470 for (j = 0; j < nt; j++) {
474 if (!(p = strchr(frqcodes, tobs[i][j][1]))) {
477 tobs[i][j][2] = defcodes[i][(int)(p - frqcodes)];
478 trace(NULL, 2,
"set default for unknown code: sys=%c code=%s\n", buff[0], tobs[i][j]);
480 }
else if (strstr(label,
"WAVELENGTH FACT L1/2")) {
482 }
else if (strstr(label,
"# / TYPES OF OBSERV")) {
484 for (i = nt = 0, j = 10; i < n; i++, j += 6) {
506 }
else if (strstr(label,
"SIGNAL STRENGTH UNIT")) {
508 }
else if (strstr(label,
"INTERVAL")) {
510 }
else if (strstr(label,
"TIME OF FIRST OBS")) {
511 if (!strncmp(buff + 48,
"GPS", 3)) {
513 }
else if (!strncmp(buff + 48,
"GLO", 3)) {
515 }
else if (!strncmp(buff + 48,
"GAL", 3)) {
517 }
else if (!strncmp(buff + 48,
"QZS", 3)) {
519 }
else if (!strncmp(buff + 48,
"BDT", 3)) {
521 }
else if (!strncmp(buff + 48,
"IRN", 3)) {
524 }
else if (strstr(label,
"TIME OF LAST OBS")) {
526 }
else if (strstr(label,
"RCV CLOCK OFFS APPL")) {
528 }
else if (strstr(label,
"SYS / DCBS APPLIED")) {
530 }
else if (strstr(label,
"SYS / PCVS APPLIED")) {
532 }
else if (strstr(label,
"SYS / SCALE FACTOR")) {
534 }
else if (strstr(label,
"SYS / PHASE SHIFT")) {
536 }
else if (strstr(label,
"GLONASS SLOT / FRQ #")) {
537 for (i = 0; i < 8; i++) {
538 if (buff[4 + i * 7] !=
'R') {
541 prn = (int)
str2num(buff, 5 + i * 7, 2);
542 fcn = (int)
str2num(buff, 8 + i * 7, 2);
543 if (prn < 1 || prn >
MAXPRNGLO || fcn < -7 || fcn > 6) {
547 nav->
glo_fcn[prn - 1] = fcn + 8;
550 }
else if (strstr(label,
"GLONASS COD/PHS/BIS")) {
557 }
else if (strstr(label,
"LEAP SECONDS")) {
564 }
else if (strstr(label,
"# OF SALTELLITES")) {
566 }
else if (strstr(label,
"PRN / # OF OBS")) {
568 }
else if (strstr(label,
"DOI")) {
570 }
else if (strstr(label,
"LICENSE OF USE")) {
572 }
else if (strstr(label,
"STATION INFORMATION")) {
579 char* label = buff + 60;
581 trace(NULL, 4,
"decode_navh:\n");
583 if (strstr(label,
"ION ALPHA")) {
585 for (i = 0, j = 2; i < 4; i++, j += 12) {
589 }
else if (strstr(label,
"ION BETA")) {
591 for (i = 0, j = 2; i < 4; i++, j += 12) {
595 }
else if (strstr(label,
"DELTA-UTC: A0,A1,T,W")) {
597 for (i = 0, j = 3; i < 2; i++, j += 19) {
600 for (; i < 4; i++, j += 9) {
604 }
else if (strstr(label,
"IONOSPHERIC CORR")) {
606 if (!strncmp(buff,
"GPSA", 4)) {
607 for (i = 0, j = 5; i < 4; i++, j += 12) {
610 }
else if (!strncmp(buff,
"GPSB", 4)) {
611 for (i = 0, j = 5; i < 4; i++, j += 12) {
614 }
else if (!strncmp(buff,
"GAL", 3)) {
615 for (i = 0, j = 5; i < 4; i++, j += 12) {
618 }
else if (!strncmp(buff,
"QZSA", 4)) {
619 for (i = 0, j = 5; i < 4; i++, j += 12) {
622 }
else if (!strncmp(buff,
"QZSB", 4)) {
623 for (i = 0, j = 5; i < 4; i++, j += 12) {
626 }
else if (!strncmp(buff,
"BDSA", 4)) {
627 for (i = 0, j = 5; i < 4; i++, j += 12) {
630 }
else if (!strncmp(buff,
"BDSB", 4)) {
631 for (i = 0, j = 5; i < 4; i++, j += 12) {
634 }
else if (!strncmp(buff,
"IRNA", 4)) {
635 for (i = 0, j = 5; i < 4; i++, j += 12) {
638 }
else if (!strncmp(buff,
"IRNB", 4)) {
639 for (i = 0, j = 5; i < 4; i++, j += 12) {
644 }
else if (strstr(label,
"TIME SYSTEM CORR")) {
646 if (!strncmp(buff,
"GPUT", 4)) {
651 }
else if (!strncmp(buff,
"GLUT", 4)) {
653 }
else if (!strncmp(buff,
"GLGP", 4)) {
655 }
else if (!strncmp(buff,
"GAUT", 4)) {
660 }
else if (!strncmp(buff,
"QZUT", 4)) {
665 }
else if (!strncmp(buff,
"BDUT", 4)) {
670 }
else if (!strncmp(buff,
"SBUT", 4)) {
675 }
else if (!strncmp(buff,
"IRUT", 4)) {
683 }
else if (strstr(label,
"LEAP SECONDS")) {
690 }
else if (strstr(label,
"REC # / TYPE / VERS")) {
692 }
else if (strstr(label,
"MERGED FILE")) {
694 }
else if (strstr(label,
"DOI")) {
696 }
else if (strstr(label,
"LICENSE OF USE")) {
698 }
else if (strstr(label,
"STATION INFORMATION")) {
704 char* label = buff + 60;
706 trace(NULL, 4,
"decode_gnavh:\n");
708 if (strstr(label,
"CORR TO SYTEM TIME")) {
710 else if (strstr(label,
"LEAP SECONDS")) {
715 char* label = buff + 60;
717 trace(NULL, 4,
"decode_hnavh:\n");
719 if (strstr(label,
"CORR TO SYTEM TIME")) {
721 else if (strstr(label,
"D-UTC A0,A1,T,W,S,U")) {
723 else if (strstr(label,
"LEAP SECONDS")) {
729 char buff[
MAXRNXLEN], *label = buff + 60, ssys;
732 trace(NULL, 3,
"readrnxh:\n");
739 if (strlen(buff) <= 60) {
741 }
else if (strstr(label,
"RINEX VERSION / TYPE")) {
742 *ver = (int)(
str2num(buff, 0, 9) * 100);
743 if (*ver >= 304 && *(buff + 21) ==
'C') {
747 *type = *(buff + 20);
786 trace(NULL, 2,
"not supported satellite system: %c\n", *(buff + 40));
790 }
else if (strstr(label,
"PGM / RUN BY / DATE")) {
792 }
else if (strstr(label,
"COMMENT")) {
815 if (strstr(label,
"END OF HEADER")) {
830 trace(NULL, 4,
"decode_obsepoch: ver=%.2f\n", ver / 100.0);
833 if ((n = (
int)
str2num(buff, 29, 3)) <= 0) {
838 *flag = (int)
str2num(buff, 28, 1);
840 if (3 <= *flag && *flag <= 5) {
845 trace(NULL, 2,
"rinex obs invalid epoch: epoch=%26.26s\n", buff);
848 for (i = 0, j = 32; i < n; i++, j += 3) {
856 strncpy(satid, buff + j, 3);
861 if ((n = (
int)
str2num(buff, 32, 3)) <= 0) {
865 *flag = (int)
str2num(buff, 31, 1);
867 if (3 <= *flag && *flag <= 5) {
871 if (buff[0] !=
'>' ||
str2time(buff, 1, 28, time)) {
872 trace(NULL, 2,
"rinex obs invalid epoch: epoch=%29.29s\n", buff);
876 trace(NULL, 4,
"decode_obsepoch: time=%s flag=%d\n",
time_str(*time, 3), *flag);
881 if (snr < 0.0 || snr >= 100.0) {
882 trace(NULL, 3,
"invalid SNR value: sat=%d snr=%.3f\n", sat, snr);
885 return (uint16_t)(snr /
SNR_UNIT + 0.5);
893 int i, j, n, m, stat = 1, p[
MAXOBSTYPE], k[16], l[16];
895 trace(NULL, 4,
"decode_obsdata: ver=%.2f\n", ver / 100.0);
898 sprintf(satid,
"%.3s", buff);
902 trace(NULL, 4,
"decode_obsdata: unsupported sat sat=%s\n", satid);
904 }
else if (!(
satsys(obs->
sat, NULL) & mask)) {
934 for (i = 0, j = (ver <= 299) ? 0 : 3; i < ind->
n; i++, j += 16) {
935 if (ver <= 299 && j >= 80) {
943 lli[i] = (uint8_t)
str2num(buff, j + 14, 1) & 3;
950 for (i = 0; i < NFREQ + NEXOBS; i++) {
951 obs->
P[i] = obs->
L[i] = 0.0;
956 for (i = n = m = 0; i < ind->
n; i++) {
957 p[i] = (ver <= 211) ? ind->
idx[i] : ind->
pos[i];
959 if (ind->
type[i] == 0 && p[i] == 0) {
962 if (ind->
type[i] == 0 && p[i] == 1) {
969 if (val[k[0]] == 0.0 && val[k[1]] == 0.0) {
972 }
else if (val[k[0]] != 0.0 && val[k[1]] == 0.0) {
975 }
else if (val[k[0]] == 0.0 && val[k[1]] != 0.0) {
978 }
else if (ind->
pri[k[1]] > ind->
pri[k[0]]) {
980 p[k[0]] = NEXOBS < 1 ? -1 : NFREQ;
983 p[k[1]] = NEXOBS < 1 ? -1 : NFREQ;
987 if (val[l[0]] == 0.0 && val[l[1]] == 0.0) {
990 }
else if (val[l[0]] != 0.0 && val[l[1]] == 0.0) {
993 }
else if (val[l[0]] == 0.0 && val[l[1]] != 0.0) {
996 }
else if (ind->
pri[l[1]] > ind->
pri[l[0]]) {
998 p[l[0]] = NEXOBS < 2 ? -1 : NFREQ + 1;
1001 p[l[1]] = NEXOBS < 2 ? -1 : NFREQ + 1;
1006 for (i = 0; i < ind->
n; i++) {
1007 if (p[i] < 0 || val[i] == 0.0) {
1010 switch (ind->
type[i]) {
1012 obs->
P[p[i]] = val[i];
1016 obs->
L[p[i]] = val[i];
1017 obs->
LLI[p[i]] = lli[i];
1020 obs->
D[p[i]] = (float)val[i];
1033 for (i = 0; i < NFREQ + NEXOBS; i++) {
1034 if (data->
LLI[i] & 1) {
1042 for (i = 0; i < NFREQ + NEXOBS; i++) {
1043 if (slips[data->
sat - 1][i] & 1) {
1046 slips[data->
sat - 1][i] = 0;
1053 if (obs->
nmax <= obs->
n) {
1054 if (obs->
nmax <= 0) {
1060 trace(NULL, 1,
"addobsdata: malloc error n=%dx%d\n",
sizeof(
obsd_t), obs->
nmax);
1063 obs->
n = obs->
nmax = 0;
1066 obs->
data = obs_data;
1068 obs->
data[obs->
n++] = *data;
1076 if (!(p = strstr(opt,
"-SYS="))) {
1080 for (p += 5; *p && *p !=
' '; p++) {
1110 char str[8], *optstr =
"";
1114 for (i = n = 0; *tobs[i]; i++, n++) {
1125 optstr =
"-GL%2s=%lf";
1128 optstr =
"-RL%2s=%lf";
1131 optstr =
"-EL%2s=%lf";
1134 optstr =
"-JL%2s=%lf";
1137 optstr =
"-SL%2s=%lf";
1140 optstr =
"-CL%2s=%lf";
1143 optstr =
"-IL%2s=%lf";
1146 for (p = opt; p && (p = strchr(p,
'-')); p++) {
1147 if (sscanf(p, optstr, str, &shift) < 2) {
1150 for (i = 0; i < n; i++) {
1154 ind->
shift[i] = shift;
1155 trace(NULL, 2,
"phase shift: sys=%2d tobs=%s shift=%.3f\n", sys, tobs[i], shift);
1159 for (i = 0; i < NFREQ; i++) {
1160 for (j = 0, k = -1; j < n; j++) {
1161 if (ind->
idx[j] == i && ind->
pri[j] && (k < 0 || ind->pri[j] > ind->
pri[k])) {
1169 for (j = 0; j < n; j++) {
1170 if (ind->
code[j] == ind->
code[k]) {
1176 for (i = 0; i < NEXOBS; i++) {
1177 for (j = 0; j < n; j++) {
1178 if (ind->
code[j] && ind->
pri[j] && ind->
pos[j] < 0) {
1186 for (k = 0; k < n; k++) {
1187 if (ind->
code[k] == ind->
code[j]) {
1188 ind->
pos[k] = NFREQ + i;
1192 for (i = 0; i < n; i++) {
1193 if (!ind->
code[i] || !ind->
pri[i] || ind->
pos[i] >= 0) {
1196 trace(NULL, 4,
"reject obs type: sys=%2d, obs=%s\n", sys, tobs[i]);
1202 trace(NULL,2,
"set_index: sys=%2d,tobs=%s code=%2d pri=%2d idx=%d pos=%d shift=%5.2f\n",
1203 sys,tobs[i],ind->
code[i],ind->
pri[i],ind->
idx[i],ind->
pos[i],
1214 int i = 0, n = 0, nsat = 0, nsys =
NUMSYS, sats[
MAXOBS] = {0}, mask;
1249 if ((nsat =
decode_obsepoch(fp, buff, ver, &time, flag, sats)) <= 0) {
1252 }
else if ((*flag <= 2 || *flag == 6) && n <
MAXOBS) {
1253 data[n].
time = time;
1254 data[n].
sat = (uint8_t)sats[i - 1];
1260 }
else if (*flag == 3 || *flag == 4) {
1263 decode_obsh(fp, buff, ver, tsys, tobs, NULL, sta);
1275 uint8_t slips[
MAXSAT][NFREQ + NEXOBS] = {{0}};
1276 int i, n, flag = 0, stat = 0;
1278 trace(NULL, 4,
"readrnxobs: rcv=%d ver=%.2f tsys=%d\n", rcv, ver / 100.0, tsys);
1280 if (!obs || rcv >
MAXRCV) {
1289 while ((n =
readrnxobsb(fp, opt, ver, tsys, tobs, &flag, data, sta)) >= 0 && stat >= 0) {
1290 for (i = 0; i < n; i++) {
1300 if (n > 0 && !
screent(data[0].time, ts, te, tint)) {
1304 for (i = 0; i < n; i++) {
1308 data[i].
rcv = (uint8_t)rcv;
1311 if ((stat =
addobsdata(obs, data + i)) < 0) {
1316 trace(NULL, 4,
"readrnxobs: nobs=%d stat=%d\n", obs->
n, stat);
1327 trace(NULL, 4,
"decode_eph_cnav: ver=%.2f sat=%2d v4type=%d ndata=%d\n", ver / 100.0, sat, v4type, ndata);
1332 trace(NULL, 3,
"cnav ephemeris error: invalid satellite sat=%2d\n", sat);
1346 eph->
Adot = data[3];
1348 eph->
deln = data[5];
1353 eph->
A =
SQR(data[10]);
1354 eph->
toes = data[11];
1355 eph->
cic = data[12];
1356 eph->
OMG0 = data[13];
1357 eph->
cis = data[14];
1359 eph->
crc = data[16];
1360 eph->
omg = data[17];
1361 eph->
OMGd = data[18];
1364 eph->
idot = data[19];
1365 eph->
ndot = data[20];
1368 eph->
sva = (int)data[23];
1369 eph->
svh = (int)data[24];
1370 eph->
tgd[0] = data[25];
1373 eph->
tgd[1] = data[27];
1374 eph->
tgd[2] = data[28];
1375 eph->
tgd[3] = data[29];
1376 eph->
tgd[4] = data[30];
1378 if (v4type == 2 || v4type == 42) {
1381 eph->
week = (int)data[32];
1385 eph->
tgd[5] = data[31];
1387 eph->
week = (int)data[36];
1394 eph->
iode = (int)(eph->
toes / 300) % 256;
1405 trace(NULL, 4,
"decode_eph_bds_cnav: ver=%.2f sat=%2d v4type=%d ndata=%d\n", ver / 100.0, sat, v4type, ndata);
1410 trace(NULL, 3,
"bds cnav ephemeris error: invalid satellite sat=%2d\n", sat);
1424 eph->
Adot = data[3];
1426 eph->
deln = data[5];
1431 eph->
A =
SQR(data[10]);
1432 eph->
toes = data[11];
1433 eph->
cic = data[12];
1434 eph->
OMG0 = data[13];
1435 eph->
cis = data[14];
1437 eph->
crc = data[16];
1438 eph->
omg = data[17];
1439 eph->
OMGd = data[18];
1442 eph->
idot = data[19];
1443 eph->
ndot = data[20];
1455 eph->
sva = (int)data[27];
1456 eph->
svh = (int)data[28];
1457 eph->
tgd[1] = data[30];
1458 eph->
week = bdt_week;
1462 eph->
iode = (int)(eph->
toes / 300) % 256;
1471 eph->
sva = (int)data[31];
1472 eph->
svh = (int)data[32];
1473 eph->
tgd[2] = data[29];
1474 eph->
tgd[3] = data[30];
1476 eph->
tgd[4] = data[27];
1478 eph->
tgd[5] = data[28];
1480 eph->
iodc = (int)data[34];
1481 eph->
week = bdt_week;
1483 eph->
iode = (int)data[38];
1484 eph->
type = (v4type == 53) ? 2 : 3;
1498 trace(NULL, 4,
"decode_eph: ver=%.2f sat=%2d\n", ver / 100.0, sat);
1503 trace(NULL, 3,
"ephemeris error: invalid satellite sat=%2d\n", sat);
1515 eph->
A =
SQR(data[10]);
1518 eph->
OMG0 = data[13];
1519 eph->
omg = data[17];
1521 eph->
deln = data[5];
1522 eph->
OMGd = data[18];
1523 eph->
idot = data[19];
1524 eph->
crc = data[16];
1528 eph->
cic = data[12];
1529 eph->
cis = data[14];
1532 eph->
iode = (int)data[3];
1533 eph->
iodc = (int)data[26];
1534 eph->
toes = data[11];
1535 eph->
week = (int)data[21];
1539 eph->
code = (int)data[20];
1540 eph->
svh = (int)data[24];
1542 eph->
flag = (int)data[22];
1544 eph->
tgd[0] = data[25];
1546 eph->
fit = data[28];
1548 eph->
fit = data[28] == 0.0 ? 1.0 : 2.0;
1552 eph->
iode = (int)data[3];
1553 eph->
toes = data[11];
1554 eph->
week = (int)data[21];
1558 eph->
code = (int)data[20];
1564 eph->
svh = (int)data[24];
1573 eph->
tgd[0] = data[25];
1574 eph->
tgd[1] = data[26];
1575 eph->
type = (eph->
code & 5) ? 0 : 1;
1578 eph->
iode = (int)data[3];
1579 eph->
iodc = (int)data[28];
1580 eph->
toes = data[11];
1581 eph->
week = (int)data[21];
1587 eph->
svh = (int)data[24];
1590 eph->
tgd[0] = data[25];
1591 eph->
tgd[1] = data[26];
1592 eph->
type = (prn >= 6 && prn <= 58) ? 0 : 1;
1594 eph->
iode = (int)data[3];
1595 eph->
toes = data[11];
1596 eph->
week = (int)data[21];
1599 eph->
svh = (int)data[24];
1601 eph->
tgd[0] = data[25];
1604 if (eph->
iode < 0 || 1023 < eph->
iode) {
1605 trace(NULL, 2,
"rinex nav invalid: sat=%2d iode=%d\n", sat, eph->
iode);
1607 if (eph->
iodc < 0 || 1023 < eph->
iodc) {
1608 trace(NULL, 2,
"rinex nav invalid: sat=%2d iodc=%d\n", sat, eph->
iodc);
1619 trace(NULL, 4,
"decode_geph: ver=%.2f sat=%2d\n", ver / 100.0, sat);
1622 trace(NULL, 3,
"glonass ephemeris error: invalid satellite sat=%2d\n", sat);
1631 toc =
gpst2time(week, floor((tow + 450.0) / 900.0) * 900);
1632 dow = (int)floor(tow / 86400.0);
1635 tod = (ver <= 299) ? data[2] : fmod(data[2], 86400.0);
1636 tof =
gpst2time(week, tod + dow * 86400.0);
1643 geph->
iode = (int)(fmod(tow + 10800.0, 86400.0) / 900.0 + 0.5);
1645 geph->
taun = -data[0];
1646 geph->
gamn = data[1];
1648 geph->
pos[0] = data[3] * 1E3;
1649 geph->
pos[1] = data[7] * 1E3;
1650 geph->
pos[2] = data[11] * 1E3;
1651 geph->
vel[0] = data[4] * 1E3;
1652 geph->
vel[1] = data[8] * 1E3;
1653 geph->
vel[2] = data[12] * 1E3;
1654 geph->
acc[0] = data[5] * 1E3;
1655 geph->
acc[1] = data[9] * 1E3;
1656 geph->
acc[2] = data[13] * 1E3;
1658 geph->
svh = (int)data[6];
1659 geph->
frq = (int)data[10];
1660 geph->
age = (int)data[14];
1663 geph->
flags = (int)data[15];
1665 geph->
sva = (int)data[17];
1666 geph->
svh |= ((int)data[18]) << 1;
1669 if (geph->
frq > 128) {
1674 trace(NULL, 2,
"rinex gnav invalid freq: sat=%2d fn=%d\n", sat, geph->
frq);
1683 trace(NULL, 4,
"decode_seph: ver=%.2f sat=%2d\n", ver / 100.0, sat);
1686 trace(NULL, 3,
"geo ephemeris error: invalid satellite sat=%2d\n", sat);
1697 seph->
af0 = data[0];
1698 seph->
af1 = data[1];
1700 seph->
pos[0] = data[3] * 1E3;
1701 seph->
pos[1] = data[7] * 1E3;
1702 seph->
pos[2] = data[11] * 1E3;
1703 seph->
vel[0] = data[4] * 1E3;
1704 seph->
vel[1] = data[8] * 1E3;
1705 seph->
vel[2] = data[12] * 1E3;
1706 seph->
acc[0] = data[5] * 1E3;
1707 seph->
acc[1] = data[9] * 1E3;
1708 seph->
acc[2] = data[13] * 1E3;
1710 seph->
svh = (int)data[6];
1764 int i = 0, sat = 0, sp = 3, v4type = 0;
1766 char id[8] =
"", stotype[8] =
"";
1768 trace(NULL, 4,
"readrnxnavb: ver=%.2f sys=%d\n", ver / 100.0, sys);
1775 if (buff[0] ==
'>') {
1776 buff[7] = buff[8] =
'x';
1777 if (!strncmp(buff + 2,
"EPH Gxx LNAV", 12)) {
1779 }
else if (!strncmp(buff + 2,
"EPH Sxx SBAS", 12)) {
1781 }
else if (!strncmp(buff + 2,
"EPH Rxx FDMA", 12)) {
1783 }
else if (!strncmp(buff + 2,
"EPH Exx INAV", 12)) {
1785 }
else if (!strncmp(buff + 2,
"EPH Exx FNAV", 12)) {
1787 }
else if (!strncmp(buff + 2,
"EPH Jxx LNAV", 12)) {
1789 }
else if (!strncmp(buff + 2,
"EPH Cxx D1 ", 12)) {
1791 }
else if (!strncmp(buff + 2,
"EPH Cxx D2 ", 12)) {
1793 }
else if (!strncmp(buff + 2,
"EPH Gxx CNAV", 12)) {
1795 }
else if (!strncmp(buff + 2,
"EPH Gxx CNV2", 12)) {
1797 }
else if (!strncmp(buff + 2,
"EPH Jxx CNAV", 12)) {
1799 }
else if (!strncmp(buff + 2,
"EPH Jxx CNV2", 12)) {
1801 }
else if (!strncmp(buff + 2,
"EPH Cxx CNV1", 12)) {
1803 }
else if (!strncmp(buff + 2,
"EPH Cxx CNV2", 12)) {
1805 }
else if (!strncmp(buff + 2,
"EPH Cxx CNV3", 12)) {
1807 }
else if (!strncmp(buff + 2,
"EPH Ixx LNAV", 12)) {
1809 }
else if (!strncmp(buff + 2,
"STO Gxx LNAV", 12)) {
1811 }
else if (!strncmp(buff + 2,
"STO Rxx FDMA", 12)) {
1813 }
else if (!strncmp(buff + 2,
"STO Exx IFNV", 12)) {
1815 }
else if (!strncmp(buff + 2,
"STO Jxx LNAV", 12)) {
1817 }
else if (!strncmp(buff + 2,
"STO Cxx D1D2", 12)) {
1819 }
else if (!strncmp(buff + 2,
"STO Ixx LNAV", 12)) {
1821 }
else if (!strncmp(buff + 2,
"STO Gxx CNVX", 12)) {
1823 }
else if (!strncmp(buff + 2,
"STO Jxx CNVX", 12)) {
1825 }
else if (!strncmp(buff + 2,
"STO Cxx CNVX", 12)) {
1827 }
else if (!strncmp(buff + 2,
"ION Gxx LNAV", 12)) {
1829 }
else if (!strncmp(buff + 2,
"ION Exx IFNV", 12)) {
1831 }
else if (!strncmp(buff + 2,
"ION Jxx LNAV", 12)) {
1833 }
else if (!strncmp(buff + 2,
"ION Cxx D1D2", 12)) {
1835 }
else if (!strncmp(buff + 2,
"ION Ixx LNAV", 12)) {
1837 }
else if (!strncmp(buff + 2,
"ION Gxx CNVX", 12)) {
1839 }
else if (!strncmp(buff + 2,
"ION Jxx CNVX", 12)) {
1841 }
else if (!strncmp(buff + 2,
"ION Cxx CNVX", 12)) {
1851 }
else if (v4type < 100) {
1854 }
else if (v4type < 200) {
1855 if (!strlen(stotype)) {
1856 strncpy(stotype, buff + 24, 4);
1858 for (j = 0, p = buff + 4; j < 4; j++, p += 19) {
1863 if (!strncmp(stotype,
"GPUT", 4)) {
1864 for (j = 0; j < 4; j++) {
1868 if (!strncmp(stotype,
"GLUT", 4)) {
1871 if (!strncmp(stotype,
"GLGP", 4)) {
1874 if (!strncmp(stotype,
"GAUT", 4)) {
1875 for (j = 0; j < 4; j++) {
1879 if (!strncmp(stotype,
"QZUT", 4)) {
1880 for (j = 0; j < 4; j++) {
1884 if (!strncmp(stotype,
"BDUT", 4)) {
1885 for (j = 0; j < 4; j++) {
1889 if (!strncmp(stotype,
"IRUT", 4)) {
1890 for (j = 0; j < 4; j++) {
1894 strcpy(stotype,
"");
1899 else if (v4type < 400) {
1901 for (j = 0, p = buff + 23; j < 3; j++, p += 19) {
1902 data[i++] =
str2num(p, 0, 19);
1905 for (j = 0, p = buff + 4; j < 4; j++, p += 19) {
1906 data[i++] =
str2num(p, 0, 19);
1911 if ((v4type == 301 || v4type == 302) && i >= 8) {
1912 for (j = 0; j < 8; j++) {
1917 if ((v4type == 341 || v4type == 342) && i >= 8) {
1918 for (j = 0; j < 8; j++) {
1923 if ((v4type == 351 || v4type == 352) && i >= 8) {
1924 for (j = 0; j < 8; j++) {
1929 if (v4type == 361 && i >= 8) {
1930 for (j = 0; j < 8; j++) {
1936 if (v4type == 331 && i >= 4) {
1937 for (j = 0; j < 4; j++) {
1949 sprintf(
id,
"%.3s", buff);
1957 }
else if (
id[0] ==
'R') {
1965 prn = (int)
str2num(buff, 0, 2);
1971 }
else if (93 <= prn && prn <= 99) {
1978 if (
str2time(buff + sp, 0, 19, &toc)) {
1979 trace(NULL, 2,
"rinex nav toc error: %23.23s\n", buff);
1983 for (j = 0, p = buff + sp + 19; j < 3; j++, p += 19) {
1984 data[i++] =
str2num(p, 0, 19);
1988 for (j = 0, p = buff + sp; j < 4; j++, p += 19) {
1989 data[i++] =
str2num(p, 0, 19);
1992 if (sys ==
SYS_GLO && i >= ((ver >= 305) ? 19 : 15)) {
1993 if (!(mask & sys)) {
1998 }
else if (sys ==
SYS_SBS && i >= 15) {
1999 if (!(mask & sys)) {
2007 if (v4type == 2 || v4type == 42 || v4type == 55) {
2009 }
else if (v4type == 3 || v4type == 43 || v4type == 53 || v4type == 54) {
2012 if (i >= ndata_eph) {
2013 if (!(mask & sys)) {
2017 if (v4type == 2 || v4type == 3 || v4type == 42 || v4type == 43) {
2019 }
else if (v4type >= 53 && v4type <= 55) {
2034 if (nav->
nmax <= nav->
n) {
2037 trace(NULL, 1,
"decode_eph malloc error: n=%d\n", nav->
nmax);
2040 nav->
n = nav->
nmax = 0;
2045 nav->
eph[nav->
n++] = *eph;
2054 trace(NULL, 1,
"decode_geph malloc error: n=%d\n", nav->
ngmax);
2060 nav->
geph = nav_geph;
2062 nav->
geph[nav->
ng++] = *geph;
2071 trace(NULL, 1,
"decode_seph malloc error: n=%d\n", nav->
nsmax);
2077 nav->
seph = nav_seph;
2079 nav->
seph[nav->
ns++] = *seph;
2089 trace(NULL, 3,
"readrnxnav: ver=%.2f sys=%d\n", ver / 100.0, sys);
2096 while ((stat =
readrnxnavb(fp, opt, ver, sys, &type, &eph, &geph, &seph, nav)) >= 0) {
2116 trace(NULL, 4,
"nav n=%d, ng=%d, ns=%d\n", nav->
n, nav->
ng, nav->
ns);
2132 trace(NULL, 4,
"nav ion_gps=%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e\n", nav->
ion_gps[0],
2137 trace(NULL, 4,
"nav ion_qzs=%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e\n", nav->
ion_qzs[0],
2140 trace(NULL, 4,
"nav ion_cmp=%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e\n", nav->
ion_cmp[0],
2143 trace(NULL, 4,
"nav ion_irn=%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e,%10.3e\n", nav->
ion_irn[0],
2147 return nav->
n > 0 || nav->
ng > 0 || nav->
ns > 0;
2154 int i, j, sat, mask;
2157 trace(NULL, 3,
"readrnxclk: index=%d\n", index);
2166 while (fgets(buff,
sizeof(buff), fp)) {
2167 if (
str2time(buff, (ver >= 304 ? 13 : 8), 26, &time)) {
2168 trace(NULL, 2,
"rinex clk invalid epoch: %34.34s\n", buff);
2171 sprintf(satid,
"%.4s", buff + 3);
2174 if (strncmp(buff,
"AS", 2) || !(sat =
satid2no(satid))) {
2178 if (!(
satsys(sat, NULL) & mask)) {
2182 for (i = 0, j = (ver >= 304 ? 45 : 40); i < 2; i++, j += 20) {
2183 data[i] =
str2num(buff, j, 19);
2189 trace(NULL, 1,
"readrnxclk malloc error: nmax=%d\n", nav->
ncmax);
2195 nav->
pclk = nav_pclk;
2201 for (i = 0; i <
MAXSAT; i++) {
2203 nav->
pclk[nav->
nc - 1].
std[i][0] = 0.0f;
2206 nav->
pclk[nav->
nc - 1].
clk[sat - 1][0] = data[0];
2207 nav->
pclk[nav->
nc - 1].
std[sat - 1][0] = (float)data[1];
2217 trace(NULL, 3,
"readrnxfp: flag=%d index=%d\n", flag, index);
2220 if (!
readrnxh(fp, &ver, type, &sys, &tsys, tobs, nav, sta)) {
2225 if ((!flag && *type ==
'C') || (flag && *type !=
'C')) {
2232 return readrnxobs(fp, ts, te, tint, opt, index, ver, &tsys, tobs, obs, sta);
2246 trace(NULL, 2,
"unsupported rinex type ver=%.2f type=%c\n", ver / 100.0, *type);
2256 trace(NULL, 3,
"readrnxfile: file=%s flag=%d index=%d\n", file, flag, index);
2264 trace(NULL, 2,
"rinex file uncompact error: %s\n", file);
2267 if (!(fp = fopen(cstat ? tmpfile : file,
"r"))) {
2268 trace(NULL, 2,
"rinex file open error: %s\n", cstat ? tmpfile : file);
2272 stat =
readrnxfp(fp, ts, te, tint, opt, flag, index, type, obs, nav, sta);
2321 char type =
' ', *files[
MAXEXFILE] = {0};
2323 trace(NULL, 3,
"readrnxt: file=%s rcv=%d\n", file, rcv);
2326 return readrnxfp(stdin, ts, te, tint, opt, 0, 1, &type, obs, nav, sta);
2329 if (!(files[i] = (
char*)
malloc(1024))) {
2330 for (i--; i >= 0; i--) {
2344 for (i = 0; i < n && stat >= 0; i++) {
2345 stat =
readrnxfile(files[i], ts, te, tint, opt, 0, rcv, &type, obs, nav, sta);
2348 if (type ==
'O' && sta) {
2365 trace(NULL, 3,
"readrnx : file=%s rcv=%d\n", file, rcv);
2367 return readrnxt(file, rcv, t, t, 0.0, opt, obs, nav, sta);
2370static int cmppclk(
const void* p1,
const void* p2) {
2373 return tt < -1E-9 ? -1 : (tt > 1E-9 ? 1 : q1->
index - q2->index);
2380 trace(NULL, 3,
"combpclk: nc=%d\n", nav->
nc);
2388 for (i = 0, j = 1; j < nav->
nc; j++) {
2390 for (k = 0; k <
MAXSAT; k++) {
2391 if (nav->
pclk[j].
clk[k][0] == 0.0) {
2397 }
else if (++i < j) {
2407 trace(NULL, 1,
"combpclk malloc error nc=%d\n", nav->
nc);
2410 nav->
pclk = nav_pclk;
2413 trace(NULL, 4,
"combpclk: nc=%d\n", nav->
nc);
2423 int i, n, index = 0, stat = 1;
2426 trace(NULL, 3,
"readrnxc: file=%s\n", file);
2429 if (!(files[i] = (
char*)
malloc(1024))) {
2430 for (i--; i >= 0; i--) {
2440 for (i = 0; i < n; i++) {
2441 if (
readrnxfile(files[i], t, t, 0.0,
"", 1, index++, &type, NULL, nav, NULL)) {
2469 eph_t eph0 = {0, -1, -1};
2474 trace(NULL, 3,
"init_rnxctr:\n");
2491 for (i = 0; i < 6; i++) {
2493 rnx->
tobs[i][j][0] =
'\0';
2500 for (i = 0; i <
MAXOBS; i++) {
2503 for (i = 0; i <
MAXSAT * 2; i++) {
2506 for (i = 0; i <
NSATGLO; i++) {
2509 for (i = 0; i <
NSATSBS * 2; i++) {
2523 trace(NULL, 3,
"free_rnxctr:\n");
2546 const char* rnxtypes =
"ONGLJHC";
2548 int i, j, ver, sys, tsys;
2550 trace(NULL, 3,
"open_rnxctr:\n");
2553 if (!
readrnxh(fp, &ver, &type, &sys, &tsys, tobs, &rnx->
nav, &rnx->
sta)) {
2554 trace(NULL, 2,
"open_rnxctr: rinex header read error\n");
2557 if (!strchr(rnxtypes, type)) {
2558 trace(NULL, 2,
"open_rnxctr: not supported rinex type type=%c\n", type);
2565 for (i = 0; i <
NUMSYS; i++) {
2566 for (j = 0; j <
MAXOBSTYPE && *tobs[i][j]; j++) {
2567 strcpy(rnx->
tobs[i][j], tobs[i][j]);
2596 int n, sys, stat, flag, prn, type, set;
2598 trace(NULL, 4,
"input_rnxctr:\n");
2601 if (rnx->
type ==
'O') {
2604 return n < 0 ? -2 : 0;
2611 switch (rnx->
type) {
2630 if ((stat =
readrnxnavb(fp, rnx->
opt, rnx->
ver, sys, &type, &eph, &geph, &seph, &rnx->
nav)) <= 0) {
2631 return stat < 0 ? -2 : 0;
2635 rnx->
nav.
geph[prn - 1] = geph;
2639 }
else if (type == 2) {
2647 set = (sys ==
SYS_GAL && (eph.
code & (1 << 9))) ? 1 : 0;
2661 const char label[] =
"# / TYPES OF OBSERV";
2664 trace(NULL, 3,
"outobstype_ver2:\n");
2666 fprintf(fp,
"%6d", opt->
nobs[0]);
2668 for (i = 0; i < opt->
nobs[0]; i++) {
2669 if (i > 0 && i % 9 == 0) {
2673 fprintf(fp,
"%6s", opt->
tobs[0][i]);
2676 fprintf(fp,
"%-20s\n", label);
2679 if (opt->
nobs[0] == 0 || i % 9 > 0) {
2680 fprintf(fp,
"%*s%-20s\n", (9 - i % 9) * 6,
"", label);
2685 const char label[] =
"SYS / # / OBS TYPES";
2689 trace(NULL, 3,
"outobstype_ver3:\n");
2691 for (i = 0;
navsys[i]; i++) {
2698 for (j = 0; j < opt->
nobs[i]; j++) {
2699 if (j > 0 && j % 13 == 0) {
2703 strcpy(tobs, opt->
tobs[i][j]);
2707 if (opt->
rnxver == 302 && tobs[1] ==
'2') {
2711 fprintf(fp,
" %3s", tobs);
2714 fprintf(fp,
" %-20s\n", label);
2718 fprintf(fp,
"%*s %-20s\n", (13 - j % 13) * 4,
"", label);
2724 static const uint8_t ref_code[][10] = {
2734 const char* label =
"SYS / PHASE SHIFT";
2738 for (i = 0;
navsys[i]; i++) {
2742 for (j = 0; j < opt->
nobs[i]; j++) {
2743 if (opt->
tobs[i][j][0] !=
'L') {
2746 strcpy(obs, opt->
tobs[i][j]);
2747 for (k = 0; ref_code[i][k]; k++) {
2748 if (
obs2code(obs + 1) == ref_code[i][k]) {
2753 if (opt->
rnxver == 302 && obs[1] ==
'2') {
2757 if (ref_code[i][k]) {
2758 fprintf(fp,
"%c %3s %54s%-20s\n",
syscodes[i], obs,
"", label);
2760 fprintf(fp,
"%c %3s %8.5f%46s%-20s\n",
syscodes[i], obs, opt->
shift[i][j],
"", label);
2767 const char* label =
"GLONASS SLOT / FRQ #";
2773 if (nav->
geph[i].
sat == sat) {
2778 fcn[n++] = nav->
glo_fcn[i] - 8;
2782 for (i = j = 0; i < (n <= 0 ? 1 : (n - 1) / 8 + 1); i++) {
2784 fprintf(fp,
"%3d", n);
2788 for (k = 0; k < 8 && j < n; k++, j++) {
2789 fprintf(fp,
" R%02d %2d", prn[j], fcn[j]);
2791 fprintf(fp,
"%*s %-20s\n", (8 - k) * 7,
"", label);
2796 const char* label =
"GLONASS COD/PHS/BIS";
2797 const char* tobs[4] = {
"C1C",
"C1P",
"C2C",
"C2P"};
2800 fprintf(fp,
" %s %8.3f %s %8.3f %s %8.3f %s %8.3f%8s%-20s\n", tobs[0], opt->
glo_cp_bias[0], tobs[1],
2803 fprintf(fp,
"%*s%-20s\n", 60,
"", label);
2814 double ep[6], pos[3] = {0}, del[3] = {0};
2815 char date[32], *sys, *tsys =
"GPS";
2818 trace(NULL, 3,
"outrnxobsh:\n");
2835 sys =
"S: SBAS Payload";
2840 fprintf(fp,
"%9.2f%-11s%-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"",
"OBSERVATION DATA", sys,
2841 "RINEX VERSION / TYPE");
2842 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
2848 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
2850 fprintf(fp,
"%-60.60s%-20s\n", opt->
marker,
"MARKER NAME");
2851 fprintf(fp,
"%-20.20s%-40.40s%-20s\n", opt->
markerno,
"",
"MARKER NUMBER");
2853 if (opt->
rnxver >= 300) {
2854 fprintf(fp,
"%-20.20s%-40.40s%-20s\n", opt->
markertype,
"",
"MARKER TYPE");
2856 fprintf(fp,
"%-20.20s%-40.40s%-20s\n", opt->
name[0], opt->
name[1],
"OBSERVER / AGENCY");
2857 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
rec[0], opt->
rec[1], opt->
rec[2],
"REC # / TYPE / VERS");
2858 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
ant[0], opt->
ant[1],
"",
"ANT # / TYPE");
2860 for (i = 0; i < 3; i++) {
2861 if (fabs(opt->
apppos[i]) < 1E8) {
2865 for (i = 0; i < 3; i++) {
2866 if (fabs(opt->
antdel[i]) < 1E8) {
2870 fprintf(fp,
"%14.4f%14.4f%14.4f%-18s%-20s\n", pos[0], pos[1], pos[2],
"",
"APPROX POSITION XYZ");
2871 fprintf(fp,
"%14.4f%14.4f%14.4f%-18s%-20s\n", del[0], del[1], del[2],
"",
"ANTENNA: DELTA H/E/N");
2873 if (opt->
rnxver <= 299) {
2874 fprintf(fp,
"%6d%6d%-48s%-20s\n", 1, 1,
"",
"WAVELENGTH FACT L1/2");
2879 if (opt->
tint > 0.0) {
2880 fprintf(fp,
"%10.3f%50s%-20s\n", opt->
tint,
"",
"INTERVAL");
2883 fprintf(fp,
" %04.0f %02.0f %02.0f %02.0f %02.0f %010.7f %-12s%-20s\n", ep[0], ep[1], ep[2],
2884 ep[3], ep[4], ep[5], tsys,
"TIME OF FIRST OBS");
2887 fprintf(fp,
" %04.0f %02.0f %02.0f %02.0f %02.0f %010.7f %-12s%-20s\n", ep[0], ep[1], ep[2],
2888 ep[3], ep[4], ep[5], tsys,
"TIME OF LAST OBS");
2890 if (opt->
rnxver >= 301) {
2893 if (opt->
rnxver >= 302) {
2896 if (opt->
rnxver >= 302) {
2899 return fprintf(fp,
"%-60.60s%-20s\n",
"",
"END OF HEADER") != EOF;
2903 if (obs == 0.0 || obs <= -1E9 || obs >= 1E9) {
2906 fprintf(fp,
"%14.3f", obs);
2915static int obsindex(
int rnxver,
int sys,
const uint8_t* code,
const char* tobs,
const char* mask) {
2919 for (i = 0; i < NFREQ + NEXOBS; i++) {
2921 if (mask[code[i] - 1] ==
'0') {
2925 if (rnxver <= 299) {
2926 if (!strcmp(tobs,
"C1") &&
2931 }
else if (!strcmp(tobs,
"P1")) {
2935 }
else if (!strcmp(tobs,
"C2") && (sys ==
SYS_GPS || sys ==
SYS_QZS)) {
2939 }
else if (!strcmp(tobs,
"C2") && sys ==
SYS_GLO) {
2943 }
else if (!strcmp(tobs,
"P2")) {
2948 }
else if (rnxver >= 212 && tobs[1] ==
'A') {
2952 }
else if (rnxver >= 212 && tobs[1] ==
'B') {
2956 }
else if (rnxver >= 212 && tobs[1] ==
'C') {
2960 }
else if (rnxver >= 212 && tobs[1] ==
'D' && sys ==
SYS_GLO) {
2964 }
else if (tobs[1] ==
'2' && sys ==
SYS_CMP) {
2970 if (
id[0] == tobs[1]) {
2976 if (!strcmp(
id, tobs + 1)) {
2995 char sats[
MAXOBS][4] = {
""};
2998 trace(NULL, 3,
"outrnxobsb: n=%d\n", n);
3002 for (i = ns = 0; i < n && ns <
MAXOBS; i++) {
3003 sys =
satsys(obs[i].sat, NULL);
3007 if (!
sat2code(obs[i].sat, sats[ns])) {
3033 if (!opt->
nobs[(opt->
rnxver <= 299) ? 0 : s[ns]]) {
3042 if (opt->
rnxver <= 299) {
3043 fprintf(fp,
" %02d %02.0f %02.0f %02.0f %02.0f %010.7f %d%3d", (
int)ep[0] % 100, ep[1], ep[2], ep[3], ep[4],
3045 for (i = 0; i < ns; i++) {
3046 if (i > 0 && i % 12 == 0) {
3047 fprintf(fp,
"\n%32s",
"");
3049 fprintf(fp,
"%-3s", sats[i]);
3052 fprintf(fp,
"> %04.0f %02.0f %02.0f %02.0f %02.0f %010.7f %d%3d%21s\n", ep[0], ep[1], ep[2], ep[3], ep[4],
3053 ep[5], flag, ns,
"");
3055 for (i = 0; i < ns; i++) {
3056 sys =
satsys(obs[ind[i]].sat, NULL);
3058 if (opt->
rnxver <= 299) {
3060 mask = opt->
mask[s[i]];
3062 fprintf(fp,
"%-3s", sats[i]);
3064 mask = opt->
mask[s[i]];
3066 for (j = 0; j < opt->
nobs[m]; j++) {
3067 if (opt->
rnxver <= 299) {
3078 dL = (obs[ind[i]].
L[k] != 0.0) ? opt->
shift[m][j] : 0.0;
3081 switch (opt->
tobs[m][j][0]) {
3087 outrnxobsf(fp, obs[ind[i]].L[k] + dL, obs[ind[i]].LLI[k]);
3097 if (opt->
rnxver >= 300 && fprintf(fp,
"\n") == EOF) {
3101 if (opt->
rnxver >= 300) {
3105 return fprintf(fp,
"\n") != EOF;
3109 double e = (fabs(value) < 1E-99) ? 0.0 : floor(log10(fabs(value)) + 1.0);
3111 fprintf(fp,
" %s.%0*.0f%s%+03.0f", value < 0.0 ?
"-" :
" ", n, fabs(value) / pow(10.0, e - n),
NAVEXP, e);
3115static void out_iono_sys(FILE* fp,
const char* sys,
const double* ion,
int n) {
3116 const char *label1[] = {
"ION ALPHA",
"ION BETA"}, *label2 =
"IONOSPHERIC CORR";
3120 if (
norm(ion, n) <= 0.0) {
3124 for (i = 0; i < (n + 3) / 4; i++) {
3125 sprintf(str,
"%s%c", sys, (!*sys || n < 4) ?
' ' :
'A' + i);
3126 fprintf(fp,
"%-*s ", !*sys ? 1 : 4, str);
3127 for (j = 0; j < 4 && i * 4 + j < n; j++) {
3131 fprintf(fp,
"%*s%-20s\n", !*sys ? 10 : 7 + 12 * (4 - j),
"", !*sys ? label1[i] : label2);
3141 if (opt->
rnxver <= 211) {
3162 const char *label1 =
"TIME SYSTEM CORR", *label2 =
"DELTA-UTC: A0,A1,T,W";
3164 if (
norm(utc, 3) <= 0.0) {
3169 fprintf(fp,
"%-4s ", sys);
3172 fprintf(fp,
"%7.0f%5.0f%10s%-20s\n", utc[2], utc[3],
"", label1);
3177 fprintf(fp,
"%9.0f%9.0f %-20s\n", utc[2], utc[3], label2);
3182 double utc[8] = {0};
3189 if (opt->
rnxver <= 211) {
3218 const char* label =
"LEAP SECONDS";
3219 const double*
leaps;
3242 if (
leaps[0] == 0.0) {
3246 if (opt->
rnxver <= 300) {
3248 fprintf(fp,
"%6.0f%54s%-20s\n",
leaps[0],
"", label);
3251 fprintf(fp,
"%6.0f%18s%3s%33s%-20s\n",
leaps[0],
"", (sys ==
SYS_CMP) ?
"BDS" :
"",
"", label);
3254 (sys ==
SYS_CMP) ?
"BDS" :
"",
"", label);
3266 char date[64], *sys;
3268 trace(NULL, 3,
"outrnxnavh:\n");
3272 if (opt->
rnxver <= 299) {
3273 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GPS NAV DATA",
"",
3274 "RINEX VERSION / TYPE");
3289 sys =
"S: SBAS Payload";
3296 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA", sys,
3297 "RINEX VERSION / TYPE");
3299 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3305 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3311 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3323 char code[32], *sep;
3325 trace(NULL, 3,
"outrnxnavb: sat=%2d\n", eph->
sat);
3342 fprintf(fp,
"%-3s %04.0f %02.0f %02.0f %02.0f %02.0f %02.0f", code, ep[0], ep[1], ep[2], ep[3], ep[4], ep[5]);
3345 fprintf(fp,
"%2d %02d %02.0f %02.0f %02.0f %02.0f %04.1f", prn, (
int)ep[0] % 100, ep[1], ep[2], ep[3], ep[4],
3354 fprintf(fp,
"\n%s", sep);
3360 fprintf(fp,
"\n%s", sep);
3366 fprintf(fp,
"\n%s", sep);
3372 fprintf(fp,
"\n%s", sep);
3378 fprintf(fp,
"\n%s", sep);
3388 fprintf(fp,
"\n%s", sep);
3404 fprintf(fp,
"\n%s", sep);
3422 return fprintf(fp,
"\n") != EOF;
3435 trace(NULL, 3,
"outrnxgnavh:\n");
3439 if (opt->
rnxver <= 299) {
3440 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"GLONASS NAV DATA",
"",
3441 "RINEX VERSION / TYPE");
3443 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"R: GLONASS",
3444 "RINEX VERSION / TYPE");
3446 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3452 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3457 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3470 char code[32], *sep;
3472 trace(NULL, 3,
"outrnxgnavb: sat=%2d\n", geph->
sat);
3479 if (opt->
rnxver <= 299) {
3480 tof = fmod(tof, 86400.0);
3486 if (opt->
rnxver <= 299) {
3487 fprintf(fp,
"%2d %02d %02.0f %02.0f %02.0f %02.0f %04.1f", prn, (
int)ep[0] % 100, ep[1], ep[2], ep[3], ep[4],
3494 fprintf(fp,
"%-3s %04.0f %02.0f %02.0f %02.0f %02.0f %02.0f", code, ep[0], ep[1], ep[2], ep[3], ep[4], ep[5]);
3500 fprintf(fp,
"\n%s", sep);
3506 fprintf(fp,
"\n%s", sep);
3512 fprintf(fp,
"\n%s", sep);
3519 if (opt->
rnxver >= 305) {
3520 fprintf(fp,
"\n%s", sep);
3526 return fprintf(fp,
"\n") != EOF;
3539 trace(NULL, 3,
"outrnxhnavh:\n");
3543 if (opt->
rnxver <= 299) {
3544 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"H: GEO NAV MSG DATA",
"",
3545 "RINEX VERSION / TYPE");
3547 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"S: SBAS Payload",
3548 "RINEX VERSION / TYPE");
3550 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3556 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3561 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3573 char code[32], *sep;
3575 trace(NULL, 3,
"outrnxhnavb: sat=%2d\n", seph->
sat);
3583 if (opt->
rnxver <= 299) {
3584 fprintf(fp,
"%2d %02d %2.0f %2.0f %2.0f %2.0f %4.1f", prn - 100, (
int)ep[0] % 100, ep[1], ep[2], ep[3], ep[4],
3591 fprintf(fp,
"%-3s %04.0f %2.0f %2.0f %2.0f %2.0f %2.0f", code, ep[0], ep[1], ep[2], ep[3], ep[4], ep[5]);
3597 fprintf(fp,
"\n%s", sep);
3603 fprintf(fp,
"\n%s", sep);
3609 fprintf(fp,
"\n%s", sep);
3616 return fprintf(fp,
"\n") != EOF;
3629 trace(NULL, 3,
"outrnxlnavh:\n");
3637 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"E: Galileo",
3638 "RINEX VERSION / TYPE");
3640 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3646 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3652 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3665 trace(NULL, 3,
"outrnxqnavh:\n");
3673 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"J: QZSS",
3674 "RINEX VERSION / TYPE");
3676 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3682 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3688 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3701 trace(NULL, 3,
"outrnxcnavh:\n");
3709 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"C: BeiDou",
3710 "RINEX VERSION / TYPE");
3712 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3718 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3724 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
3737 trace(NULL, 3,
"outrnxinavh:\n");
3745 fprintf(fp,
"%9.2f %-20s%-20s%-20s\n", opt->
rnxver / 100.0,
"N: GNSS NAV DATA",
"I: IRNSS",
3746 "RINEX VERSION / TYPE");
3748 fprintf(fp,
"%-20.20s%-20.20s%-20.20s%-20s\n", opt->
prog, opt->
runby, date,
"PGM / RUN BY / DATE");
3754 fprintf(fp,
"%-60.60s%-20s\n", opt->
comment[i],
"COMMENT");
3760 return fprintf(fp,
"%60s%-20s\n",
"",
"END OF HEADER") != EOF;
uint8_t obs2code(const char *obs)
int satid2no(const char *id)
char * code2obs(uint8_t code)
static const int navsys[]
int satsys(int sat, int *prn)
double norm(const double *a, int n)
Euclidean norm of vector.
MRTKLIB Matrix Module — Matrix/vector operations and estimation.
int satno(int sys, int prn)
Convert satellite system+prn/slot number to satellite number.
int satsys_bd2(int sat, int *prn)
Distinguish BDS-2 from BDS-3.
int getcodepri(int sys, uint8_t code, const char *opt)
Get code priority for multiple codes in a frequency.
int code2freq_idx(int sys, uint8_t code)
Convert system and obs code to frequency index (obsdef-based).
int screent(gtime_t time, gtime_t ts, gtime_t te, double tint)
Screen data by time range and interval.
static void set_index(int ver, int sys, const char *opt, char tobs[MAXOBSTYPE][4], sigind_t *ind)
static int add_geph(nav_t *nav, const geph_t *geph)
int readrnxt(const char *file, int rcv, gtime_t ts, gtime_t te, double tint, const char *opt, obs_t *obs, nav_t *nav, sta_t *sta)
Read RINEX OBS and NAV files with time span.
static int set_sysmask(const char *opt)
static void outrnx_glo_fcn(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
static int decode_obsepoch(FILE *fp, char *buff, int ver, gtime_t *time, int *flag, int *sats)
static int readrnxclk(FILE *fp, const char *opt, int ver, int index, nav_t *nav)
static int add_seph(nav_t *nav, const seph_t *seph)
static void decode_navh(char *buff, nav_t *nav)
static int uraindex(double value)
static void outrnxobsf(FILE *fp, double obs, int lli)
static void outobstype_ver2(FILE *fp, const rnxopt_t *opt)
static int decode_geph(int ver, int sat, gtime_t toc, double *data, geph_t *geph)
int outrnxobsh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX observation data file header.
static void timestr_rnx(char *str)
static int readrnxh(FILE *fp, int *ver, char *type, int *sys, int *tsys, char tobs[][MAXOBSTYPE][4], nav_t *nav, sta_t *sta)
static gtime_t adjweek(gtime_t t, gtime_t t0)
static void decode_gnavh(char *buff, nav_t *nav)
static int readrnxfp(FILE *fp, gtime_t ts, gtime_t te, double tint, const char *opt, int flag, int index, char *type, obs_t *obs, nav_t *nav, sta_t *sta)
static void init_sta(sta_t *sta)
static void setstr(char *dst, const char *src, int n)
int init_rnxctr(rnxctr_t *rnx)
Initialize RINEX control struct.
static void outrnx_phase_shift(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
static int decode_eph(int ver, int sat, gtime_t toc, const double *data, eph_t *eph)
static void combpclk(nav_t *nav)
int outrnxlnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX Galileo navigation data file header.
int outrnxgnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX GLONASS navigation data file header.
static int add_eph(nav_t *nav, const eph_t *eph)
int outrnxnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX navigation data file header.
static void out_iono(FILE *fp, int sys, const rnxopt_t *opt, const nav_t *nav)
static void out_time_sys(FILE *fp, const char *sys, const double *utc)
int open_rnxctr(rnxctr_t *rnx, FILE *fp)
Open RINEX data (read header).
static void saveslips(uint8_t slips[][5+5], obsd_t *data)
static int readrnxobs(FILE *fp, gtime_t ts, gtime_t te, double tint, const char *opt, int rcv, int ver, int *tsys, char tobs[][MAXOBSTYPE][4], obs_t *obs, sta_t *sta)
static void convcode(int ver, int sys, const char *str, char *type)
static const double ura_eph[]
static int decode_obsdata(FILE *fp, char *buff, int ver, int mask, sigind_t *index, obsd_t *obs)
int outrnxqnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX QZSS navigation data file header.
static int sisa_index(double value)
static int readrnxobsb(FILE *fp, const char *opt, int ver, int *tsys, char tobs[][MAXOBSTYPE][4], int *flag, obsd_t *data, sta_t *sta)
static void restslips(uint8_t slips[][5+5], obsd_t *data)
static int obsindex(int rnxver, int sys, const uint8_t *code, const char *tobs, const char *mask)
static int decode_eph_bds_cnav(int ver, int sat, gtime_t toc, const double *data, int ndata, int v4type, eph_t *eph)
static void out_time(FILE *fp, int sys, const rnxopt_t *opt, const nav_t *nav)
static const char syscodes[]
int outrnxhnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX GEO navigation data file header.
int outrnxnavb(FILE *fp, const rnxopt_t *opt, const eph_t *eph)
Output RINEX navigation data file body.
static int readrnxnav(FILE *fp, const char *opt, int ver, int sys, nav_t *nav)
int outrnxobsb(FILE *fp, const rnxopt_t *opt, const obsd_t *obs, int n, int flag)
Output RINEX observation data body.
static void out_iono_sys(FILE *fp, const char *sys, const double *ion, int n)
int readrnxc(const char *file, nav_t *nav)
Read RINEX clock files.
int outrnxgnavb(FILE *fp, const rnxopt_t *opt, const geph_t *geph)
Output RINEX GLONASS navigation data file body.
static int sat2code(int sat, char *code)
static void outrnx_glo_bias(FILE *fp, const rnxopt_t *opt)
static int readrnxfile(const char *file, gtime_t ts, gtime_t te, double tint, const char *opt, int flag, int index, char *type, obs_t *obs, nav_t *nav, sta_t *sta)
static void outobstype_ver3(FILE *fp, const rnxopt_t *opt)
int readrnx(const char *file, int rcv, const char *opt, obs_t *obs, nav_t *nav, sta_t *sta)
Read RINEX OBS and NAV files.
static int decode_seph(int ver, int sat, gtime_t toc, double *data, seph_t *seph)
static int addobsdata(obs_t *obs, const obsd_t *data)
int input_rnxctr(rnxctr_t *rnx, FILE *fp)
Input RINEX control (read next message).
int outrnxinavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX NavIC/IRNSS navigation data file header.
static int decode_eph_cnav(int ver, int sat, gtime_t toc, const double *data, int ndata, int v4type, eph_t *eph)
static void outnavf_n(FILE *fp, double value, int n)
int outrnxcnavh(FILE *fp, const rnxopt_t *opt, const nav_t *nav)
Output RINEX BDS navigation data file header.
static double uravalue(int sva)
void free_rnxctr(rnxctr_t *rnx)
Free RINEX control struct buffers.
static double sisa_value(int sisa)
static void outnavf(FILE *fp, double value)
static const double ura_nominal[]
static gtime_t adjday(gtime_t t, gtime_t t0)
static void out_leaps(FILE *fp, int sys, const rnxopt_t *opt, const nav_t *nav)
static uint16_t snr_val(int sat, double snr)
int outrnxhnavb(FILE *fp, const rnxopt_t *opt, const seph_t *seph)
Output RINEX GEO navigation data file body.
static int cmppclk(const void *p1, const void *p2)
static int readrnxnavb(FILE *fp, const char *opt, int ver, int sys, int *type, eph_t *eph, geph_t *geph, seph_t *seph, nav_t *nav)
static void decode_hnavh(char *buff, nav_t *nav)
static void decode_obsh(FILE *fp, char *buff, int ver, int *tsys, char tobs[][MAXOBSTYPE][4], nav_t *nav, sta_t *sta)
MRTKLIB RINEX Module — RINEX file read/write types and functions.
int expath(const char *path, char *paths[], int nmax)
Expand file path with wild-card (*) in file.
int rtk_uncompress(const char *file, char *uncfile)
Uncompress file (gzip/zip/tar/Hatanaka).
double str2num(const char *s, int i, int n)
Convert substring in string to number.
MRTKLIB System Module — OS/filesystem utility functions.
gtime_t bdt2time(int week, double sec)
Convert BeiDou time week/tow to gtime_t.
gtime_t gpst2time(int week, double sec)
Convert GPS week/tow to gtime_t.
void time2epoch(gtime_t t, double *ep)
Convert gtime_t struct to calendar day/time.
gtime_t gpst2bdt(gtime_t t)
Convert GPS time to BeiDou time.
gtime_t gpst2utc(gtime_t t)
Convert GPS time to UTC considering leap seconds.
double timediff(gtime_t t1, gtime_t t2)
Compute time difference (t1 - t2).
double time2gpst(gtime_t t, int *week)
Convert gtime_t to GPS week/tow.
double time2bdt(gtime_t t, int *week)
Convert gtime_t to BeiDou time week/tow.
static double leaps[64+1][7]
Leap seconds table (y,m,d,h,m,s,utc-gpst).
gtime_t timeadd(gtime_t t, double sec)
Add seconds to gtime_t.
gtime_t bdt2gpst(gtime_t t)
Convert BeiDou time to GPS time.
char * time_str(gtime_t t, int n)
Get time string (not reentrant).
int str2time(const char *s, int i, int n, gtime_t *t)
Convert substring in string to gtime_t struct.
gtime_t utc2gpst(gtime_t t)
Convert UTC to GPS time considering leap seconds.
gtime_t timeget(void)
Get current time in UTC.
void trace(mrtk_ctx_t *ctx, int level, const char *format,...)
Output trace message.
MRTKLIB Trace Module — debug trace and logging functions.
GPS/GAL/QZS/BDS/IRN broadcast ephemeris type.
GLONASS broadcast ephemeris type.
GNSS time representation.
Observation data collection.
RINEX control struct type.
char tobs[8][MAXOBSTYPE][4]
double shift[7][MAXOBSTYPE]
char comment[MAXCOMMENT][64]
char tobs[7][MAXOBSTYPE][4]