Skip to content

Commit

Permalink
fixes flip problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 17, 2023
1 parent 795f1ec commit 0b714b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: terra
Type: Package
Title: Spatial Data Analysis
Version: 1.7-56
Date: 2023-10-14
Version: 1.7-57
Date: 2023-10-17
Depends: R (>= 3.5.0)
Suggests: parallel, tinytest, ncdf4, sf (>= 0.9-8), deldir, XML, leaflet, htmlwidgets
LinkingTo: Rcpp
Expand Down
4 changes: 2 additions & 2 deletions src/raster_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3206,14 +3206,14 @@ SpatRaster SpatRaster::flip(bool vertical, SpatOptions &opt) {
size_t ii = out.bs.n - 1 - i;
readBlock(a, out.bs, ii);
b.reserve(a.size());
for (size_t j=0; j < out.nlyr(); j++) {
for (size_t j=0; j < nl; j++) {
size_t offset = j * out.bs.nrows[ii] * nc;
for (size_t k=0; k < out.bs.nrows[ii]; k++) {
unsigned start = offset + (out.bs.nrows[ii] - 1 - k) * nc;
b.insert(b.end(), a.begin()+start, a.begin()+start+nc);
}
}
if (!out.writeBlock(b, i)) return out;
if (!out.writeValues(b, out.bs.row[i], out.bs.nrows[ii])) return out;
}
} else {
for (size_t i=0; i < out.bs.n; i++) {
Expand Down

0 comments on commit 0b714b0

Please sign in to comment.