Skip to content

Commit

Permalink
Merge commit '013f367a0f9fc6842830f0f76e525b6d83ae0008'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Jan 2, 2025
2 parents ac11734 + 013f367 commit 5e62063
Show file tree
Hide file tree
Showing 19 changed files with 999 additions and 585 deletions.
558 changes: 295 additions & 263 deletions agrolib/climate/climate.cpp

Large diffs are not rendered by default.

39 changes: 24 additions & 15 deletions agrolib/climate/climate.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@
{ "correctedDegreeDaysSum", 1 }
};

bool elaborationOnPoint(QString *myError, Crit3DMeteoPointsDbHandler* meteoPointsDbHandler, Crit3DMeteoGridDbHandler* meteoGridDbHandler,
Crit3DMeteoPoint* meteoPointTemp, Crit3DClimate* clima, bool isMeteoGrid, QDate startDate, QDate endDate, bool isAnomaly, Crit3DMeteoSettings *meteoSettings, bool dataAlreadyLoaded);
bool elaborationOnPoint(QString *myError, Crit3DMeteoPointsDbHandler* meteoPointsDbHandler,
Crit3DMeteoGridDbHandler* meteoGridDbHandler, Crit3DMeteoPoint* meteoPointTemp,
Crit3DClimate* clima, bool isMeteoGrid, QDate startDate, QDate endDate,
bool isAnomaly, Crit3DMeteoSettings *meteoSettings, bool dataAlreadyLoaded);

bool elaborationOnPointHourly(Crit3DMeteoPointsDbHandler* meteoPointsDbHandler,
Crit3DMeteoGridDbHandler* meteoGridDbHandler, Crit3DMeteoPoint* meteoPointTemp,
bool isMeteoGrid, Crit3DClimate* climate, Crit3DMeteoSettings* meteoSettings, QString &myError);

frequencyType getAggregationFrequency(meteoVariable myVar);

Expand Down Expand Up @@ -93,24 +99,26 @@

float computeCorrectedSum(Crit3DMeteoPoint* meteoPoint, Crit3DDate firstDate, Crit3DDate finishDate, float param, float minimumPercentage);

bool preElaboration(QString *myError, Crit3DMeteoPointsDbHandler* meteoPointsDbHandler, Crit3DMeteoGridDbHandler* meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint, bool isMeteoGrid, meteoVariable variable, meteoComputation elab1,
QDate startDate, QDate endDate, std::vector<float> &outputValues, float* percValue, Crit3DMeteoSettings *meteoSettings);
bool preElaboration(Crit3DMeteoPointsDbHandler* meteoPointsDbHandler, Crit3DMeteoGridDbHandler* meteoGridDbHandler,
Crit3DMeteoPoint* meteoPoint, bool isMeteoGrid, meteoVariable variable, meteoComputation elab1,
QDate startDate, QDate endDate, std::vector<float> &outputValues, float* percValue,
Crit3DMeteoSettings *meteoSettings, QString &myError);

float loadDailyVarSeries(QString *myError, Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
float loadDailyVarSeries(Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint,
bool isMeteoGrid, meteoVariable variable, QDate first, QDate last);
bool isMeteoGrid, meteoVariable variable, QDate first, QDate last, QString &myError);

float loadDailyVarSeries_SaveOutput(QString *myError, Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
float loadDailyVarSeries_SaveOutput(Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint &meteoPoint, bool isMeteoGrid,
meteoVariable variable, QDate first, QDate last, std::vector<float> &outputValues);
meteoVariable variable, QDate first, QDate last, std::vector<float> &outputValues, QString &myError);

float loadHourlyVarSeries_SaveOutput(QString *myError, Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint, bool isMeteoGrid,
meteoVariable variable, QDate firstDate, QDate lastDate, std::vector<float> &outputValues);
float loadHourlyVarSeries_SaveOutput(Crit3DMeteoPointsDbHandler *meteoPointsDbHandler, Crit3DMeteoGridDbHandler *meteoGridDbHandler,
const QString &meteoPointId, bool isMeteoGrid, meteoVariable variable, const QDateTime &firstTime,
const QDateTime &lastTime, std::vector<float> &outputValues, QString &myError);

float loadHourlyVarSeries(QString *myError, Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint,
bool isMeteoGrid, meteoVariable variable, QDateTime first, QDateTime last);
float loadHourlyVarSeries(Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint,
bool isMeteoGrid, meteoVariable variable, const QDateTime &firstTime, const QDateTime &lastTime, QString &myError);

void extractValidValuesCC(std::vector<float> &outputValues);

Expand Down Expand Up @@ -168,7 +176,8 @@
meteoVariable variable, QDate first, QDate last, std::vector<float> &outputValues);

void setMpValues(Crit3DMeteoPoint meteoPointGet, Crit3DMeteoPoint* meteoPointSet, QDate myDate, meteoVariable myVar, Crit3DMeteoSettings* meteoSettings);
meteoComputation getMeteoCompFromString(std::map<std::string, meteoComputation> map, std::string value);

meteoComputation getMeteoCompFromString(const std::map<std::string, meteoComputation> &map, const std::string &computationStr);


#endif // CLIMATE_H
67 changes: 27 additions & 40 deletions agrolib/climate/crit3dClimate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Crit3DClimate::Crit3DClimate()
_periodStr = "";
_genericPeriodDateStart.setDate(1800,1,1);
_genericPeriodDateEnd.setDate(1800,1,1);
_hourStart = NODATA;
_hourEnd = NODATA;
_nYears = NODATA;
_elab1 = "";
_param1 = NODATA;
Expand Down Expand Up @@ -45,6 +47,8 @@ void Crit3DClimate::resetParam()
_periodStr = "";
_genericPeriodDateStart.setDate(1800,1,1);
_genericPeriodDateEnd.setDate(1800,1,1);
_hourStart = NODATA;
_hourEnd = NODATA;
_nYears = NODATA;
_elab1 = "";
_param1 = NODATA;
Expand All @@ -67,27 +71,29 @@ void Crit3DClimate::resetCurrentValues()
_currentPeriodType = noPeriodType;
}

void Crit3DClimate::copyParam(Crit3DClimate* clima)
{
_db = clima->db();
_climateElab = clima->climateElab();
_yearStart = clima->yearStart();
_yearEnd = clima->yearEnd();
_periodType = clima->periodType();
_variable = clima->variable();
_periodStr = clima->periodStr();
_genericPeriodDateStart = clima->genericPeriodDateStart();
_genericPeriodDateEnd = clima->genericPeriodDateEnd();
_nYears = clima->nYears();
_elab1 = clima->elab1();
_param1 = clima->param1();
_param1IsClimate = clima->param1IsClimate();
_param1ClimateField = clima->param1ClimateField();
_param1ClimateIndex = clima->getParam1ClimateIndex();
_isClimateAnomalyFromDb = clima->getIsClimateAnomalyFromDb();
_elab2 = clima->elab2();
_param2 = clima->param2();
_dailyCumulated = clima->dailyCumulated();
void Crit3DClimate::copyParam(Crit3DClimate* myClimate)
{
_db = myClimate->db();
_climateElab = myClimate->climateElab();
_yearStart = myClimate->yearStart();
_yearEnd = myClimate->yearEnd();
_periodType = myClimate->periodType();
_variable = myClimate->variable();
_periodStr = myClimate->periodStr();
_genericPeriodDateStart = myClimate->genericPeriodDateStart();
_genericPeriodDateEnd = myClimate->genericPeriodDateEnd();
_hourStart = myClimate->hourStart();
_hourEnd = myClimate->hourEnd();
_nYears = myClimate->nYears();
_elab1 = myClimate->elab1();
_param1 = myClimate->param1();
_param1IsClimate = myClimate->param1IsClimate();
_param1ClimateField = myClimate->param1ClimateField();
_param1ClimateIndex = myClimate->getParam1ClimateIndex();
_isClimateAnomalyFromDb = myClimate->getIsClimateAnomalyFromDb();
_elab2 = myClimate->elab2();
_param2 = myClimate->param2();
_dailyCumulated = myClimate->dailyCumulated();

}

Expand All @@ -105,25 +111,6 @@ void Crit3DClimate::setClimateElab(const QString &climateElab)
_climateElab = climateElab;
}

int Crit3DClimate::yearStart() const
{
return _yearStart;
}

void Crit3DClimate::setYearStart(int yearStart)
{
_yearStart = yearStart;
}

int Crit3DClimate::yearEnd() const
{
return _yearEnd;
}

void Crit3DClimate::setYearEnd(int yearEnd)
{
_yearEnd = yearEnd;
}

meteoVariable Crit3DClimate::variable() const
{
Expand Down
18 changes: 13 additions & 5 deletions agrolib/climate/crit3dClimate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,25 @@

void resetCurrentValues();

void copyParam(Crit3DClimate* clima);
void copyParam(Crit3DClimate* myClimate);

const QSqlDatabase &db() const;
void setDb(const QSqlDatabase &db);

QString climateElab() const;
void setClimateElab(const QString &climateElab);

int yearStart() const;
void setYearStart(int yearStart);
int yearStart() const { return _yearStart; }
int yearEnd() const { return _yearEnd; }

int yearEnd() const;
void setYearEnd(int yearEnd);
void setYearStart(int yearStart) { _yearStart = yearStart; }
void setYearEnd(int yearEnd) { _yearEnd = yearEnd; }

int hourStart() const { return _hourStart; }
int hourEnd() const { return _hourEnd; }

void setHourStart(int hourStart) { _hourStart = hourStart; }
void setHourEnd(int hourEnd) { _hourEnd = hourEnd; }

meteoVariable variable() const;
void setVariable(const meteoVariable &variable);
Expand Down Expand Up @@ -119,6 +125,8 @@
QString _periodStr;
QDate _genericPeriodDateStart;
QDate _genericPeriodDateEnd;
int _hourStart;
int _hourEnd;
int _nYears;
QString _elab1;
float _param1;
Expand Down
1 change: 0 additions & 1 deletion agrolib/climate/crit3dClimateList.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
Crit3DClimateList();
~Crit3DClimateList();


QList<QString> listClimateElab() const;
void setListClimateElab(const QList<QString> &listClimateElab);

Expand Down
Loading

0 comments on commit 5e62063

Please sign in to comment.