Description Usage Arguments Value Note Examples
View source: R/build_testraster.R
helper function used to quickly create a rasterStack
object with specified
dimensions (useful for testing purposes).
1 2 | build_testraster(nrows = 100, ncols = 100, nbands = 1,
with_nodata = TRUE, to_file = FALSE, out_file = NULL, ...)
|
nrows |
|
ncols |
|
nbands |
|
with_nodata |
PARAM_DESCRIPTION, Default: TRUE |
to_file |
|
out_file |
|
... |
Any other arguments to be passed to |
Either the "test" raster in rasterStack
format, or the filename where it was saved (if
tofile
= TRUE)
Values of the test raster are integers between 1 and 250.
If out_file
is selected, the file is saved as a 8-bit unsigned integer tiff to save space.
By default, the raster is created using a WGS84 lat/lon reference system, with extent
corresponding to the entire globe (bbox = -180, 180; -90, 90). To specify a different projection
and extent, specify them by passing the crs
and ext
arguments to 'raster (see examples).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
# create a rasterstack of 100*100 cells and 10 bands and put it in test_rast
test_rast <- build_testraster(100,100,10)
test_rast
# create a rasterstack of 100*100 cells and 20 bands and save it to a temporary TIFF file
test_rast <- build_testraster(100,100,20, to_file = TRUE)
test_rast
# create a rasterstack of 100*100 cells and 10 in epsg:3857 projection on a given extent
build_testraster(100,100,10, crs = "+init=epsg:3857",
ext = raster::extent(c(0, 200000, 0, 200000)))
test_rast
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.