Skip to content

Commit

Permalink
improve accordance of basegeo with envi
Browse files Browse the repository at this point in the history
  • Loading branch information
lbusett committed Jun 9, 2020
1 parent 00e59bd commit ad1e642
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/prisma_basegeo.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@ prisma_basegeo <- function(band, lon, lat, fill_gaps = TRUE) {
minlat <- min(lat, na.rm = TRUE)
vals <- raster::values(band)

columns <- round((lon - minlon) / psize_x)
columns <- round((lon - minlon) / psize_x) + 1
rows <- nrows - round((lat - minlat) / psize_y)

# columns <- round((lon - minlon) / psize_x) + 1
# rows <- nrows - round((lat - minlat) / psize_y) - 1
# columns[columns > ncols] <- 0
# rows[rows > nrows] <- 0

#♫ remove data if out of bounds to avoid potential crashes
columns[columns > ncols] <- 0
rows[rows > nrows] <- 0

for (indpix in 1:(numlines*numcols)) {
out_grd[rows[indpix], columns[indpix]] <- vals[indpix]
Expand Down

0 comments on commit ad1e642

Please sign in to comment.