I have two rasters of different resolution and extent:
> res(Elevation)
[1] 0.002083333 0.002083333
> res(Ann_precip)
[1] 0.008333333 0.008333333
> extent(Elevation)
class : Extent
xmin : -15.07722
xmax : -7.641806
ymin : 7.193611
ymax : 12.67694
> extent(Ann_precip)
class : Extent
xmin : -15.075
xmax : -7.641667
ymin : 7.191667
ymax : 12.675
My question is, in order for these two rasters to have matching resolutions and extents, is it better to:
A) use the raster::aggregate
function
> 0.008333333/0.002083333
[1] 4
Elevation_res<-aggregate(Elevation, fact=4, fun=mean)
and the raster::extend
function
Elevation_res<-extend(Elevation_res, Ann_precip, values=NA)
(although here I still get different but very similar extents and resolutions):
> res(Elevation_res)
[1] 0.008333333 0.008333333
> res(Ann_precip)
[1] 0.008333333 0.008333333
> res(Elevation_res)==res(Ann_precip)
[1] FALSE FALSE
> extent(Elevation_res)
class : Extent
xmin : -15.07722
xmax : -7.635556
ymin : 7.193611
ymax : 12.67694
> extent(Ann_precip)
class : Extent
xmin : -15.075
xmax : -7.641667
ymin : 7.191667
ymax : 12.675
or
b) use the raster::resample
function
Elevation_res<-resample(Elevation, Ann_precip, method="bilinear")
> res(Elevation_res)==res(Ann_precip)
[1] TRUE TRUE
> extent(Elevation_res)==extent(Ann_precip)
[1] TRUE
I'm asking this because I've read in Wegmann et al (2016) (p110) (if I understand correctly) that resampling greatly affects pixel values, and that aggregate()
,extend()
and crop()
should be used instead.
Since differences in resolution and extent are quite small in my case, can I assume that bias created by resampling would be minimal here?