Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/ARPA-SIMC/CRITERIA3D
Browse files Browse the repository at this point in the history
  • Loading branch information
ftomei committed Feb 10, 2025
2 parents c066ffd + 0d29364 commit 9288d73
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hydrall/hydrall.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@

};

struct Tsoil {
struct ThydrallSoil {

int soilLayersNr;
double soilTotalDepth;
Expand Down Expand Up @@ -149,7 +149,7 @@
TenvironmentalVariable environmentalVariable;
TparameterWangLeuning parameterWangLeuning;
Tplant plant;
Tsoil soil;
ThydrallSoil soil;
TlightExtinctionCoefficient directLightExtinctionCoefficient;
TlightExtinctionCoefficient diffuseLightExtinctionCoefficient;

Expand Down
5 changes: 5 additions & 0 deletions interpolation/interpolation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,9 +882,11 @@ float shepardSearchNeighbour(vector <Crit3DInterpolationDataPoint> &inputPoints,
}

float radius;

if (shepardNeighbourPoints.size() < SHEPARD_MIN_NRPOINTS)
{
int nrPoints = sortPointsByDistance(SHEPARD_MIN_NRPOINTS, inputPoints, outputPoints);
if (outputPoints.empty()) return NODATA;
radius = outputPoints[nrPoints-1].distance + float(EPSILON);
}
else if (shepardNeighbourPoints.size() > SHEPARD_MAX_NRPOINTS)
Expand Down Expand Up @@ -990,6 +992,9 @@ float modifiedShepardIdw(vector <Crit3DInterpolationDataPoint> &myPoints,
else
validPoints = myPoints;

if (myPoints.empty())
return NODATA;

weight.resize(validPoints.size());
t.resize(validPoints.size());
S.resize(validPoints.size());
Expand Down
2 changes: 1 addition & 1 deletion mathFunctions/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ double pressureFromAltitude(double height)

double pressureFromAltitude(double temperature, double height)
{
return P0 * exp((- GRAVITY * M_AIR * height) / (R_GAS * temperature));
return P0 * exp((- GRAVITY * M_AIR * height) / (R_GAS * (temperature + 273.15)));
}

/*!
Expand Down
9 changes: 8 additions & 1 deletion project/project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3052,6 +3052,8 @@ bool Project::interpolationDemGlocalDetrending(meteoVariable myVar, const Crit3D
else
myRaster->value[row][col] += interpolatedValue*areaCells[cellIndex+1];
}
else
return false;
}
}
}
Expand Down Expand Up @@ -3459,8 +3461,13 @@ bool Project::interpolationGrid(meteoVariable myVar, const Crit3DTime& myTime)
proxyIndex++;
}
}
interpolatedValue = interpolate(subsetInterpolationPoints, &interpolationSettings, meteoSettings, myVar, myX, myY, myZ, proxyValues, true)

double temp = interpolate(subsetInterpolationPoints, &interpolationSettings, meteoSettings, myVar, myX, myY, myZ, proxyValues, true);
if (! isEqual(temp, NODATA))
interpolatedValue = interpolate(subsetInterpolationPoints, &interpolationSettings, meteoSettings, myVar, myX, myY, myZ, proxyValues, true)
* areaCells[cellIndex + 1];
else
return false;
}
if (freq == hourly)
{
Expand Down
3 changes: 2 additions & 1 deletion proxyWidget/proxyWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ Crit3DProxyWidget::Crit3DProxyWidget(Crit3DInterpolationSettings* interpolationS
selectionOptionBoxLayout->addWidget(&modelLR);
selectionOptionBoxLayout->addWidget(&climatologicalLR);

if (macroAreaNumber != NODATA) modelLR.setEnabled(false);

selectionOptionEditLayout->addWidget(r2Label);
selectionOptionEditLayout->addWidget(&r2);
selectionOptionEditLayout->addStretch(150);
Expand Down Expand Up @@ -585,7 +587,6 @@ void Crit3DProxyWidget::addMacroAreaLR()
point_vector.append(point);
}

macroAreaNumber = NODATA;
chartView->drawModelLapseRate(point_vector);
}
return;
Expand Down

0 comments on commit 9288d73

Please sign in to comment.