lsGetDates: Return the capturing dates of Landsat-7 or Landsat-8 images

Description Usage Arguments Details Value Examples

View source: R/genMissionGetDates.R

Description

lsGetDates reads the official name of a Landsat-7 or Landsat-8 image and returns the capturing date, as a Date class object.

Usage

1

Arguments

str

the full path(s) or official name(s) of the Landsat-7 or Landsat-8 images from which the capturing date is retrieved.

...

arguments for nested functions:

  • format the format of the date being returned.

Details

The function works with file names (or their paths) regardless of their extension. The function accepts more than on file path, which can be passed as a vector of characters. Dates are returned as 'YYYY-mm-dd' by default. If another format is required, it can be modified through the argument format.

Value

a Date class object with the date of the Landsat image or character class, if the format argument is used.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# getting the capturing date from the name of a Landsat-8 image
file.ls8 <- "LC82000312017010LGN01.tar.gz"
date.ls8 <- lsGetDates(file.ls8)
print(date.ls8)
print(format(date.ls8, "%Y%j"))

# getting the capturing date from the name of a Landsat-7 and a Landsat-8
# image
file.ls7 <- c("LE72330822017009ASN01")
date.ls7 <- lsGetDates(file.ls7)
print(date.ls7)

RGISTools documentation built on July 2, 2020, 3:58 a.m.