Skip to contents

Converts a date string in "MM-DD" format to the corresponding band index for the Greenspace Seasonality Data Cube, which contains 36 bands representing 10-day intervals over a year.

Usage

get_band_index_by_time(time, year)

Arguments

time

Character vector of length 2. (optional) Start and end dates in "MM-DD" format (e.g., c("03-20", "10-15")). Used to subset the 10-day interval data cube by time.

year

numeric. (required) The year of interest.

Value

Interger. a band index.

Details

The Greenspace Data Cube is organized into 36 bands per year, each representing a 10-day interval. This function calculates which of those bands a given date falls into by converting the MM-DD string into the day-of-year (DOY) and dividing by 10 (rounded up).

Examples

get_band_index_by_time(c("03-20", "10-15"), year = 2020)
#> [1]  8 29