29 #define NUM_SEARCH_POINTS 51
64 static grid_info_t* landmaskGrid = {0};
67 if (landmaskGrid !=
NULL) {
71 return ((
short)
value != 1);
83 for(
OutFile* outFile : outFiles) {
84 if(outFile == outFiles[0])
85 printf(
"%s", outFile->getFileName().c_str());
87 printf(
",%s", outFile->getFileName().c_str());
97 printf(
"resolution : %.3fm\n", outFiles[0]->getResolution());
101 printf(
"product_rgb: %s\n",
prodName.c_str());
103 printf(
"product : %s\n",
prodName.c_str());
105 printf(
"qual_prod : %s\n",
qualName.c_str());
106 printf(
"north : %8.3f\n", metaData->
north);
107 printf(
"south : %8.3f\n", metaData->
south);
108 printf(
"east : %8.3f\n", metaData->
east);
109 printf(
"west : %8.3f\n", metaData->
west);
112 printf(
"central_meridian : %8.3f\n", tmpf);
135 printf(
"percent filled pixels : %.2f%%\n",
142 static float percentPrev = 0.0;
143 static const float percentDelta = 0.01;
144 if (
want_verbose && (percentDone - percentPrev > percentDelta)) {
145 percentPrev = percentDone;
146 printf(
"\r%2d%% complete", (
int) (percentDone * 100));
154 if (centralMeridian > -900.0) {
156 while (centralMeridian < -180.0) {
157 centralMeridian += 360.0;
160 printf(
"-E- central meridian is way off\n");
165 while (centralMeridian > 180.0) {
166 centralMeridian -= 360.0;
169 printf(
"-E- central meridian is way off\n");
184 if (
s.compare(
"bin") == 0)
186 if (
s.compare(
"linear") == 0)
188 if (
s.compare(
"area") == 0)
210 bool crossed =
false;
215 if (minlon > 0 && maxlon < 0)
228 pMin.set<1>(
lat - (deltaLat / 2.0));
229 pMax.set<0>(
lon + (deltaLon / 2.0));
230 pMax.set<1>(
lat + (deltaLat / 2.0));
231 }
else if (eastwest ==
IsWest) {
232 pMin.set<0>(
lon - (deltaLon / 2.0));
233 pMin.set<1>(
lat - (deltaLat / 2.0));
235 pMax.set<1>(
lat + (deltaLat / 2.0));
237 pMin.set<0>(
lon - (deltaLon / 2.0));
238 pMin.set<1>(
lat - (deltaLat / 2.0));
239 pMax.set<0>(
lon + (deltaLon / 2.0));
240 pMax.set<1>(
lat + (deltaLat / 2.0));
242 Box_t box(pMin, pMax);
247 float deltaLon,
float fudge,
bool areaWeighted,
int eastwest =
notEastOrWest) {
253 if (!l3Bin && fudge > 1) {
274 printf(
"-E- Quality processing was requested, "
275 "but the input file does not have quality data.\n");
294 for(
OutFile* outFile : outFiles) {
308 productInfo_t *p_info;
312 if (sensorId == -1) {
313 printf(
"-E- Unknown sensor name %s\n",
319 printf(
"-E- product %s not found in XML product table\n",
331 tmpStr = p_info->description;
332 free(p_info->description);
333 tmpStr +=
" (Standard Deviation)";
334 p_info->description =
strdup(tmpStr.c_str());
335 free(p_info->palette);
337 free(p_info->dataType);
338 p_info->dataType =
strdup(
"float");
339 tmpStr = p_info->suffix;
340 free(p_info->suffix);
342 p_info->suffix =
strdup(tmpStr.c_str());
343 free(p_info->displayScale);
344 p_info->displayScale =
strdup(
"linear");
345 p_info->addOffset = 0.0;
346 p_info->scaleFactor = 1.0;
349 tmpStr = p_info->description;
350 free(p_info->description);
351 tmpStr +=
" (Variance)";
352 p_info->description =
strdup(tmpStr.c_str());
353 free(p_info->palette);
355 free(p_info->dataType);
356 p_info->dataType =
strdup(
"float");
357 tmpStr = p_info->suffix;
358 free(p_info->suffix);
360 p_info->suffix =
strdup(tmpStr.c_str());
361 free(p_info->displayScale);
362 p_info->displayScale =
strdup(
"linear");
363 p_info->addOffset = 0.0;
364 p_info->scaleFactor = 1.0;
367 tmpStr = p_info->description;
368 free(p_info->description);
369 tmpStr +=
" (number of observations)";
370 p_info->description =
strdup(tmpStr.c_str());
372 p_info->units =
strdup(
"counts");
373 free(p_info->palette);
375 free(p_info->dataType);
376 p_info->dataType =
strdup(
"short");
377 tmpStr = p_info->suffix;
378 free(p_info->suffix);
380 p_info->suffix =
strdup(tmpStr.c_str());
382 p_info->validMin = 0;
383 p_info->validMax = 32767;
384 free(p_info->displayScale);
385 p_info->displayScale =
strdup(
"linear");
388 p_info->addOffset = 0.0;
389 p_info->scaleFactor = 1.0;
392 tmpStr = p_info->description;
393 free(p_info->description);
394 tmpStr +=
" (number of scenes)";
395 p_info->description =
strdup(tmpStr.c_str());
397 p_info->units =
strdup(
"counts");
398 free(p_info->palette);
400 free(p_info->dataType);
401 p_info->dataType =
strdup(
"short");
402 tmpStr = p_info->suffix;
403 free(p_info->suffix);
404 tmpStr +=
"_nscenes";
405 p_info->suffix =
strdup(tmpStr.c_str());
407 p_info->validMin = 0;
408 p_info->validMax = 32767;
409 free(p_info->displayScale);
410 p_info->displayScale =
strdup(
"linear");
413 p_info->addOffset = 0.0;
414 p_info->scaleFactor = 1.0;
417 tmpStr = p_info->description;
418 free(p_info->description);
419 tmpStr +=
" (observation time, TAI93)";
420 p_info->description =
strdup(tmpStr.c_str());
422 p_info->units =
strdup(
"counts");
423 free(p_info->palette);
425 free(p_info->dataType);
426 p_info->dataType =
strdup(
"float");
427 tmpStr = p_info->suffix;
428 free(p_info->suffix);
429 tmpStr +=
"_obs_time";
430 p_info->suffix =
strdup(tmpStr.c_str());
434 free(p_info->displayScale);
435 p_info->displayScale =
strdup(
"linear");
438 p_info->addOffset = 0.0;
439 p_info->scaleFactor = 1.0;
442 tmpStr = p_info->description;
443 free(p_info->description);
444 tmpStr +=
" (bin ID number)";
445 p_info->description =
strdup(tmpStr.c_str());
447 p_info->units =
strdup(
"dimensionless");
448 free(p_info->palette);
450 free(p_info->dataType);
451 p_info->dataType =
strdup(
"int");
452 tmpStr = p_info->suffix;
453 free(p_info->suffix);
454 tmpStr +=
"_bin_num";
455 p_info->suffix =
strdup(tmpStr.c_str());
459 free(p_info->displayScale);
460 p_info->displayScale =
strdup(
"linear");
463 p_info->addOffset = 0.0;
464 p_info->scaleFactor = 1.0;
472 char landmaskFile[FILENAME_MAX];
474 static const char* landmaskVars[] ={
"watermask",
"landmask",
"z",
NULL};
480 cerr <<
"Error reading file " << landmaskFile <<
": "
481 << nc_strerror(
status) <<
"\n"
482 <<
"Land mask will not be applied.\n";
509 p_info->displayMin = 0.01;
510 p_info->displayMax = 0.9;
511 if (p_info->displayScale)
512 free(p_info->displayScale);
513 p_info->displayScale =
strdup(
"log");
524 if (p_info->displayScale)
525 free(p_info->displayScale);
549 int32_t numFilledPixels = 0;
552 string mapDesc =
"Bin";
553 string projName =
"Integerized Sinusoidal";
555 sprintf(metaData->
title,
"%s Level-3 %s Mapped Image",
557 for(
OutFile* outFile : outFiles) {
558 strcpy(outFile->getMetadata()->title, metaData->
title);
559 outFile->setFullLatLon(
false);
560 outFile->setMapProjection(projName);
575 if(outFiles.size() == 1)
576 outFile = outFiles[0];
578 outFile = outFiles[
i];
586 for(
OutFile* outFile : outFiles) {
587 if (!outFile->open()) {
588 printf(
"-E- Could not open ofile=\"%s\".\n",
589 outFile->getFileName().c_str());
594 if (!outFile2->
open()) {
595 printf(
"-E- Could not open ofile2=\"%s\".\n",
606 l3Row = l3File->
getRow(row);
609 endBin = baseBin + numBins;
610 if (centralMeridian < 0)
611 binNum = baseBin + numBins * (centralMeridian + 360.0) / 360.0;
613 binNum = baseBin + numBins * centralMeridian / 360.0;
617 for (col = 0; col <
start; col++) {
618 for(
OutFile* outFile : outFiles)
619 outFile->fillPixel(col);
625 for (
int i = 0;
i < numBins;
i++) {
626 l3Bin = l3Row->
getBin(binNum);
629 outFiles[0]->setPixelRGB(col, l3Bin->
getMean(0),
635 for (
size_t prod = 0; prod <
prodNameList.size(); prod++) {
662 if(outFiles.size() == 1)
663 outFiles[0]->setPixel(col,
val, prod);
665 outFiles[prod]->setPixel(col,
val, 0);
672 for(
OutFile* outFile : outFiles)
673 outFile->missingPixel(col);
679 if (binNum >= endBin)
685 for(
OutFile* outFile : outFiles)
686 outFile->fillPixel(col);
691 for(
OutFile* outFile : outFiles)
692 outFile->writeLine();
697 for(
OutFile* outFile : outFiles) {
698 outFile->setNumFilledPixels(numFilledPixels);
709 int32_t numFilledPixels = 0;
711 double resolution = outFiles[0]->getResolution();
713 string mapDesc =
"Standard";
714 string projName =
"Equidistant Cylindrical";
716 sprintf(metaData->
title,
"%s Level-3 %s Mapped Image",
726 for(
OutFile* outFile : outFiles)
737 for(
OutFile* outFile : outFiles) {
738 strcpy(outFile->getMetadata()->title, metaData->
title);
740 outFile->setMapProjection(projName);
753 if(outFiles.size() == 1)
754 outFile = outFiles[0];
756 outFile = outFiles[
i];
766 for(
OutFile* outFile : outFiles) {
767 if (!outFile->open()) {
768 printf(
"-E- Could not open ofile=\"%s\".\n",
769 outFile->getFileName().c_str());
775 if (!outFile2->
open()) {
776 printf(
"-E- Could not open ofile2=\"%s\".\n",
786 double lat = metaData->
north - (deltaLat / 2.0);
791 double lon = metaData->
west + (deltaLon / 2.0);
795 for(
OutFile* outFile : outFiles)
796 outFile->landPixel(col);
813 areaWeighted =
false;
815 l3Bin =
getBoxBins(l3File,
lat,
lon, deltaLat, deltaLon, fudge, areaWeighted);
820 printf(
"-E- interp = %s is not implemented.",
828 outFiles[0]->setPixelRGB(col, l3Bin->
getMean(0),
862 if(outFiles.size() == 1)
863 outFiles[0]->setPixel(col,
val, prod);
865 outFiles[prod]->setPixel(col,
val, 0);
871 for(
OutFile* outFile : outFiles)
872 outFile->setQuality(col, l3Bin->
getQuality());
877 for(
OutFile* outFile : outFiles)
878 outFile->missingPixel(col);
885 for(
OutFile* outFile : outFiles)
886 outFile->writeLine();
892 for(
OutFile* outFile : outFiles) {
893 outFile->setNumFilledPixels(numFilledPixels);
905 int32_t numFilledPixels = 0;
907 double resolution = outFiles[0]->getResolution();
915 string cmStr =
" +lon_0=" + to_string(centralMeridian);
924 lat0Str =
" +lat_0=" + to_string((metaData->
north + metaData->
south) / 2.0);
930 lat1Str =
" +lat_1=" + to_string(metaData->
south);
936 lat2Str =
" +lat_2=" + to_string(metaData->
north);
947 if (utmStr.find(
'S') != std::string::npos) {
949 utmStr +=
" +south" ;
958 if (strcasecmp(projectionStr,
"mollweide") == 0) {
959 mapDesc =
"Mollweide";
960 projName =
"Mollweide";
961 projStr =
"+proj=moll +ellps=WGS84 +datum=WGS84";
964 }
else if (strcasecmp(projectionStr,
"lambert") == 0) {
966 projName =
"Lambert";
967 projStr =
"+proj=lcc +ellps=WGS84 +datum=WGS84";
968 projStr += cmStr + lat0Str + lat1Str + lat2Str;
970 }
else if (strcasecmp(projectionStr,
"albersconic") == 0) {
971 mapDesc =
"Albers Equal Area Conic";
972 projName =
"Albersconic";
973 projStr =
"+proj=aea +ellps=WGS84 +datum=WGS84";
974 projStr += cmStr + lat0Str + lat1Str + lat2Str;
976 }
else if (strcasecmp(projectionStr,
"mercator") == 0) {
977 mapDesc =
"Mercator";
978 projName =
"Mercator";
979 projStr =
"+proj=merc +ellps=WGS84 +datum=WGS84";
982 }
else if (strcasecmp(projectionStr,
"tmerc") == 0) {
983 mapDesc =
"Transverse Mercator";
984 projName =
"TransverseMercator";
985 projStr =
"+proj=tmerc +ellps=WGS84 +datum=WGS84";
986 projStr += cmStr + lat0Str;
988 }
else if (strcasecmp(projectionStr,
"utm") == 0) {
989 mapDesc =
"Universal Transverse Mercator";
991 projStr =
"+proj=utm";
994 }
else if (strcasecmp(projectionStr,
"obliquemerc") == 0) {
996 printf(
"-E- lat_0 and azimuth need to be defined for obliquemerc projection");
999 mapDesc =
"Oblique Mercator";
1000 projName =
"ObliqueMercator";
1001 projStr =
"+proj=omerc +gamma=0 +k_0=1 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84";
1003 projStr +=
" +lonc=" + to_string(centralMeridian);
1006 }
else if (strcasecmp(projectionStr,
"ease2") == 0) {
1007 mapDesc =
"Ease Grid 2";
1009 projStr =
"EPSG:6933";
1011 }
else if (strcasecmp(projectionStr,
"stere") == 0) {
1013 printf(
"-E- lat_0 and lat_ts need to be defined for stere projection");
1016 mapDesc =
"Stereographic";
1017 projName =
"Stereo";
1018 projStr =
"+proj=stere "
1019 " +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
1020 projStr += cmStr + tsStr + lat0Str;
1022 }
else if (strcasecmp(projectionStr,
"conus") == 0) {
1023 mapDesc =
"USA Contiguous Albers Equal Area Conic USGS version";
1025 projStr =
"+proj=aea +lat_1=29.5 +lat_2=45.5"
1026 " +lat_0=23.0 +lon_0=-96 +x_0=0 +y_0=0"
1027 " +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
1029 }
else if (strcasecmp(projectionStr,
"alaska") == 0) {
1030 mapDesc =
"Alaska Albers Equal Area Conic USGS version";
1031 projName =
"Alaska";
1032 projStr =
"EPSG:3338";
1034 }
else if (strcasecmp(projectionStr,
"gibs") == 0) {
1035 if (((metaData->
north + metaData->
south) / 2.) > 60.) {
1036 mapDesc =
"Stereographic";
1037 projName =
"GIBS Stereo";
1038 projStr =
"EPSG:3413";
1040 }
else if (((metaData->
north + metaData->
south) / 2.) < -60.) {
1041 mapDesc =
"Stereographic";
1042 projName =
"GIBS Stereo";
1043 projStr =
"EPSG:3031";
1046 mapDesc =
"Equidistant Cylindrical";
1047 projName =
"PlateCarree";
1048 projStr =
"+proj=eqc"
1049 " +lat_ts=0 +lat_0=0 +x_0=0 +y_0=0"
1050 " +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
1054 }
else if (strcasecmp(projectionStr,
"platecarree") == 0) {
1055 mapDesc =
"Equidistant Cylindrical";
1056 projName =
"PlateCarree";
1057 projStr =
"+proj=eqc"
1058 " +lat_ts=0 +lat_0=0 +x_0=0 +y_0=0"
1059 " +ellps=WGS84 +datum=WGS84 +units=m +no_defs";
1064 projName = projectionStr;
1065 projStr = projectionStr;
1069 sprintf(metaData->
title,
"%s Level-3 %s Mapped Image",
1071 for(
OutFile* outFile : outFiles) {
1072 strcpy(outFile->getMetadata()->title, metaData->
title);
1073 outFile->setMapProjection(projName);
1087 pj = proj_create_crs_to_crs(PJ_DEFAULT_CTX,
1088 "+proj=longlat +ellps=WGS84 +datum=WGS84",
1092 printf(
"Error - l3mapgen first PROJ projection failed to init\n");
1095 pj_new = proj_normalize_for_visualization(PJ_DEFAULT_CTX, pj);
1096 if(pj_new ==
NULL) {
1097 printf(
"Error - l3mapgen visualization PROJ projection failed to init\n");
1106 c.xyzt.t = HUGE_VAL;
1109 double minX = limitMax;
1110 double minY = limitMax;
1111 double maxX = limitMin;
1112 double maxY = limitMin;
1116 double deltaLat = (metaData->
north - metaData->
south)
1128 c_out = proj_trans(pj_new, PJ_FWD,
c);
1132 if (isnormal(
x) && isnormal(
y)) {
1133 if (x < limitMax && x > limitMin) {
1139 if (y < limitMax && y > limitMin) {
1158 for(
OutFile* outFile : outFiles)
1166 for(
OutFile* outFile : outFiles)
1171 for(
OutFile* outFile : outFiles) {
1172 outFile->setProj4Info(projStr, minX, maxY);
1182 if(outFiles.size() == 1)
1183 outFile = outFiles[0];
1185 outFile = outFiles[
i];
1195 for(
OutFile* outFile : outFiles) {
1196 if (!outFile->open()) {
1197 printf(
"-E- Could not open ofile=\"%s\".\n",
1198 outFile->getFileName().c_str());
1204 if (!outFile2->
open()) {
1205 printf(
"-E- Could not open ofile2=\"%s\".\n",
1233 c_out = proj_trans(pj_new, PJ_INV,
c);
1234 tmpX[col] = c_out.xy.x;
1235 tmpY[col] = c_out.xy.y;
1237 if(!isfinite(tmpX[col]) || !isfinite(tmpY[col])) {
1254 Box_t box(pMin, pMax);
1256 for (startPoint =
imageWidth / 2; startPoint >= 0; startPoint--) {
1260 lat = tmpY[startPoint];
1261 if (isnormal(
lon) && isnormal(
lat)) {
1264 if (!boost::geometry::within(
pixel, box)) {
1267 inBox[startPoint] =
true;
1276 lat = tmpY[endPoint];
1277 if (isnormal(
lon) && isnormal(
lat)) {
1280 if (!boost::geometry::within(
pixel, box)) {
1283 inBox[endPoint] =
true;
1294 if (col < startPoint || col > endPoint) {
1295 for(
OutFile* outFile : outFiles)
1296 outFile->fillPixel(col);
1299 }
else if (!isnormal(
lon) || !isnormal(
lat)) {
1300 for(
OutFile* outFile : outFiles)
1301 outFile->fillPixel(col);
1304 }
else if (
trimNSEW && inBox[col] ==
false) {
1305 for(
OutFile* outFile : outFiles)
1306 outFile->fillPixel(col);
1310 for(
OutFile* outFile : outFiles)
1311 outFile->landPixel(col);
1326 areaWeighted =
true;
1328 areaWeighted =
false;
1341 l3Bin =
getBoxBins(l3File,
lat,
lon, deltaLat, deltaLon, fudge, areaWeighted);
1346 printf(
"-E- interp = %s is not implemented.",
1354 outFiles[0]->setPixelRGB(col, l3Bin->
getMean(0),
1388 if(outFiles.size() == 1)
1389 outFiles[0]->setPixel(col,
val, prod);
1391 outFiles[prod]->setPixel(col,
val, 0);
1397 for(
OutFile* outFile : outFiles)
1398 outFile->setQuality(col, l3Bin->
getQuality());
1403 for(
OutFile* outFile : outFiles)
1404 outFile->missingPixel(col);
1410 for(
OutFile* outFile : outFiles) {
1411 outFile->setLatLon(tmpY,tmpX);
1412 outFile->writeLine();
1425 proj_destroy(pj_new);
1427 for(
OutFile* outFile : outFiles) {
1429 string projtxtfilename;
1430 projtxtfilename = outFile->getFileName();
1431 projtxtfilename +=
".projtxt";
1432 ofstream projtxtfile (projtxtfilename);
1433 if (projtxtfile.is_open())
1435 projtxtfile <<
"# Projection information for " << outFile->getFileName() <<
"\n";
1436 projtxtfile <<
"proj=" << projStr <<
"\n";
1437 projtxtfile <<
"minX=" << std::setprecision(11) << minX <<
"\n";
1438 projtxtfile <<
"maxX=" << std::setprecision(11) << maxX <<
"\n";
1439 projtxtfile <<
"minY=" << std::setprecision(11) << minY <<
"\n";
1440 projtxtfile <<
"maxY=" << std::setprecision(11) << maxY <<
"\n";
1441 projtxtfile <<
"north=" << std::setprecision(11) << metaData->
north <<
"\n";
1442 projtxtfile <<
"south=" << std::setprecision(11) << metaData->
south <<
"\n";
1443 projtxtfile <<
"east=" << std::setprecision(11) << metaData->
east <<
"\n";
1444 projtxtfile <<
"west=" << std::setprecision(11) << metaData->
west <<
"\n";
1446 projtxtfile <<
"scale_type=" << outFile->getScaleTypeString() <<
"\n";
1447 projtxtfile <<
"datamin=" << std::setprecision(11) << outFile->getMinValue() <<
"\n";
1448 projtxtfile <<
"datamax=" << std::setprecision(11) << outFile->getMaxValue() <<
"\n";
1450 projtxtfile.close();
1454 outFile->setNumFilledPixels(numFilledPixels);
1468 if (oformatStr2 ==
NULL) {
1469 printf(
"-E- Unknown output file format \"%s\"\n", oformatStr);
1473 string oformat = oformatStr2;
1474 if (oformat.compare(
"PPM") == 0) {
1484 }
else if (oformat.compare(
"PNG") == 0) {
1490 }
else if (oformat.compare(
"TIFF") == 0) {
1500 }
else if (oformat.compare(
"HDF4") == 0) {
1502 }
else if (oformat.compare(
"netCDF4") == 0) {
1505 printf(
"-E- Output file type %s not implemented\n", oformat.c_str());
1515 vector<OutFile*> outFiles;
1521 if (oformatStr.compare(
"netCDF4") == 0 ||
1526 outFiles.push_back(outFile);
1528 size_t pos = originalOfile.find(tag);
1529 if(
pos == string::npos) {
1530 printf(
"Error: ofile_product_tag=%s, not found in ofile=%s\n",
1531 tag.c_str(), originalOfile.c_str());
1532 printf(
" and you asked for multiple products with image oformat\n");
1537 string newName = originalOfile;
1542 outFiles.push_back(outFile);
1559 vector<OutFile*> outFiles;
1566 char softwareVersion[200];
1589 if (!l3File->
open(ifileName)) {
1594 if (!l3File->
open(ifileName)) {
1595 printf(
"-E- Could not open ifile=\"%s\".\n", ifileName);
1615 if (tmpName !=
"qual_l3") {
1627 string cleanProdName;
1628 vector<string>
parts;
1631 cleanProdName +=
",";
1633 if (
parts.size() == 1) {
1634 cleanProdName +=
parts[0];
1636 }
else if (
parts.size() == 2) {
1638 cleanProdName +=
parts[0];
1639 if (
parts[1].compare(
"avg") == 0)
1641 else if (
parts[1].compare(
"stdev") == 0)
1643 else if (
parts[1].compare(
"var") == 0)
1645 else if (
parts[1].compare(
"nobs") == 0)
1647 else if (
parts[1].compare(
"nscenes") == 0)
1649 else if (
parts[1].compare(
"obs_time") == 0)
1651 else if (
parts[1].compare(
"bin_num") == 0)
1654 printf(
"-E- measurement type \"%s\" "
1655 "not understood for product \"%s\".\n",
1660 printf(
"-E- product name not understood \"%s\".\n",
1667 printf(
"-E- Could not find product=\"%s\" in file=\"%s\".\n",
1668 cleanProdName.c_str(), ifileName);
1689 res = outFiles[0]->getResolution();
1693 outFiles[0]->setResolution(
"9km");
1694 res = outFiles[0]->getResolution();
1698 for(
OutFile* outFile : outFiles) {
1699 outFile->setResolution(
res);
1715 printf(
"-E- north and south metadata are equal.\n");
1718 if (metaData.
east == metaData.
west) {
1719 printf(
"-E- east and west metadata are equal.\n");
1724 if ((strcmp(projectionStr,
"smi") == 0)
1725 || (strcmp(projectionStr,
"raw") == 0)) {
1726 metaData.
north = 90.0;
1727 metaData.
south = -90.0;
1728 metaData.
east = 180.0;
1729 metaData.
west = -180.0;
1733 if (tmpf > -900.0) {
1734 metaData.
north = tmpf;
1737 if (tmpf > -900.0) {
1738 metaData.
south = tmpf;
1741 if (tmpf > -900.0) {
1742 metaData.
east = tmpf;
1745 if (tmpf > -900.0) {
1746 metaData.
west = tmpf;
1750 printf(
"-E- north must be greater than south.\n");
1755 printf(
"-E- height in degrees must be less than or equal to 180.\n");
1765 printf(
"-E- width in degrees must be less than or equal to 360.\n");
1772 if ((tmpStr = strrchr(ifileName,
'/')) !=
NULL)
1778 for (
i = 0;
i < argc;
i++) {
1787 for (
int i = 0;
i < numOptions;
i++) {
1790 if (strcmp(option->
key,
"help") == 0)
1792 if (strcmp(option->
key,
"version") == 0)
1794 if (strstr(option->
key,
"dump_options"))
1811 for(
OutFile* outFile : outFiles) {
1812 outFile->setMetaData(&metaData);
1822 if (strcasecmp(projectionStr,
"raw") == 0) {
1824 }
else if (strcasecmp(projectionStr,
"smi") == 0) {
1831 if (outFiles[0]->getNumFilledPixels() == 0) {
1832 printf(
"\nThere are no filled pixels\n");
1833 printf(
"Deleting output file.\n");
1836 for(
OutFile* outFile : outFiles) {
1838 cmd += outFile->getFileName();
1839 system(
cmd.c_str());
1845 system(
cmd.c_str());
1852 if (threshold > 0.0) {
1853 if (outFiles[0]->getPercentFilledPixels() < threshold) {
1854 printf(
"\nPercent filled pixels (%.1f) "
1855 "is below the threshold (%.1f)\n",
1856 outFiles[0]->getPercentFilledPixels(), threshold);
1857 printf(
"Deleting output file.\n");
1860 for(
OutFile* outFile : outFiles) {
1862 cmd += outFile->getFileName();
1863 system(
cmd.c_str());
1869 system(
cmd.c_str());
1877 for(
OutFile* outFile : outFiles) {