#set path to EBV netCDF
file <- system.file(file.path("extdata","martins_comcom_subset.nc"),
package="ebvcube")
#get all datacubepaths of EBV netCDF
datacubes <- ebv_datacubepaths(file, verbose=FALSE)
#define different resolutions
res1 <- system.file(file.path("extdata",
"baisero_spepop_id5_20220405_v1_empty.nc"), package="ebvcube")
res2 <- c(0.5,0.5,4326)
#define output path
out <- file.path(system.file(package='ebvcube'),"extdata","changeRes.tif")
if (FALSE) {
#resample defining the resolution and EPSG code by hand - return SpatRaster
data_raster <- ebv_resample(filepath_src = file, datacubepath_src = datacubes[1,1],
entity_src=1, timestep_src = 1, resolution = res2,
outputpath = out, method='near', return_raster=TRUE,
overwrite=TRUE)
#resample using a netCDF file - return GeoTiff
ebv_resample(filepath_src = file, datacubepath_src = datacubes[1,1],
entity_src=1, timestep_src = 1, resolution = res1,
outputpath = out, overwrite=TRUE)
}
Run the code above in your browser using DataLab