Resampling the same raster iteratively multiple times

I have 1 image that I have to resample it 15 times. The resampling is basically a multiplication (e.g., 0.2 * 460). The range of the first part of the multiplication is from 0.2 to 0.9 with step 0.05. The second part stays the same. For example

library(raster)
library(OpenImageR)

r = raster("path/r1.tif")

m = as.matrix(r)

psf = down_sample_image(m,

factor = 4.66,

gaussian_blur = T,

gauss_sigma = 0.2 * 460) # 0.2 to 0.9 with step 0.05

e <- extent(r)

m2r = raster(psf)

extent(m2r) <- e

plot(m2r)

raster::crs(m2r) <- "EPSG:7767"

writeRaster(m2r, "path/r2.tif")

What I want is:
to perform the above analysis iteratively, 15 times, where each time the code will read the input raster, it will perform the resampling and it will save the output using as name the input's name + the multiplication part. This means that in the end I should have 15 rasters named, r2, r25, r3, r35....r9. The numbers in the output's name comes from the multiplication. How can I achieve that? Here is the data:

new("RasterLayer", file = new(".RasterFile", name = "C:\\Users\\Geography\\Desktop\\multipolygon_test\\clip\\r1.tif",

datanotation = "FLT4S", byteorder = "little", nodatavalue = -Inf,

NAchanged = FALSE, nbands = 1L, bandorder = "BIL", offset = 0L,

toptobottom = TRUE, blockrows = c(rows = 18L), blockcols = c(cols = 108L),

driver = "gdal", open = FALSE), data = new(".SingleLayerData",

values = logical(0), offset = 0, gain = 1, inmemory = FALSE,

fromdisk = TRUE, isfactor = FALSE, attributes = list(), haveminmax = TRUE,

min = 46.937648773193, max = 549.67785644531, band = 1L,

unit = "", names = "a"), legend = new(".RasterLegend", type = character(0),

values = logical(0), color = logical(0), names = logical(0),

colortable = logical(0)), title = character(0), extent = new("Extent",

xmin = 583400, xmax = 594200, ymin = 1005800, ymax = 1025900),

rotated = FALSE, rotation = new(".Rotation", geotrans = numeric(0),

transfun = function ()

NULL), ncols = 108L, nrows = 201L, crs = new("CRS", projargs = "+proj=lcc +lat_0=18.88015774 +lon_0=76.75 +lat_1=16.625 +lat_2=21.125 +x_0=1000000 +y_0=1000000 +datum=WGS84 +units=m +no_defs"),

history = list(), z = list())

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.