R/get_landsat_mtl.R

Defines functions get_landsat_mtl

Documented in get_landsat_mtl

#' Retrieves metadata from a Landsat *_MTL.txt file
#'
#' @description
#' Reads metadata from Landsat-8, -9 (more soon) and outputs to an object
#'
#' @param file Path (character vector) to Landsat ..MTL.txt file
#' @return Object of class MetaData_LS
#' @export
#'

get_landsat_mtl <- function(file) {
  #
  if (!file.exists(file)) {
    stop("File not found...")
  }
  if (!grep(pattern = "MTL.txt", x = file)) {
    stop("File is not a _MTL.txt metadata file")
  }
  data <- readr::read_lines(file)

}
brownhr/tidyRS documentation built on Feb. 19, 2022, 12:35 a.m.