12 #define RTRN_ERROR 255
13 #define RTRN_SUCCEED 0
17 PGSt_ephemHeader header;
18 char *ptr, *ptr1, *ptr2, *ptr3, *ptr4;
20 int16_t
year, month,
day, hour, minute, second;
22 double secTAI93 = 725846400.;
25 static char shortname[8];
30 fprintf(
stdout,
"shortname=%s\n", shortname);
31 fprintf(
stdout,
"localgranuleid=%s\n", buf);
33 if ((ephemFilePtr = fopen(buf,
"r")) ==
NULL) {
34 fprintf(
stderr,
"Error opening Ephemeris file\n");
37 fread(&header,
sizeof (PGSt_ephemHeader), 1, ephemFilePtr);
41 ptr = (
char *) (&header.startTime);
42 ll =
sizeof (PGSt_double);
45 ptr1 = (
char *) (&header.endTime);
46 ll1 =
sizeof (PGSt_double);
49 ptr2 = (
char *) (&header.interval);
50 for (n = 0; n < 6; n++, ptr2 += 4)
byteswap(ptr2, 4);
52 ptr3 = (
char *) (&header.keplerElements);
53 for (m = 0; m < 7; m++, ptr3 += 8)
byteswap(ptr3, 8);
55 ptr4 = (
char *) (&header.qaParameters);
56 for (
q = 0;
q < 20;
q++, ptr4 += 4)
byteswap(ptr4, 4);
60 fprintf(
stdout,
"rangebeginningdate=%4d-%02d-%02d\n",
year, month,
day);
62 hour = (
int) (24. * (secs / 86400.));
63 minute = (
int) ((secs - 3600. * (
double) hour) / 60.);
64 second = (
int) ((secs - 3600. * (
double) hour - (
double) minute * 60.));
65 double fsec = 1000000. * (secs - 3600. * (
double) hour - (
double) minute * 60. -
68 fprintf(
stdout,
"rangebeginningtime=%02d:%02d:%02d.%d\n", hour, minute, second, (
int) fsec);
72 fprintf(
stdout,
"rangeendingdate=%4d-%02d-%02d\n",
year, month,
day);
74 hour = (
int) (24. * (secs / 86400.));
75 minute = (
int) ((secs - 3600. * (
double) hour) / 60.);
76 second = (
int) ((secs - 3600. * (
double) hour - (
double) minute * 60.));
77 fsec = 1000000. * (secs - 3600. * (
double) hour - (
double) minute * 60. -
80 fprintf(
stdout,
"rangeendingtime=%02d:%02d:%02d.%d\n", hour, minute, second, (
int) fsec);
81 fprintf(
stdout,
"percentMissingData=%lf\n", header.qaStatistics[1]);
88 PGSt_attitHeader header;
89 char *ptr, *ptr1, *ptr2;
92 int16_t
year, month,
day, hour, minute, second;
94 double secTAI93 = 725846400.;
95 static char shortname[8];
100 fprintf(
stdout,
"shortname=%s\n", shortname);
101 fprintf(
stdout,
"localgranuleid=%s\n", buf);
103 if ((attitFilePtr = fopen(buf,
"r")) ==
NULL) {
104 fprintf(
stderr,
"Error opening Attitude file\n");
107 fread(&header,
sizeof (PGSt_attitHeader), 1, attitFilePtr);
108 fclose(attitFilePtr);
110 ptr = (
char *) (&header.startTime);
111 ll =
sizeof (PGSt_double);
114 ptr1 = (
char *) (&header.endTime);
115 ll1 =
sizeof (PGSt_double);
118 ptr2 = (
char *) (&header.interval);
119 for (n = 0; n < 26; n++, ptr2 += 4)
byteswap(ptr2, 4);
123 fprintf(
stdout,
"rangebeginningdate=%4d-%02d-%02d\n",
year, month,
day);
125 hour = (
int) (24. * (secs / 86400.));
126 minute = (
int) ((secs - 3600. * (
double) hour) / 60.);
127 second = (
int) ((secs - 3600. * (
double) hour - (
double) minute * 60.));
128 double fsec = 1000000. * (secs - 3600. * (
double) hour - (
double) minute * 60. -
131 fprintf(
stdout,
"rangebeginningtime=%02d:%02d:%02d.%d\n", hour, minute, second, (
int) fsec);
135 fprintf(
stdout,
"rangeendingdate=%4d-%02d-%02d\n",
year, month,
day);
137 hour = (
int) (24. * (secs / 86400.));
138 minute = (
int) ((secs - 3600. * (
double) hour) / 60.);
139 second = (
int) ((secs - 3600. * (
double) hour - (
double) minute * 60.));
140 fsec = 1000000. * (secs - 3600. * (
double) hour - (
double) minute * 60. -
143 fprintf(
stdout,
"rangeendingtime=%02d:%02d:%02d.%d\n", hour, minute, second, (
int) fsec);
144 fprintf(
stdout,
"percentMissingData=%lf\n", header.qaStatistics[1]);
149 int main(
int argc,
char *argv[]) {
155 attephfile = argv[1];
157 if (strstr(attephfile,
"ATT")) {
163 printf(
"Usage: %s atteph-file\n", argv[0]);