R/timename.R

Defines functions timename

Documented in timename

#' Create a name with time stamp
#'
#' @param x SpatRaster with time attribute
#' @param model character - name of model
#' @param desc character - additional description (optional)
#' @family Helper
#' @keywords internal

timename <- function(x, model, desc = NULL) {

  time <- terra::time(x)

  if (!is.null(desc)) model <- paste(model, desc, "_")

  newname <- paste0(model, "_", gsub("-", "", paste(time)))

  return(newname)

}

Try the PHENTHAUproc package in your browser

Any scripts or data that you put into this service are public.

PHENTHAUproc documentation built on June 22, 2024, 7:12 p.m.