R/st_normalize_2d.R

Defines functions normalize_2d

Documented in normalize_2d

#' Normalize a 2D 'stars' object
#'
#' Check, and possibly correct, that the input \code{stars} object:
#' \itemize{
#' \item{Has exactly one attribute.}
#' \item{Has exactly two dimensions.}
#' \item{The dimensions are spatial, named \code{x} and {y} (in that order).}
#' }
#'
#' @param x A \code{stars} object
#'
#' @return A new \code{stars} object
#' @export
#'
#' @examples
#' # Small example
#' data(dem)
#' normalize_2d(dem)

normalize_2d = function(x) {

  # Check & normalize
  x = check_one_attribute(x)
  x = check_2d(x)

  # Return
  return(x)

}

Try the starsExtra package in your browser

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

starsExtra documentation built on Nov. 18, 2021, 5:08 p.m.