Go to the documentation of this file.
7 static int centerfound = 0;
12 static float lastLat = -999;
13 static float lastLon0 = -999;
14 static float lastLonN = -999;
15 static int lastScan = -1;
16 static float northern_lat = -90.0;
17 static float southern_lat = +90.0;
18 static float eastern_lon = -180.0;
19 static float western_lon = +180.0;
21 static float lat_rec[10] ={-999., -999., -999., -999., -999., -999., -999., -999., -999., -999,};
22 static int lat_rec_ptr = 0;
24 static char *
nodestr [3] = {
"Ascending",
"Descending",
"Unknown"};
25 static char *
daynightstr[4] = {
"Day",
"Night",
"Mixed",
"Unknown"};
28 if (lon1 == -999.) lon1 = lon2;
30 if (
fabs(lon1 - lon2) < 190.0)
31 return (
MIN(lon1, lon2));
33 return (
MAX(lon1, lon2));
37 if (lon1 == -999.) lon1 = lon2;
39 if (
fabs(lon1 - lon2) < 190.0)
40 return (
MAX(lon1, lon2));
42 return (
MIN(lon1, lon2));
61 meta.northern_lat = 90.0;
62 meta.southern_lat = -90.0;
63 meta.eastern_lon = 180.0;
64 meta.western_lon = -180.0;
66 meta.start_center_lon = 0.0;
67 meta.start_center_lat = 0.0;
68 meta.end_center_lon = 0.0;
69 meta.end_center_lat = 0.0;
73 static int firstCall = 1;
78 int32_t cpix =
l1rec->npix / 2;
94 if (
l1rec->iscan == lastScan)
return;
104 for (ip = 0; ip < cpix; ip++) {
110 for (ip =
l1rec->npix - 1; ip > cpix; ip--) {
126 meta.upperleft_lon =
l1rec->lon[0];
127 meta.upperright_lon =
l1rec->lon[
npix - 1];
128 meta.upperleft_lat =
l1rec->lat[0];
129 meta.upperright_lat =
l1rec->lat[
npix - 1];
130 meta.start_center_lon =
l1rec->lon[cpix];
131 meta.start_center_lat =
l1rec->lat[cpix];
133 meta.start_year = (int32_t)
year;
134 meta.start_day = (int32_t)
day;
135 meta.start_msec = (int32_t) (
msec * 1.e3);
136 meta.start_time =
l1rec->scantime;
141 if (
l1rec->lat[cpix] > lastLat)
148 ascdsc = (
l1rec->l1file->sensorID ==
CZCS) ? 1 - ascdsc : ascdsc;
159 if (
l1rec->lat[cpix] > lastLat)
165 ascdsc = (
l1rec->l1file->sensorID ==
CZCS) ? 1 - ascdsc : ascdsc;
174 meta.lowerleft_lon =
l1rec->lon[0];
175 meta.lowerright_lon =
l1rec->lon[
npix - 1];
176 meta.lowerleft_lat =
l1rec->lat[0];
177 meta.lowerright_lat =
l1rec->lat[
npix - 1];
178 meta.end_center_lon =
l1rec->lon[cpix];
179 meta.end_center_lat =
l1rec->lat[cpix];
181 meta.end_year = (int32_t)
year;
182 meta.end_day = (int32_t)
day;
183 meta.end_msec = (int32_t) (
msec * 1.e3);
184 meta.end_time =
l1rec->scantime;
187 if (
l1rec->iscan >= cscan && !centerfound) {
188 meta.scene_center_lon =
l1rec->lon[cpix];
189 meta.scene_center_lat =
l1rec->lat[cpix];
190 meta.scene_center_solz =
l1rec->solz[cpix];
191 meta.center_time =
l1rec->scantime;
197 northern_lat =
MAX(northern_lat,
l1rec->lat[ip]);
198 southern_lat =
MIN(southern_lat,
l1rec->lat[ip]);
215 if (lat_rec[lat_rec_ptr] > -100.)
216 lastLat = lat_rec[lat_rec_ptr];
218 lastLat =
l1rec->lat[cpix];
219 lat_rec[lat_rec_ptr++] =
l1rec->lat[cpix];
220 lat_rec_ptr = lat_rec_ptr % 10;
223 lastScan =
l1rec->iscan;
229 meta.northern_lat = northern_lat;
230 meta.southern_lat = southern_lat;
231 meta.eastern_lon = eastern_lon;
232 meta.western_lon = western_lon;
251 SetF32GA(ds_id,
"start_center_longitude", m->start_center_lon);
252 SetF32GA(ds_id,
"start_center_latitude", m->start_center_lat);
253 SetF32GA(ds_id,
"end_center_longitude", m->end_center_lon);
254 SetF32GA(ds_id,
"end_center_latitude", m->end_center_lat);
255 SetF32GA(ds_id,
"northernmost_latitude", m->northern_lat);
256 SetF32GA(ds_id,
"southernmost_latitude", m->southern_lat);
257 SetF32GA(ds_id,
"easternmost_longitude", m->eastern_lon);
258 SetF32GA(ds_id,
"westernmost_longitude", m->western_lon);
259 SetChrGA(ds_id,
"geospatial_lat_units",
"degrees_north");
260 SetChrGA(ds_id,
"geospatial_lon_units",
"degrees_east");
261 SetF32GA(ds_id,
"geospatial_lat_max", m->northern_lat);
262 SetF32GA(ds_id,
"geospatial_lat_min", m->southern_lat);
263 SetF32GA(ds_id,
"geospatial_lon_max", m->eastern_lon);
264 SetF32GA(ds_id,
"geospatial_lon_min", m->western_lon);
265 SetChrGA(ds_id,
"startDirection", m->start_node);
266 SetChrGA(ds_id,
"endDirection", m->end_node);
267 SetChrGA(ds_id,
"day_night_flag", m->daynight);
273 SetI16GA(ds_id,
"Start Year", m->start_year);
274 SetI16GA(ds_id,
"Start Day", m->start_day);
275 SetI32GA(ds_id,
"Start Millisec", m->start_msec);
277 SetF32GA(ds_id,
"Upper Left Longitude", m->upperleft_lon);
278 SetF32GA(ds_id,
"Upper Right Longitude", m->upperright_lon);
279 SetF32GA(ds_id,
"Upper Left Latitude", m->upperleft_lat);
280 SetF32GA(ds_id,
"Upper Right Latitude", m->upperright_lat);
282 SetF32GA(ds_id,
"Start Center Longitude", m->start_center_lon);
283 SetF32GA(ds_id,
"Start Center Latitude", m->start_center_lat);
285 SetChrGA(ds_id,
"Latitude Units",
"degrees North");
286 SetChrGA(ds_id,
"Longitude Units",
"degrees East");
289 SetF32GA(ds_id,
"Scene Center Longitude", m->scene_center_lon);
290 SetF32GA(ds_id,
"Scene Center Latitude", m->scene_center_lat);
291 SetF32GA(ds_id,
"Scene Center Solar Zenith", m->scene_center_solz);
294 SetI16GA(ds_id,
"End Year", m->end_year);
295 SetI16GA(ds_id,
"End Day", m->end_day);
296 SetI32GA(ds_id,
"End Millisec", m->end_msec);
298 SetF32GA(ds_id,
"Lower Left Longitude", m->lowerleft_lon);
299 SetF32GA(ds_id,
"Lower Right Longitude", m->lowerright_lon);
300 SetF32GA(ds_id,
"Lower Left Latitude", m->lowerleft_lat);
301 SetF32GA(ds_id,
"Lower Right Latitude", m->lowerright_lat);
303 SetF32GA(ds_id,
"End Center Longitude", m->end_center_lon);
304 SetF32GA(ds_id,
"End Center Latitude", m->end_center_lat);
306 SetF32GA(ds_id,
"Northernmost Latitude", m->northern_lat);
307 SetF32GA(ds_id,
"Southernmost Latitude", m->southern_lat);
308 SetF32GA(ds_id,
"Easternmost Longitude", m->eastern_lon);
309 SetF32GA(ds_id,
"Westernmost Longitude", m->western_lon);
311 SetChrGA(ds_id,
"Start Node", m->start_node);
312 SetChrGA(ds_id,
"End Node", m->end_node);
313 SetChrGA(ds_id,
"Day or Night", m->daynight);
int SetF32GA(idDS ds_id, const char *name, float value)
char * unix2ydhmsf(double usec, char zone)
void unix2yds(double usec, short *year, short *day, double *secs)
int SetI16GA(idDS ds_id, const char *name, int16_t value)
int SetI32GA(idDS ds_id, const char *name, int32_t value)
int SetChrGA(idDS ds_id, const char *name, const char *value)
char * unix2isodate(double dtime, char zone)
How many dimensions is the output array Default is Not sure if anything above will work correctly strcpy(l2prod->title, "no title yet")