Skip to content

Commit

Permalink
Merge commit '2c922d893b2218b39626c7e628327b63c9e58d8a'
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Mar 21, 2024
2 parents 19dad32 + 2c922d8 commit 1fb3da4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
11 changes: 6 additions & 5 deletions agrolib/interpolation/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ void detrendPoints(std::vector <Crit3DInterpolationDataPoint> &myPoints, Crit3DI

proxyValue = myPoint->getProxyValue(pos);

if (getProxyPragaName(myProxy->getName()) == height)
if (getProxyPragaName(myProxy->getName()) == proxyHeight)
{
if (proxyValue != NODATA)
{
Expand Down Expand Up @@ -1198,7 +1198,7 @@ float retrend(meteoVariable myVar, vector<double> myProxyValues, Crit3DInterpola
{
proxySlope = myProxy->getRegressionSlope();

if (getProxyPragaName(myProxy->getName()) == height)
if (getProxyPragaName(myProxy->getName()) == proxyHeight)
{
if (mySettings->getUseThermalInversion() && myProxy->getInversionIsSignificative())
{
Expand Down Expand Up @@ -1263,7 +1263,7 @@ void detrending(std::vector <Crit3DInterpolationDataPoint> &myPoints,
myProxy = mySettings->getProxy(pos);
myProxy->setIsSignificant(false);

if (getProxyPragaName(myProxy->getName()) == height)
if (getProxyPragaName(myProxy->getName()) == proxyHeight)
{
if (regressionOrography(myPoints, myCombination, mySettings, myClimate, myTime, myVar, pos))
{
Expand Down Expand Up @@ -1336,7 +1336,7 @@ bool setAllFittingParameters(Crit3DProxyCombination myCombination, Crit3DInterpo
for (unsigned i=0; i < myCombination.getProxySize(); i++)
if (mySettings->getProxy(i)->getIsSignificant())
{
if (getProxyPragaName(mySettings->getProxy(i)->getName()) == height)
if (getProxyPragaName(mySettings->getProxy(i)->getName()) == proxyHeight)
myFunc.push_back(lapseRatePiecewise_two);
else
myFunc.push_back(functionLinear);
Expand Down Expand Up @@ -1375,6 +1375,7 @@ bool setAllFittingParameters(Crit3DProxyCombination myCombination, Crit3DInterpo
return myFunc.size() > 0;
}


std::vector <double> getfittingParameters(Crit3DProxyCombination myCombination, Crit3DInterpolationSettings* mySettings, std::vector <double> paramOut, unsigned pos)
{
std::vector <double> myParam;
Expand All @@ -1384,7 +1385,7 @@ std::vector <double> getfittingParameters(Crit3DProxyCombination myCombination,
for (i=0; i < myCombination.getProxySize(); i++)
if (myCombination.isProxyActive(i))
{
if (getProxyPragaName(mySettings->getProxy(i)->getName()) == height)
if (getProxyPragaName(mySettings->getProxy(i)->getName()) == proxyHeight)
{
if (i == pos)
for (j=0; j<5; j++)
Expand Down
20 changes: 10 additions & 10 deletions agrolib/interpolation/interpolationConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@
{ "shepard_modified", shepard_modified }
};

enum TProxyVar { height, heightInversion, urbanFraction, orogIndex, seaDistance, aspect, slope, waterIndex, noProxy };
enum TProxyVar { proxyHeight, proxyHeightInversion, proxyUrbanFraction, proxyOrogIndex, proxySeaDistance, proxyAspect, proxySlope, proxyWaterIndex, noProxy };

const std::map<std::string, TProxyVar> ProxyVarNames = {
{ "elevation", height },
{ "altitude", height },
{ "orography", height },
{ "orogIndex", orogIndex },
{ "urbanFraction", urbanFraction },
{ "seaDistance", seaDistance },
{ "aspect", aspect },
{ "slope", slope },
{ "water_index", waterIndex}
{ "elevation", proxyHeight },
{ "altitude", proxyHeight },
{ "orography", proxyHeight },
{ "orogIndex", proxyOrogIndex },
{ "urbanFraction", proxyUrbanFraction },
{ "seaDistance", proxySeaDistance },
{ "aspect", proxyAspect },
{ "slope", proxySlope },
{ "water_index", proxyWaterIndex}
};


Expand Down
2 changes: 1 addition & 1 deletion agrolib/interpolation/interpolationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ void Crit3DInterpolationSettings::addProxy(Crit3DProxy myProxy, bool isActive_)
{
currentProxy.push_back(myProxy);

if (getProxyPragaName(myProxy.getName()) == height)
if (getProxyPragaName(myProxy.getName()) == proxyHeight)
setIndexHeight(int(currentProxy.size())-1);

selectedCombination.addProxyActive(isActive_);
Expand Down
10 changes: 5 additions & 5 deletions agrolib/project/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ bool Project::checkProxy(const Crit3DProxy &myProxy, QString* error)
return false;
}

bool isHeight = (getProxyPragaName(name_) == height);
bool isHeight = (getProxyPragaName(name_) == proxyHeight);

if (!isHeight && (myProxy.getGridName() == "") && (myProxy.getProxyTable() == "" && myProxy.getProxyField() == ""))
{
Expand Down Expand Up @@ -241,7 +241,7 @@ bool Project::addProxyToProject(std::vector <Crit3DProxy> proxyList, std::deque
}

for (i=0; i < interpolationSettings.getProxyNr(); i++)
if (getProxyPragaName(interpolationSettings.getProxy(i)->getName()) == height) setProxyDEM();
if (getProxyPragaName(interpolationSettings.getProxy(i)->getName()) == proxyHeight) setProxyDEM();

return true;
}
Expand Down Expand Up @@ -683,15 +683,15 @@ bool Project::loadParameters(QString parametersFileName)
{
unsigned int nrParameters;

if (getProxyPragaName(name_.toStdString()) == height)
nrParameters = 4;
if (getProxyPragaName(name_.toStdString()) == proxyHeight)
nrParameters = 5;
else
nrParameters = 1;

myList = parameters->value("fitting_parameters").toStringList();
if (myList.size() != nrParameters*2)
{
errorString = "Incomplete fitting parameters for proxy " + name_;
errorString = "Wrong nr. of fitting parameters for proxy: " + name_;
return false;
}

Expand Down

0 comments on commit 1fb3da4

Please sign in to comment.