8 MODFILE *
const geo_file,
12 double terrain_frame_position[][
MAX_FRAMES][3],
171 int obj,
pixel, scanline, frame;
172 int objs = 0, ier, N_samp, EV_frames;
173 PGSt_SMF_status ret_val = PGS_S_SUCCESS;
182 static long int start[2] = {0
L};
183 static long int hires_start[2] ;
184 static long int hires_dims[2];
192 char msgbuf[PGS_SMF_MAX_MSGBUF_SIZE];
193 char filefunc[] = __FILE__
", GEO_write_scan_data";
200 } Scan_metadata[] = {
217 if (geo_file ==
NULL || swath_elem ==
NULL ||
218 GEO_param ==
NULL || terrain_frame_position ==
NULL ||
219 frame_to_sensor ==
NULL || frame_solar_angles ==
NULL ||
220 frame_flags ==
NULL || frame_landsea ==
NULL ||
221 frame_waterpresent ==
NULL || hires_offsets ==
NULL ||
224 sprintf(msgbuf,
"swath_elem = %p, geo_file = %p, scan_number = %d\n"
225 "\tterrain_frame_position = %p, frame_to_sensor = %p\n"
226 "\tframe_solar_angles = %p, frame_flags = %p frame_landsea=%p\n"
227 "\frame_waterpresent = %p, thires_offsets = %p",
228 (
void*)swath_elem, (
void *)geo_file, scan_number,
229 (
void*)terrain_frame_position, (
void*)frame_to_sensor,
230 (
void*)frame_solar_angles, (
void*)frame_flags, (
void*)frame_landsea,
231 (
void*)frame_waterpresent, (
void*)hires_offsets);
237 if (N_samp < 1 || N_samp > 4 || swath_elem->
num_frames < 0
241 sprintf(msgbuf,
"N_samp=%d, num_frames = %d, num_detectors = %d\n",
248 return PGS_S_SUCCESS;
256 memcpy(&gflags[EV_frames*scanline], frame_flags[scanline], EV_frames);
257 for(frame = 0; frame < EV_frames; frame++)
259 pixel = EV_frames*scanline+frame;
262 height[
pixel] = (
int16)floor(terrain_frame_position[scanline][frame][
HT_IDX]+0.5);
263 landsea[
pixel] = frame_landsea[scanline][frame];
264 waterpresent[
pixel] = frame_waterpresent[scanline][frame];
303 Scan_metadata[objs].data = latit;
308 Scan_metadata[objs].data = longit;
313 Scan_metadata[objs].data = height;
318 Scan_metadata[objs].data = sensorazim;
323 Scan_metadata[objs].data = sensorzen;
328 Scan_metadata[objs].data = solarazim;
333 Scan_metadata[objs].data = solarzen;
338 Scan_metadata[objs].data =
range;
343 Scan_metadata[objs].data = landsea;
344 Scan_metadata[objs+1].data = waterpresent;
348 Scan_metadata[objs].data = gflags;
352 hires_start[0] =
start[0] * N_samp;
354 hires_dims[1] = dims[1] * N_samp;
355 for(scanline = 0; scanline < hires_dims[0]; scanline++){
356 memcpy(&scan_offset[scanline*hires_dims[1]],
357 &hires_offsets[0][scanline], hires_dims[1]);
358 memcpy(&track_offset[scanline*hires_dims[1]],
359 &hires_offsets[1][scanline], hires_dims[1]);
360 memcpy(&height_offset[scanline*hires_dims[1]],
361 &hires_offsets[2][scanline], hires_dims[1]);
363 Scan_metadata[objs].data = scan_offset;
365 Scan_metadata[objs].data = track_offset;
367 Scan_metadata[objs].data = height_offset;
371 for (obj = 0; obj < objs; obj++){
372 if (Scan_metadata[obj].
data !=
NULL) {
373 ier = putMODISarray(geo_file, Scan_metadata[obj].
name,
SCAN_GRP,
374 Scan_metadata[obj].
start, Scan_metadata[obj].dims,
375 Scan_metadata[obj].
data);
377 sprintf(msgbuf,
"putMODISarray(%s, %s)", geo_file->filename,
378 Scan_metadata[obj].name);