8 #define MAXMSGBUFFLEN 200
9 #define CB_VECTOR_NUMVALUES 9
12 int const scan_number,
15 MODFILE *
const geo_file,
16 PGSt_double
const rpy[],
132 float32 moon_vector[3];
133 float32 rpy_angles[3];
134 float32 sun_vector[3];
135 float32 sun_azimuth, sun_zenith;
138 PGSt_SMF_status retval = PGS_S_SUCCESS;
139 uint16 scan_id, EV_frames, SD_frames, SV_frames;
142 char filefunc[] = __FILE__
", GEO_write_scan_metadata";
179 scan_number >=
l1a_data->num_scans || cb_vectors ==
NULL ||
180 geo_file ==
NULL || rpy==
NULL || frame_quality ==
NULL )
182 sprintf(msgbuf,
"l1a_data = %p, scan_number = %i, cb_vectors = %p, "
183 "geo_file = %p, rpy = %p, frame_quality = %p",
184 (
void*)
l1a_data, scan_number, (
void*)cb_vectors, (
void*)geo_file,
185 (
void*)rpy, (
void*)frame_quality);
197 scan_metadata[obj].start[0] = (long)scan_number;
198 scan_id = (uint16)
l1a_data->frame_data[scan_number].L1A_scan_id;
199 scan_metadata[obj].data = &scan_id;
203 scan_metadata[obj].start[0] = (
long)scan_number;
204 EV_frames = (uint16)
l1a_data->frame_data[scan_number].EV_frames;
205 scan_metadata[obj].data = &EV_frames;
209 scan_metadata[obj].start[0] = (
long)scan_number;
210 SD_frames = (uint16)
l1a_data->frame_data[scan_number].SD_frames;
211 scan_metadata[obj].data = &SD_frames;
215 scan_metadata[obj].start[0] = (
long)scan_number;
216 SV_frames = (uint16)
l1a_data->frame_data[scan_number].SV_frames;
217 scan_metadata[obj].data = &SV_frames;
221 scan_metadata[obj].start[0] = (
long)scan_number;
222 scan_metadata[obj].data = &
l1a_data->frame_data[scan_number].EV_start;
226 scan_metadata[obj].start[0] = (long)scan_number;
227 scan_metadata[obj].data = &
l1a_data->frame_data[scan_number].SD_start;
231 scan_metadata[obj].start[0] = (long)scan_number;
232 scan_metadata[obj].data = &
l1a_data->frame_data[scan_number].SV_start;
236 scan_metadata[obj].start[0] = (long)scan_number;
237 scan_metadata[obj].data = &
l1a_data->frame_data[scan_number].Scan_type;
241 scan_metadata[obj].start[0] = (long)scan_number;
242 scan_metadata[obj].data = &
l1a_data->mirr_data[scan_number].mirr_side;
246 scan_metadata[obj].start[0] = (long)scan_number;
247 scan_metadata[obj].data =
248 &
l1a_data->frame_data[scan_number].L1A_scan_quality;
252 geoqual[0] = (int8)
l1a_data->mirr_data[scan_number].impulse_flag;
255 geoqual[1] =
l1a_data->frame_data[scan_number].SCI_ABNORM;
258 geoqual[2] =
l1a_data->frame_data[scan_number].SCI_STATE;
266 geoqual[3] = (int8)0;
270 geoqual[3] = (int8)1;
278 scan_metadata[obj].start[0] = (long)scan_number;
279 scan_metadata[obj].start[1] = 0
L;
280 scan_metadata[obj].data = geoqual;
286 scan_metadata[obj].start[0] = (long)scan_number;
287 scan_metadata[obj].data = &cb_vectors->
sc.
time;
291 scan_metadata[obj].start[0] = (long)scan_number;
293 scan_metadata[obj].data = &sun_zenith;
297 scan_metadata[obj].start[0] = (
long)scan_number;
299 scan_metadata[obj].data = &sun_azimuth;
303 scan_metadata[obj].start[0] = (
long)scan_number;
304 for(dim=0; dim<3; dim++)
306 scan_metadata[obj].data = &moon_vector;
310 scan_metadata[obj].start[0] = (long)scan_number;
311 scan_metadata[obj].start[1] = 0
L;
316 scan_metadata[obj].start[0] = (long)scan_number;
317 scan_metadata[obj].start[1] = 0
L;
322 scan_metadata[obj].start[0] = (long)scan_number;
323 scan_metadata[obj].start[1] = 0
L;
324 scan_metadata[obj].start[2] = 0
L;
329 scan_metadata[obj].start[0] = (long)scan_number;
330 scan_metadata[obj].start[1] = 0
L;
335 scan_metadata[obj].start[0] = (long)scan_number;
336 for(dim=0; dim<3; dim++)
338 scan_metadata[obj].data = &sun_vector;
348 scan_metadata[obj].start[0] = (long)scan_number;
349 scan_metadata[obj].data = &
l1a_data->mirr_data[scan_number].num_impulse;
352 if(
l1a_data->mirr_data[scan_number].num_impulse != 0)
356 scan_metadata[obj].start[0] = (long)scan_number;
357 scan_metadata[obj].dims[1] =
358 (long)
l1a_data->mirr_data[scan_number].num_impulse;
362 (float64)
l1a_data->mirr_data[scan_number].mirr_impulse_enc[imp];
363 scan_metadata[obj].data = &imp_enc;
366 scan_metadata[obj].start[0] = (long)scan_number;
367 scan_metadata[obj].dims[1] =
368 (long)
l1a_data->mirr_data[scan_number].num_impulse;
371 imp_time[imp] = (float64)
l1a_data->mirr_data[scan_number].
373 scan_metadata[obj].data = &imp_time;
379 scan_metadata[obj].start[0] = (long)scan_number;
380 for(dim = 0; dim < 3; dim++)
381 rpy_angles[dim] = (float32)(rpy[dim] *
383 scan_metadata[obj].data = &rpy_angles;
386 scan_metadata[obj].start[0] = (long)scan_number;
387 scan_metadata[obj].data = frame_quality +
ATT_IDX;
390 scan_metadata[obj].start[0] = (long)scan_number;
391 scan_metadata[obj].data = frame_quality +
EPH_IDX;
394 for(obj = 0; obj < (
int)(
sizeof(scan_metadata)/
sizeof(scan_metadata[0]));
397 if (scan_metadata[obj].
data)
399 if (putMODISarray(geo_file, scan_metadata[obj].
name,
401 scan_metadata[obj].dims, scan_metadata[obj].
data)
404 sprintf(msgbuf,
"putMODISarray(%.*s, %.*s)",