11 #define TIMEPOS sizeof("2000-01-01")
15 PGSt_scTagInfo *scTagInfo
108 static PGSt_integer ephem_files, attit_files;
111 static int initialized = 0;
113 PGSt_hdrSummary *header_array=(PGSt_hdrSummary*)
NULL;
114 PGSt_integer lendcheck;
116 PGSt_SMF_status
status = PGS_S_SUCCESS;
117 int hour, noon_time, zero_time;
120 char filefunc[] = __FILE__
", GEO_check_ea_headers";
122 if(scTagInfo ==
NULL)
128 if (initialized == 0)
130 if (PGS_EPH_getEphemHeaders(scTagInfo, &header_array, &ephem_files,
131 &lendcheck) != PGS_S_SUCCESS) {
132 modsmf(
MODIS_E_GEO,
"PGS_EPH_getEphemHeaders()", filefunc);
137 sprintf(
msg,
"%d ephemeris", ephem_files);
144 if (PGS_TD_TAItoUTC(header_array[
file].startTAI93, asciiUTC) !=
146 sprintf(
msg,
"PGS_TD_TAItoUTC(%.6f) at ephemeris start",
147 header_array[
file].startTAI93);
153 if (scTagInfo->spacecraftTag == PGSd_EOS_AM)
155 sprintf(asciiUTC+
TIMEPOS,
"%02d:00:00.000000Z", hour);
162 sprintf(asciiUTC+
TIMEPOS,
"12:00:00.000000Z");
169 if (PGS_TD_UTCtoTAI(asciiUTC, &ephem_summary[
file].startTAI93) !=
171 sprintf(
msg,
"PGS_TD_UTCtoTAI(%s) at ephemeris start", asciiUTC);
179 if (PGS_TD_TAItoUTC(header_array[
file].stopTAI93, asciiUTC) !=
181 sprintf(
msg,
"PGS_TD_TAItoUTC(%.6f) at ephemeris stop",
182 header_array[
file].stopTAI93);
188 noon_time = strcmp(asciiUTC+
TIMEPOS,
"12:00:00.000000Z");
189 zero_time = strcmp(asciiUTC+
TIMEPOS+2,
":00:00.000000Z");
191 if (scTagInfo->spacecraftTag == PGSd_EOS_AM1)
195 else if (zero_time == 0)
199 sprintf(asciiUTC+
TIMEPOS,
"%02d:00:00.000000Z", hour);
202 if (hour < 12 || noon_time == 0)
206 sprintf(asciiUTC+
TIMEPOS,
"12:00:00.000000Z");
209 if (PGS_TD_UTCtoTAI(asciiUTC, &ephem_summary[
file].stopTAI93) !=
211 sprintf(
msg,
"PGS_TD_UTCtoTAI(%s) at ephemeris stop", asciiUTC);
220 header_array = (PGSt_hdrSummary*)
NULL;
221 if (PGS_EPH_getAttitHeaders(scTagInfo, &lendcheck, &header_array,
222 &attit_files) != PGS_S_SUCCESS) {
223 modsmf(
MODIS_E_GEO,
"PGS_EPH_getAttitHeaders()", filefunc);
228 sprintf(
msg,
"%d attitude", attit_files);
235 if (PGS_TD_TAItoUTC(header_array[
file].startTAI93, asciiUTC) !=
237 sprintf(
msg,
"PGS_TD_TAItoUTC(%.6f) at attitude start",
238 header_array[
file].startTAI93);
244 sprintf(asciiUTC+
TIMEPOS,
"%02d:00:00.000000Z", hour);
251 if (PGS_TD_UTCtoTAI(asciiUTC, &attit_summary[
file].startTAI93) !=
253 sprintf(
msg,
"PGS_TD_UTCtoTAI(%s) at attitude start", asciiUTC);
261 if (PGS_TD_TAItoUTC(header_array[
file].stopTAI93, asciiUTC) !=
263 sprintf(
msg,
"PGS_TD_TAItoUTC(%.6f) at attitude stop",
264 header_array[
file].stopTAI93);
270 noon_time = strcmp(asciiUTC+
TIMEPOS,
"12:00:00.000000Z");
271 zero_time = strcmp(asciiUTC+
TIMEPOS+2,
":00:00.000000Z");
276 else if (zero_time == 0)
280 sprintf(asciiUTC+
TIMEPOS,
"%02d:00:00.000000Z", hour);
282 if (PGS_TD_UTCtoTAI(asciiUTC, &attit_summary[
file].stopTAI93) !=
284 sprintf(
msg,
"PGS_TD_UTCtoTAI(%s) at attitude stop", asciiUTC);
296 if (ephem_files < 1 || attit_files < 1)
300 if (ephem_summary[
file].startTAI93 <= in_time &&
301 in_time <= ephem_summary[
file].stopTAI93)
305 if (
file > ephem_files - 1) {
306 sprintf(
msg,
"%.6f from ephemeris files.", in_time);
312 if (attit_summary[
file].startTAI93 <= in_time &&
313 in_time <= attit_summary[
file].stopTAI93)
317 if (
file > attit_files - 1) {
318 sprintf(
msg,
"%.6f from attitude files.", in_time);