Skip to content

Commit

Permalink
fixes #1634
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 30, 2024
1 parent e5458c2 commit 6fd8b16
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/arith.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1906,28 +1906,10 @@ std::vector<std::vector<double>> SpatRaster::where(std::string what, bool values
std::vector<double> val;
bool do_min = what == "min";

std::vector<bool> hr = hasRange();
bool hasR = true;
for (size_t i=0; i<hr.size(); i++) {
if (!hr[i]) {
hasR = false;
break;
}
}
if (hasR) {
if (do_min) {
val = range_min();
for (double &d : val) d *= 1.00001;
} else {
val = range_max();
for (double &d : val) d *= 0.99999;
}
if (do_min) {
val.resize(nl, std::numeric_limits<double>::max());
} else {
if (do_min) {
val.resize(nl, std::numeric_limits<double>::max());
} else {
val.resize(nl, std::numeric_limits<double>::lowest());
}
val.resize(nl, std::numeric_limits<double>::lowest());
}
for (size_t i=0; i<bs.n; i++) {
std::vector<double> v;
Expand Down

0 comments on commit 6fd8b16

Please sign in to comment.