Skip to content

Commit

Permalink
Merge commit '37264ca859f255b8d628719603bc96d71aea1109'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Aug 21, 2024
2 parents 13a6096 + 37264ca commit 0f32d72
Show file tree
Hide file tree
Showing 46 changed files with 778 additions and 691 deletions.
4 changes: 2 additions & 2 deletions agrolib/climate/climate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ float loadDailyVarSeries(QString *myError, Crit3DMeteoPointsDbHandler *meteoPoin
// meteoPoint
else
{
dailyValues = meteoPointsDbHandler->loadDailyVar(myError, variable, getCrit3DDate(first), getCrit3DDate(last), &firstDateDB, meteoPoint );
dailyValues = meteoPointsDbHandler->loadDailyVar(variable, getCrit3DDate(first), getCrit3DDate(last), *meteoPoint, firstDateDB);
}


Expand Down Expand Up @@ -854,7 +854,7 @@ float loadDailyVarSeries_SaveOutput(QString *myError, Crit3DMeteoPointsDbHandler
// meteoPoint
else
{
dailyValues = meteoPointsDbHandler->loadDailyVar(myError, variable, getCrit3DDate(first), getCrit3DDate(last), &firstDateDB, meteoPoint );
dailyValues = meteoPointsDbHandler->loadDailyVar(variable, getCrit3DDate(first), getCrit3DDate(last), *meteoPoint, firstDateDB);
}


Expand Down
4 changes: 2 additions & 2 deletions agrolib/climate/climate.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
bool isMeteoGrid, meteoVariable variable, QDate first, QDate last);

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

float loadHourlyVarSeries(QString *myError, Crit3DMeteoPointsDbHandler *meteoPointsDbHandler,
Crit3DMeteoGridDbHandler *meteoGridDbHandler, Crit3DMeteoPoint* meteoPoint,
Expand Down
21 changes: 1 addition & 20 deletions agrolib/crit3dDate/crit3dDate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Crit3DDate getDateFromJulianDay(long julianDay)
}


std::string Crit3DDate::toStdString()
std::string Crit3DDate::toISOString() const
{
char myStr[11];
sprintf (myStr, "%d-%02d-%02d", this->year, this->month, this->day);
Expand All @@ -312,29 +312,10 @@ std::string Crit3DDate::toStdString()
}


std::string Crit3DDate::toStdString() const
{
char myStr[11];
sprintf (myStr, "%d-%02d-%02d", this->year, this->month, this->day);

return std::string(myStr);
}


std::string Crit3DDate::toString()
{
char myStr[9];
sprintf (myStr, "%d%02d%02d", this->year, this->month, this->day);

return std::string(myStr);
}


std::string Crit3DDate::toString() const
{
char myStr[9];
sprintf (myStr, "%d%02d%02d", this->year, this->month, this->day);

return std::string(myStr);
}

11 changes: 6 additions & 5 deletions agrolib/crit3dDate/crit3dDate.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@
void setDate(int myDay, int myMonth, int myYear);
bool isNullDate();
void setNullDate();

Crit3DDate addDays(long offset) const;
int daysTo(const Crit3DDate& myDate) const;
std::string toStdString();
std::string toStdString() const;
std::string toString();

std::string toISOString() const;

std::string toString() const;
};

Expand Down Expand Up @@ -81,8 +82,8 @@
int getMinutes() const;
int getSeconds() const;

std::string toISOString();
std::string toString();
std::string toISOString() const;
std::string toString() const;
};

bool isLeapYear(int year);
Expand Down
1 change: 0 additions & 1 deletion agrolib/crit3dDate/crit3dDate.pro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ CONFIG += staticlib
DEFINES += _CRT_SECURE_NO_WARNINGS

CONFIG += debug_and_release
CONFIG += c++11 c++14 c++17

unix:{
CONFIG(debug, debug|release) {
Expand Down
4 changes: 2 additions & 2 deletions agrolib/crit3dDate/crit3dTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Crit3DTime Crit3DTime::addSeconds(long mySeconds) const
}


std::string Crit3DTime::toISOString()
std::string Crit3DTime::toISOString() const
{
char myStr[17];
sprintf (myStr, "%d-%02d-%02d %02d:%02d", this->date.year, this->date.month, this->date.day, this->getHour(), this->getMinutes());
Expand All @@ -144,7 +144,7 @@ std::string Crit3DTime::toISOString()
}


std::string Crit3DTime::toString()
std::string Crit3DTime::toString() const
{
char myStr[13];
sprintf (myStr, "%d%02d%02dT%02d%02d", this->date.year, this->date.month, this->date.day, this->getHour(), this->getMinutes());
Expand Down
4 changes: 2 additions & 2 deletions agrolib/criteriaModel/criteria1DCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ bool Crit1DCase::computeDailyModel(Crit3DDate &myDate, std::string &error)
// check daily meteo data
if (! meteoPoint.existDailyData(myDate))
{
error = "Missing weather data: " + myDate.toStdString();
error = "Missing weather data: " + myDate.toISOString();
return false;
}

Expand All @@ -515,7 +515,7 @@ bool Crit1DCase::computeDailyModel(Crit3DDate &myDate, std::string &error)

if (isEqual(tmin, NODATA) || isEqual(tmax, NODATA))
{
error = "Missing temperature data: " + myDate.toStdString();
error = "Missing temperature data: " + myDate.toISOString();
return false;
}
if (isEqual(prec, NODATA))
Expand Down
4 changes: 2 additions & 2 deletions agrolib/criteriaModel/criteria1DProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,14 +1779,14 @@ void Crit1DProject::updateOutput(Crit3DDate myDate, bool isFirst)

if (isClimateOutput)
{
outputString += "('" + QString::fromStdString(myDate.toStdString()) + "'"
outputString += "('" + QString::fromStdString(myDate.toISOString()) + "'"
+ "," + QString::number(myCase.output.dailyAvailableWater, 'g', 4)
+ "," + QString::number(myCase.output.dailyMaxTranspiration, 'g', 3)
+ "," + QString::number(myCase.output.dailyTranspiration, 'g', 3);
}
else
{
outputString += "('" + QString::fromStdString(myDate.toStdString()) + "'"
outputString += "('" + QString::fromStdString(myDate.toISOString()) + "'"
+ "," + QString::number(myCase.output.dailyPrec)
+ "," + QString::number(myCase.output.dailyIrrigation)
+ "," + QString::number(myCase.output.dailySoilWaterContent, 'g', 4)
Expand Down
2 changes: 1 addition & 1 deletion agrolib/crop/crop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ bool Crit3DCrop::dailyUpdate(const Crit3DDate &myDate, double latitude, const st
double dailyDD = getDailyDegreeIncrease(tmin, tmax, currentDoy);
if (isEqual(dailyDD, NODATA))
{
myError = "Error in computing degree days for " + myDate.toStdString();
myError = "Error in computing degree days for " + myDate.toISOString();
return false;
}
degreeDays += dailyDD;
Expand Down
Loading

0 comments on commit 0f32d72

Please sign in to comment.