pvts_resample: Warp(resample) grids in star's or raster's objects

Description Usage Arguments Details Value Examples

Description

This function is a slight modification of stars::st_warp for resampling stars and RasterLayer objects.

Usage

1
2
pvts_resample(src, dest, crs, method = "near",
  no_data_value = NA_real_, use_gdal = TRUE, RasterLayer = TRUE)

Arguments

src

object of class stars with source raster.

dest

object of class stars with target raster geometry.

crs

coordinate reference system for destination grid, only used when dest is missing.

method

character; see details for options; methods other than near only work when use_gdal=TRUE.

no_data_value

value used by gdalwarp for no_data (NA) when writing to temporaray file.

use_gdal

logical; if TRUE, use gdalwarp, through sf::gdal_utils

RasterLayer

logical; if TRUE, return a RasterLayer object.

Details

method should be one of near, bilinear, cubic, cubicspline, lanczos, average, mode, max, min, med, q1 or q3; see https://github.com/r-spatial/stars/issues/109

Value

A stars or RasterLayer object

Examples

1
2
3
4
5
6
7
8
9
library(raster)
library(stars)

x <- pvts_datasets$mosaic[1]
new_x1 <- st_warp(x,cellsize = 15,crs = st_crs(x)) %>% as('Raster')
names(new_x1) <- 'st_warp'
new_x2 <- pvts_resample(x,new_x1)
names(new_x2) <- 'pvts_resample'
plot(stack(new_x1,new_x2))

pvts-approach/PVts documentation built on July 1, 2019, 4:59 p.m.