Learn R Programming

RGISTools (version 0.9.7)

modGetDates: Return the capturing dates of MODIS images

Description

modGetDates reads the official name of MODIS images and returns its capturing date, as Date class object.

Usage

modGetDates(str, ...)

Arguments

str

the full path(s) or official name(s) of MODIS 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 list 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 a MODIS image
imgPath <- 'MYD13A2.A2016361.h17v04.006.2017285133407.hdf'
modGetDates(imgPath)

# a list of the full file paths of MODIS images, mixing .hdf and .tif files
imgsPaths<-list('MYD13A2.A2013297.h17v04.006.2015269230726.hdf',
                'MYD13A2.A2013313.h17v04.006.2015271071143.tif')
modGetDates(imgsPaths, format = "%Y%j")
# }

Run the code above in your browser using DataLab