Skip to content

Commit

Permalink
Merge commit '57546d11c2f288d40d18599edbf255705f419f20'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Jul 3, 2024
2 parents 6cca0e5 + 57546d1 commit e87651b
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion agrolib/gis/color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ bool setSlopeStabilityScale(Crit3DColorScale* myScale)
myScale->keyColor[0] = Crit3DColor(128, 0, 128); /*!< violet */
myScale->keyColor[1] = Crit3DColor(255, 0, 0); /*!< red */
myScale->keyColor[2] = Crit3DColor(255, 255, 0); /*!< yellow */
myScale->keyColor[3] = Crit3DColor(128, 220, 0); /*!< yellow/green */
myScale->keyColor[3] = Crit3DColor(128, 196, 0); /*!< yellow/green */
myScale->keyColor[4] = Crit3DColor(64, 196, 64); /*!< green */
myScale->keyColor[5] = Crit3DColor(64, 196, 64); /*!< green */
myScale->keyColor[6] = Crit3DColor(64, 196, 64); /*!< green */
Expand Down
15 changes: 8 additions & 7 deletions agrolib/gis/gis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,20 +1337,21 @@ namespace gis
{
float value = rasterRef.getValueFromRowCol(row,col);
float aspect = aspectMap.getValueFromRowCol(row,col);
if ( isEqual(value, rasterRef.header->flag)
|| isEqual(aspect, aspectMap.header->flag) )
return false;
if (isEqual(value, rasterRef.header->flag) || isEqual(aspect, aspectMap.header->flag))
{
return false;
}

int r = 0;
int c = 0;
if (aspect > 135 && aspect < 225)
if (aspect >= 135 && aspect <= 225)
r = 1;
else if ((aspect < 45) || (aspect > 315))
else if ((aspect <= 45) || (aspect >= 315))
r = -1;

if (aspect > 45 && aspect < 135)
if (aspect >= 45 && aspect <= 135)
c = 1;
else if (aspect > 225 && aspect < 315)
else if (aspect >= 225 && aspect <= 315)
c = -1;

float valueBoundary = rasterRef.getValueFromRowCol(row + r, col + c);
Expand Down
12 changes: 7 additions & 5 deletions agrolib/interpolation/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,22 +1364,22 @@ bool setAllFittingRanges(Crit3DProxyCombination myCombination, Crit3DInterpolati
if (mySettings->getChosenElevationFunction() == piecewiseTwo)
{
mySettings->getProxy(i)->setFittingFunctionName(piecewiseTwo);
tempParam = {-200, min-2, 0, -0.015, 2000, max+2, 0.01, 0.0015};
tempParam = {-200, min-2, 0, -0.01, 5000, max+2, 0.01, 0.0015};
}
else if (mySettings->getChosenElevationFunction() == piecewiseThreeFree)
{
mySettings->getProxy(i)->setFittingFunctionName(piecewiseThreeFree);
tempParam = {-200, min-2, 100, 0, -0.015, -0.015, 2000, max+2, 1000, 0.007, 0.0015, 0.0015};
tempParam = {-200, min-2, 100, 0, -0.01, -0.01, 5000, max+2, 1000, 0.007, 0.0015, 0.0015};
}
else if (mySettings->getChosenElevationFunction() == piecewiseThree)
{
mySettings->getProxy(i)->setFittingFunctionName(piecewiseThree);
tempParam = {-200, min-2, 100, 0, -0.015, 2000, max+2, 1000, 0.007, 0.0015};
tempParam = {-200, min-2, 100, 0, -0.01, 5000, max+2, 1000, 0.007, 0.0015};
}
else if (mySettings->getChosenElevationFunction() == freiFree)
{
mySettings->getProxy(i)->setFittingFunctionName(freiFree);
tempParam = {min, 0, -4, -200, 0.1, 0, max+10, 0.006, 4, 2000, 1000, 0.006};
tempParam = {min, 0, -4, -200, 0.1, 0, max+10, 0.006, 4, 5000, 1000, 0.006};
}
mySettings->getProxy(i)->setFittingParametersRange(tempParam);
}
Expand Down Expand Up @@ -1472,7 +1472,7 @@ bool setAllFittingParameters_noRange(Crit3DProxyCombination myCombination, Crit3
proxyParamMin.push_back(min_);
proxyParamMax.push_back(max_);
proxyParamDelta.push_back((max_ - min_) / RATIO_DELTA);
proxyParamFirstGuess.push_back((max_ + min_) / 2); // TODO check if ok
proxyParamFirstGuess.push_back((max_ + min_) / 2);
}

paramMin.push_back(proxyParamMin);
Expand Down Expand Up @@ -1888,6 +1888,7 @@ bool multipleDetrending(Crit3DProxyCombination othersCombination, std::vector<st
myCombination.setProxySignificant(pos, false);
mySettings->setCurrentCombination(myCombination);
mySettings->getProxy(pos)->setIsSignificant(false);
parameters.clear();
}
}
}
Expand Down Expand Up @@ -1970,6 +1971,7 @@ bool multipleDetrending(Crit3DProxyCombination othersCombination, std::vector<st
myCombination.setProxySignificant(pos, false);
mySettings->setCurrentCombination(myCombination);
mySettings->getProxy(pos)->setIsSignificant(false);
parameters.clear();
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions agrolib/mathFunctions/furtherMathFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1994,13 +1994,14 @@ namespace interpolation
//grigliato

std::vector<double> steps;
const int numSteps = 100;
if (parameters.size() == 4)
steps = {50.0, 0.5, 0.00075, 0.00075};
//steps = {50.0, 0.5, 0.00075, 0.00075};
steps = {2*(parametersMax[0]-parametersMin[0])/numSteps, 2*(parametersMax[1]-parametersMin[1])/numSteps, 2*(parametersMax[2]-parametersMin[2])/numSteps, 2*(parametersMax[3]-parametersMin[3])/numSteps};
else if (parameters.size() == 6)
steps = {50.0, 0.5, 50.0, 0.00075, 0.00075, 0.00075};
steps = {2*(parametersMax[0]-parametersMin[0])/numSteps, 2*(parametersMax[1]-parametersMin[1])/numSteps, 2*(parametersMax[2]-parametersMin[2])/numSteps, 2*(parametersMax[3]-parametersMin[3])/numSteps,2*(parametersMax[4]-parametersMin[4])/numSteps,2*(parametersMax[5]-parametersMin[5])/numSteps };
else return false;

const int numSteps = 40;
int directions[] = {1, -1};
size_t numParamsToVary = parameters.size();
std::vector<double> firstGuessParam = parameters;
Expand Down
2 changes: 1 addition & 1 deletion agrolib/meteo/meteo.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
enum criteria3DVariable {volumetricWaterContent, waterTotalPotential, waterMatricPotential,
availableWaterContent, degreeOfSaturation, soilTemperature,
soilSurfaceMoisture, bottomDrainage, waterDeficit, waterInflow, waterOutflow,
factorOfSafety};
factorOfSafety, minimumFactorOfSafety};


const std::map<std::string, meteoVariable> MapDailyMeteoVar = {
Expand Down
5 changes: 1 addition & 4 deletions agrolib/project/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,9 +916,7 @@ Crit3DTime Project::getCrit3DCurrentTime()

QDateTime Project::getCurrentTime()
{
QDateTime myDateTime;
myDateTime.setDate(this->currentDate);
return myDateTime.addSecs(this->currentHour * HOUR_SECONDS);
return QDateTime(currentDate, QTime(currentHour, 0, 0), Qt::UTC);
}


Expand Down Expand Up @@ -2729,7 +2727,6 @@ bool Project::interpolationGrid(meteoVariable myVar, const Crit3DTime& myTime)
proxyIndex++;
}
}

if (interpolationSettings.getUseLocalDetrending())
{
std::vector <Crit3DInterpolationDataPoint> subsetInterpolationPoints;
Expand Down
7 changes: 6 additions & 1 deletion agrolib/soil/soil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,12 @@ namespace soil
if (horizon.organicMatter > 0.2)
return 16; // OL
else
return 13; // ML
{
if(horizon.texture.clay >= 20)
return 12; // SC-CL
else
return 13; // ML
}
}
if (horizon.texture.classNameUSDA == "clay" || horizon.texture.classNameUSDA == "silty clay")
{
Expand Down
6 changes: 3 additions & 3 deletions agrolib/soil/soil.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@
double upperDepth, lowerDepth; /*!< [m] */
double coarseFragments; /*!< [-] 0-1 */
double organicMatter; /*!< [-] 0-1 */
double bulkDensity; /*!< [g/cm^3] */
double bulkDensity; /*!< [g cm-3] */
double effectiveCohesion; /*!< [kPa] */
double frictionAngle; /*!< [degrees] */

double fieldCapacity; /*!< [kPa] */
double wiltingPoint; /*!< [kPa] */
double waterContentFC; /*!< [m^3 m^-3]*/
double waterContentWP; /*!< [m^3 m^-3]*/
double waterContentFC; /*!< [m3 m-3]*/
double waterContentWP; /*!< [m3 m-3]*/
double PH; /*!< [-] */
double CEC; /*!< [meq/100g]*/

Expand Down
1 change: 1 addition & 0 deletions agrolib/soilFluxes3D/soilFluxes3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ int DLL_EXPORT __STDCALL setHydraulicProperties(int waterRetentionCurve,
}
else
{
// default
myParameters.k_lateral_vertical_ratio = 10.;
return PARAMETER_ERROR;
}
Expand Down

0 comments on commit e87651b

Please sign in to comment.