Learn R Programming

RGISTools (version 1.0.2)

senGetDates: Return the capturing dates of Sentinel-2 images

Description

senGetDates reads the official name of a Sentinel-2 image and returns the capturing date, as a Date class object.

Usage

senGetDates(str, ...)

Arguments

str

the full path(s) or official name(s) of the Sentinel images from which the capturing date is retrieved.

...

arguments for nested functions:

  • format the format of the date being returned.

Value

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

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.

Examples

Run this code
# NOT RUN {
# getting the capturing date from the name of Sentinel-2 images
file.sen <- c("S2A_MSIL1C_20170102T111442_N0204_R137_T30TWN_20170102T111441.SAFE",
              "S2A_OPER_PRD_MSIL1C_PDMC_20160308T090616_R094_V20160305T110109_20160305T110109")
date.sen <- senGetDates(file.sen)
print(date.sen)
print(format(date.sen,"%Y%j"))
senGetDates(file.sen, format = "%Y%j")

# }

Run the code above in your browser using DataLab