
Last chance! 50% off unlimited learning
Sale ends in
Given a SpatRaster, this function will verify the naming scheme and check that all required rasters are present.
verifyRasterNames(
masterstack = NULL,
solradstack = NULL,
monthPET = NULL,
returnRasters = FALSE
)
Prints messages to the console if returnRasters = FALSE
,
If returnRasters = TRUE
, then a SpatRaster is returned. This SpatRaster
will not include rasters that were deemed unnecessary.
SpatRaster containing all precipitation, min temperature, max temperature, and (optionally) mean temperature variables.
SpatRaster of monthly solar radiation
SpatRaster of monthly potential evapotranspiration
if FALSE
, the function checks names
and reports back. If TRUE
, a SpatRaster is returned with
standardized names.
Pascal Title
This function checks that the following are present:
12 precipitation rasters
12 min temperature rasters
12 max temperature rasters
12 mean temperature rasters [optional]
12 solar radiation rasters
12 PET rasters [optional]
The naming scheme will be checked against the one
defined via the custom naming environment. See link{?assignNames}
for additional details.
The function can test the temp/precip SpatRaster and/or the solar radiation SpatRaster separately, or simultaneously.
# Find example rasters
rasterFiles <- list.files(system.file('extdata', package='envirem'), full.names=TRUE)
# create stack of temperature and precipitation rasters
# and stack of solar radiation rasters
solradFiles <- grep('solrad', rasterFiles, value=TRUE)
worldclim <- rast(setdiff(rasterFiles, solradFiles))
solar <- rast(solradFiles)
# modify naming
names(worldclim) <- gsub('tmin_', 'minTemp', names(worldclim))
names(worldclim) <- paste0(names(worldclim), '_v1.0')
names(solar) <- gsub('et_solrad_', 'solar_', names(solar))
# but don't specify this change
namingScheme()
# Run check
verifyRasterNames(masterstack = worldclim, solradstack = solar, returnRasters = FALSE)
# But if we specify our naming scheme
assignNames(tmin = 'minTemp##_v1.0', tmax = 'tmax_##_v1.0', tmean = 'tmean_##_v1.0',
solrad = 'solar_##', precip = 'prec_##_v1.0')
namingScheme()
verifyRasterNames(masterstack = worldclim, solradstack = solar, returnRasters = FALSE)
# set back to defaults
assignNames(reset = TRUE)
Run the code above in your browser using DataLab