Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Dec 29, 2024
1 parent ade718e commit bc27574
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
#include "string_utils.h"


void get_nx_ny(size_t size, size_t &nx, size_t &ny) {
void get_nx_ny(double size, size_t &nx, size_t &ny) {
double nxy = nx * ny;
if (size < nxy) {
if (std::isfinite(size) && (!std::isnan(size)) && (size < nxy)) {
double f = sqrt(size / nxy );
double fnx = nx * f;
double fny = ny * f;
Expand Down Expand Up @@ -220,6 +220,7 @@ std::vector<std::vector<double>> SpatRaster::sampleRegularValues(double size, Sp
nc = std::max((size_t)1, (size_t) std::ceil(nc1 * f));
}
*/

size_t nsize = nc * nr;
std::vector<double> v;
if ((size >= ncell()) || ((nc == ncol()) && (nr == nrow()))) {
Expand Down

0 comments on commit bc27574

Please sign in to comment.