Compute a vector of indices of "year" or "month" based on the date extracted from the SpatRaster or a vector of strings over the time period.
get_layer_indice(
x = NULL,
pattern = NULL,
date_format = "%Y-%m-%d",
indice_level = "year",
week_start = getOption("lubridate.week.start", 1)
)
SpatRaster or a vector of dates, from which to extract the dates of the time-series.
string or characters to remove from the date name (e.g. remove the character "X" from "X2001.07.15"), default is null.
format of the date
string to define the time-period to use to define the indices, "year" or "month".
option of lubridate starting day of the week, where 1 is Monday and 7 is Sunday.
This function generate a vector of indices dividing the time-series in years or months. This indices are use for the calculating the cummulative sum over years or month (see function cumsum_rb()).