resampleStack-method: Method: Resample a RasterStack object

Description Details Value Note Author(s) See Also Examples

Description

ResampleStack transfers values between non matching RasterLayers in terms of origin and spatial resolution. To adjust the spatial resolution, a bilinear interpolation is applied.

Details

In addition to the function resample, 'resampleStack' provides the export of each resampled 'RasterLayer' as GeoTIFF.

If it is desired to convert the unit ('u1') of the 'RasterStack' into a different unit ('u2'), the arguments ('u1') and ('u2') (see unitConv) can be additionally passed to 'rasterStack'.

Value

An object of class 'RasterLayer' returning the mean or sum (depending on outType) of the resampled 'RasterStack'.

Note

File format of written ouput: GeoTIFF.

Author(s)

Alexander R. Groos (alexander.groos@giub.unibe.ch)

See Also

resample, unitConv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Load the provided RasterLayer objects as exemplary
# input for the function
data(airTemperature_30m_daily, precip_10km_daily,
    package = "glacierSMBM")
# Individual RasterLayer objects should be loaded or created
# using the function raster()

# Resample and interpolate a precipitation file with 10 km spatial
# resolution using the parameters of air temperature (30m)
# Additionally, convert from mm h-1 to m d-1
output <- resampleStack(stack(precip_10km_daily),
    airTemperature_30m_daily,1, writeOutput = FALSE,
    u1 = "mm/h", u2 = "mm/d", decimalPlaces = 5)

# Plot output
plot(precip_10km_daily, main = "precipitation (10km)",
    legend.args=list(text='precipitation (m)', side=3, line=1.5))
plot(output, main = "resampled precipitation (30m)",
    legend.args=list(text='precipitation (m)', side=3, line=1.5))

Example output

Loading required package: raster
Loading required package: sp
Loading required package: udunits2
udunits system database read
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied
sh: 1: awk: Permission denied

glacierSMBM documentation built on May 2, 2019, 3:42 a.m.