From 7c622c9313cdadd2fd8ce136e8f6ef851e837600 Mon Sep 17 00:00:00 2001 From: lauracosta Date: Fri, 2 Feb 2024 16:17:29 +0100 Subject: [PATCH] check ValidYears --- homogeneityWidget/homogeneityWidget.cpp | 74 +++++++++++++++++-------- homogeneityWidget/homogeneityWidget.h | 2 - 2 files changed, 52 insertions(+), 24 deletions(-) diff --git a/homogeneityWidget/homogeneityWidget.cpp b/homogeneityWidget/homogeneityWidget.cpp index bf8e7fc5a..cf5f8e64e 100644 --- a/homogeneityWidget/homogeneityWidget.cpp +++ b/homogeneityWidget/homogeneityWidget.cpp @@ -351,16 +351,19 @@ void Crit3DHomogeneityWidget::plotAnnualSeries() meteoPointTemp.nrObsDataDaysD = 0; bool dataAlreadyLoaded = false; int validYears = 0; - if (vectorYears.empty()) - { - validYears = computeAnnualSeriesOnPointFromDaily(&myError, meteoPointsDbHandler, nullptr, - &meteoPointTemp, &clima, false, isAnomaly, meteoSettings, myAnnualSeries, vectorYears, dataAlreadyLoaded); + std::vector vectorYears; + validYears = computeAnnualSeriesOnPointFromDaily(&myError, meteoPointsDbHandler, nullptr, + &meteoPointTemp, &clima, false, isAnomaly, meteoSettings, myAnnualSeries, vectorYears, dataAlreadyLoaded); - yearsMissing = false; - if (vectorYears[vectorYears.size()-1] - vectorYears[0] + 1 != vectorYears.size()-1) - { - yearsMissing = true; - } + if (validYears == 0) + { + myAnnualSeries.clear(); + return; + } + bool yearsMissing = false; + if (vectorYears[vectorYears.size()-1] - vectorYears[0] + 1 != vectorYears.size()-1) + { + yearsMissing = true; } QDate endDate(QDate(lastYear, 12, 31)); @@ -370,26 +373,52 @@ void Crit3DHomogeneityWidget::plotAnnualSeries() if (idPointsJointed.size() != 1 && (lastDateCopyed < lastDate || yearsMissing)) { // mancano dei dati, controllare joint stations - for (int i = 1; igetLastDate(daily, idPointsJointed[i]).date(); - if (lastDateNew > lastDateCopyed) + std::vector vectorMissing; + int posMissing, n; + for (int y = 0; ygetLastDate(daily, idPointsJointed[i]).date(); + if (lastDateNew > lastDateCopyed) { - setMpValues(meteoPointsNearDistanceList[indexMp], &meteoPointTemp, myDate, myVar, meteoSettings); + int indexMp; + for (int j = 0; jdraw(years, seriesToView); + return; } else { diff --git a/homogeneityWidget/homogeneityWidget.h b/homogeneityWidget/homogeneityWidget.h index 45ff744ac..4d6915119 100644 --- a/homogeneityWidget/homogeneityWidget.h +++ b/homogeneityWidget/homogeneityWidget.h @@ -49,8 +49,6 @@ QDate firstDaily; QDate lastDaily; std::vector myAnnualSeries; - std::vector vectorYears; - bool yearsMissing; QList sortedId; std::vector distanceId; QMap mapNameId;