View source: R/genMissionGetDates.R
| lsGetDates | R Documentation |
lsGetDates reads the official name of a Landsat-7 or Landsat-8 image
and returns the capturing date, as a Date class object.
lsGetDates(str, ...)
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:
|
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.
a Date class object with the date of the Landsat image or character class,
if the format argument is used.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.