Skip to content

Commit

Permalink
Updates and bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
hvanruys committed Sep 30, 2017
1 parent 597bf75 commit 7c474ba
Show file tree
Hide file tree
Showing 17 changed files with 1,240 additions and 214 deletions.
89 changes: 75 additions & 14 deletions core/avhrrsatellite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ void AVHRRSatellite::AddSegmentsToList(QFileInfoList fileinfolist)
segmentlistmapgeo[i].insert( strdate, hashspectrum );
}
}
// qDebug() << opts.geosatellites.at(i).shortname << " " << fileInfo.fileName() << " " << strdate << " " << strspectrum << " " << QString("%1").arg(filenbr)
// << " Total = " << opts.geosatellites.count();
//qDebug() << opts.geosatellites.at(i).shortname << " " << fileInfo.fileName() << " " << strdate << " " << strspectrum << " " << QString("%1").arg(filenbr);
}
}

Expand Down Expand Up @@ -453,6 +452,12 @@ void AVHRRSatellite::getFilenameParameters(int geosatindex, QString filename, Q
strspectrum = spectrum;
filenbr = filename.mid(opts.geosatellites.at(geosatindex).indexfilenbr, opts.geosatellites.at(geosatindex).lengthfilenbr).toInt();
strdate = filename.mid(opts.geosatellites.at(geosatindex).indexdate, opts.geosatellites.at(geosatindex).lengthdate);

if( strdate.length() == 11) //convert YYYYDDDHHmm to YYYYMMDDHHmm
{
QDate fdate = QDate(strdate.mid(0, 4).toInt(), 1, 1).addDays(strdate.mid(4, 3).toInt() - 1);
strdate = fdate.toString("yyyyMMdd") + strdate.mid(7, 4);
}
return;
}
}
Expand Down Expand Up @@ -959,7 +964,10 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 15, 2).toInt(), fileinfo.fileName().mid( 17, 2).toInt(), fileinfo.fileName().mid( 19, 2).toInt());
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
Expand All @@ -976,11 +984,12 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 24, 2).toInt(), fileinfo.fileName().mid( 26, 2).toInt(), fileinfo.fileName().mid( 28, 2).toInt());
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
// if(fileok == true)
// qDebug() << fileinfo.fileName().mid( 12, 3) << " " << fileinfo.fileName().mid( 16, 8) << " " << fileinfo.fileName().mid( 24, 6);

}
else if ((fileinfo.fileName().mid( 16, 6) == "MetopA" || fileinfo.fileName().mid( 16, 3) == "M02" ||
Expand All @@ -992,7 +1001,10 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 11, 2).toInt(), fileinfo.fileName().mid( 13, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;

Expand All @@ -1005,7 +1017,10 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 11, 2).toInt(), fileinfo.fileName().mid( 13, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;

Expand All @@ -1020,7 +1035,10 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 20, 2).toInt(), fileinfo.fileName().mid( 22, 2).toInt(), fileinfo.fileName().mid( 24, 2).toInt());
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
Expand All @@ -1032,7 +1050,10 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 22, 2).toInt(), fileinfo.fileName().mid( 24, 2).toInt(), fileinfo.fileName().mid( 26, 2).toInt());
filedate.setTime(t);
if(hoursbefore == 0)
fileok = true;
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
Expand Down Expand Up @@ -1098,7 +1119,12 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
filedate.setDate(d);
QTime t(fileinfo.fileName().mid( 54, 2).toInt(), fileinfo.fileName().mid( 56, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0 )
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
else if (fileinfo.fileName().mid( 0, 19) == "L-000-MSG3__-GOES13" && fileinfo.fileName().mid( 59, 2) == "C_" && fileinfo.isFile())
Expand All @@ -1108,6 +1134,11 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 54, 2).toInt(), fileinfo.fileName().mid( 56, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
else if (fileinfo.fileName().mid( 0, 19) == "L-000-MSG3__-GOES15" && fileinfo.fileName().mid( 59, 2) == "C_" && fileinfo.isFile())
Expand All @@ -1117,17 +1148,27 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 54, 2).toInt(), fileinfo.fileName().mid( 56, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
//0123456789012345678901234567890123456789012345678901234567890123456789012345
//OR_ABI-L1b-RadF-M4C01_G16_s20161811455312_e20161811500122_c20161811500175.nc
//OR_ABI-L1b-RadF-M3C04_G16_s20172541000360_e20172541011126_c20172541011147
else if (fileinfo.fileName().mid( 0, 6) == "OR_ABI" && fileinfo.isFile())
{
QDate d(fileinfo.fileName().mid( 27, 4).toInt(), fileinfo.fileName().mid( 33, 2).toInt(), fileinfo.fileName().mid( 31, 2).toInt());
QDate d = QDate(fileinfo.fileName().mid( 27, 4).toInt(), 1, 1).addDays(fileinfo.fileName().mid( 31, 3).toInt() - 1);
filedate.setDate(d);
QTime t(fileinfo.fileName().mid( 35, 2).toInt(), fileinfo.fileName().mid( 37, 2).toInt(), 0);
QTime t(fileinfo.fileName().mid( 34, 2).toInt(), fileinfo.fileName().mid( 36, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
//0123456789012345678901234567890123456789012345678901234567890
Expand All @@ -1139,6 +1180,11 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 22, 2).toInt(), fileinfo.fileName().mid( 24, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
else if (fileinfo.fileName().mid( 0, 14) == "Z_SATE_C_BABJ_" && fileinfo.fileName().mid( 31, 8) == "FY2G_FDI" && fileinfo.isFile()) // Data Channel 12
Expand All @@ -1148,6 +1194,11 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 22, 2).toInt(), fileinfo.fileName().mid( 24, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
//IMG_DK01B04_201510090000_001.bz2
Expand All @@ -1162,6 +1213,11 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 20, 2).toInt(), fileinfo.fileName().mid( 22, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}
//0123456789012345678901234567890123456789012345678901234567890123456789012345
Expand All @@ -1175,6 +1231,11 @@ void AVHRRSatellite::InsertToMap(QFileInfoList fileinfolist, QMap<QString, QFile
QTime t(fileinfo.fileName().mid( 54, 2).toInt(), fileinfo.fileName().mid( 56, 2).toInt(), 0);
filedate.setTime(t);
if(hoursbefore == 0)
{
if(d == seldate)
fileok = true;
}
else if(t.hour() >= 24 - hoursbefore)
fileok = true;
}

Expand Down
2 changes: 0 additions & 2 deletions core/formephem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,10 @@ void FormEphem::itemSelectedsegmentdirectory( QTreeWidgetItem *item)
if ( (*it1)->checkState(0) == Qt::Checked )
{
opts.segmentdirectorylistinc << "1";
qDebug() << "1";
}
else
{
opts.segmentdirectorylistinc << "0";
qDebug() << "0";
}
++it1;
}
Expand Down
44 changes: 33 additions & 11 deletions core/formgeostationary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,14 @@ void FormGeostationary::PopulateTreeGeo(int geoindex)
}
else if(geoindex == 8)
{
strlist << strdate.mid(0,4) + "-" + strdate.mid(4, 2) + "-" + strdate.mid(6, 2) + " " + strdate.mid(8,2) + ":" + strdate.mid(10, 2) << strspectrumlist <<
// GOES-16
// int yyyy = strdate.mid(0, 4).toInt();
// int day = strdate.mid(4, 3).toInt();
// QDate now(yyyy, 1, 1);
// QDate newnow = now.addDays(day - 1);

// strlist << strdate.mid(0,4) + "-" + QString("%1").arg(newnow.month()).rightJustified(2, '0') + "-" + QString("%1").arg(newnow.day()).rightJustified(2, '0') + " " + strdate.mid(7,2) + ":" + strdate.mid(9, 2) << strspectrumlist <<
strlist << strdate.mid(0, 4) + "-" + strdate.mid(4, 2) + "-" + strdate.mid(6, 2) + " " + strdate.mid(8, 2) + ":" + strdate.mid(10, 2) << strspectrumlist <<
QString("%1").arg(cnt_C01) << QString("%1").arg(cnt_C02) << QString("%1").arg(cnt_C03) << QString("%1").arg(cnt_C04) <<
QString("%1").arg(cnt_C05) << QString("%1").arg(cnt_C06) << QString("%1").arg(cnt_C07) << QString("%1").arg(cnt_C08) <<
QString("%1").arg(cnt_C09) << QString("%1").arg(cnt_C10) << QString("%1").arg(cnt_C11) << QString("%1").arg(cnt_C12) <<
Expand Down Expand Up @@ -1218,13 +1225,25 @@ void FormGeostationary::CreateGeoImageHDF(SegmentListGeostationary *sl, QString
{
qDebug() << QString("llVIS_IR at %1 = %2 spectrumvector = %3").arg(j).arg(llVIS_IR.at(j)).arg(spectrumvector.at(j));
}
if(llVIS_IR.count() > 0)
if(llVIS_IR.count() == 0)
{
QApplication::restoreOverrideCursor();
emit enabletoolboxbuttons(true);
return;
}
else
sl->ComposeImageHDFInThread(llVIS_IR, spectrumvector, inversevector);
}
else if(type == "HRV")
{
llHRV = this->getGeostationarySegments(geoindex, "HRV", sl->getImagePath(), spectrumvector, filepattern);
if(llHRV.count() > 0)
if(llHRV.count() == 0)
{
QApplication::restoreOverrideCursor();
emit enabletoolboxbuttons(true);
return;
}
else
sl->ComposeImageHDFInThread(llHRV, spectrumvector, inversevector);
}

Expand All @@ -1240,7 +1259,6 @@ void FormGeostationary::CreateGeoImagenetCDF(SegmentListGeostationary *sl, QStri


QString filetiming;
QString filedate;
QStringList llVIS_IR;
QString filepattern;

Expand All @@ -1253,14 +1271,15 @@ void FormGeostationary::CreateGeoImagenetCDF(SegmentListGeostationary *sl, QStri
sl->LFAC = opts.geosatellites.at(geoindex).lfac;

qDebug() << "====> tex = " << tex;

filetiming = tex.mid(0, 4) + tex.mid(8, 2) + tex.mid(5, 2);
filedate = tex.mid(0, 4) + tex.mid(5, 2) + tex.mid(8, 2);
//"2017-08-10 19:45"
QDate now(tex.mid(0, 4).toInt(), tex.mid(5, 2).toInt(), tex.mid(8, 2).toInt());
int DDD = now.dayOfYear();
filetiming = tex.mid(0, 4) + QString("%1").arg(DDD).rightJustified(3, '0') + tex.mid(13, 2) + tex.mid(16, 2);

//OR_ABI-L1b-RadF-M4C01_G16_s20161811455312_e20161811500122_c20161811500175.nc
//01234567890123456789012345678901234567890123456789
if(whichgeo == eGeoSatellite::GOES_16 && (type == "VIS_IR" || type == "VIS_IR Color"))
filepattern = QString("OR_ABI-L1b-RadF-M4???_G16_s") + filetiming + QString("*.nc");
filepattern = QString("OR_ABI-L1b-RadF-M????_G16_s") + filetiming + QString("*.nc");
else
return;

Expand All @@ -1270,11 +1289,14 @@ void FormGeostationary::CreateGeoImagenetCDF(SegmentListGeostationary *sl, QStri
{
llVIS_IR = this->getGeostationarySegments(geoindex, "VIS_IR", sl->getImagePath(), spectrumvector, filepattern);
qDebug() << QString("llVIS_IR count = %1").arg(llVIS_IR.count());
for (int j = 0; j < llVIS_IR.size(); ++j)
if(llVIS_IR.count() == 0)
{
qDebug() << QString("llVIS_IR at %1 = %2 spectrumvector = %3").arg(j).arg(llVIS_IR.at(j)).arg(spectrumvector.at(j));
QApplication::restoreOverrideCursor();
emit enabletoolboxbuttons(true);
return;
}
sl->ComposeImagenetCDFInThread(llVIS_IR, spectrumvector, inversevector);
else
sl->ComposeImagenetCDFInThread(llVIS_IR, spectrumvector, inversevector);
}
}

Expand Down
Loading

0 comments on commit 7c474ba

Please sign in to comment.