Learn R Programming

RGISTools (version 0.9.7)

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

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

lsGetDates(str, ...)

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 character vector. Dates are returned as `YYYY-mm-dd' by default. If another format is required, it can be modified through the argument format.

Examples

Run this code
# NOT RUN {
# getting the capturing date from the name of a Landsat-8 image
str <- "LC82000312017010LGN01.tar.gz"
dt <- lsGetDates(str)
print(dt)
print(format(dt, "%Y%j"))

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

# }

Run the code above in your browser using DataLab