Using filtered NDVI time series, scale it to 0-1.

scale_ndvi(DT)

Arguments

DT

data.table of NDVI time series

Value

data.table with appended 'scaled' column of 0-1 scaled NDVI.

Details

This functions expects the input DT is the output of previous four filtering steps, or filter_ndvi.

See also

Other scale: scale_doy()

Examples

# Load data.table
library(data.table)

# Read in example data
ndvi <- fread(system.file("extdata", "sampled-ndvi-MODIS-MOD13Q1.csv", package = "irg"))

# Filter and scale NDVI time series
filter_ndvi(ndvi)
#>      id   NDVI SummaryQA DayOfYear   yr  filtered    winter    rolled       top
#>   1:  0 0.1864         3        11 2015 0.3076500 0.3076500 0.3076500 0.8735000
#>   2:  1 0.0541         2         3 2015 0.3163400 0.3163400 0.3163400 0.8632175
#>   3:  2 0.1781         3        11 2015 0.2649875 0.2649875 0.2649875 0.8707500
#>   4:  3 0.1024         2         5 2015 0.2301750 0.2301750 0.2301750 0.8635525
#>   5:  4 0.0898         2         3 2015 0.2177150 0.2177150 0.2177150 0.8476000
#>  ---                                                                           
#> 801:  2 0.1179         2       364 2019 0.2649875 0.2649875 0.2649875 0.8707500
#> 802:  3 0.0789         2       364 2019 0.2301750 0.2301750 0.2301750 0.8635525
#> 803:  4 0.1572         2       364 2019 0.2177150 0.2177150 0.2177150 0.8476000
#> 804:  5 0.0763         2       364 2019 0.3163400 0.3163400 0.3163400 0.8632175
#> 805:  6 0.1197         2       362 2019 0.3149325 0.3149325 0.3149325 0.8632000
scale_ndvi(ndvi)
#>      id   NDVI SummaryQA DayOfYear   yr  filtered    winter    rolled       top
#>   1:  0 0.1864         3        11 2015 0.3076500 0.3076500 0.3076500 0.8735000
#>   2:  1 0.0541         2         3 2015 0.3163400 0.3163400 0.3163400 0.8632175
#>   3:  2 0.1781         3        11 2015 0.2649875 0.2649875 0.2649875 0.8707500
#>   4:  3 0.1024         2         5 2015 0.2301750 0.2301750 0.2301750 0.8635525
#>   5:  4 0.0898         2         3 2015 0.2177150 0.2177150 0.2177150 0.8476000
#>  ---                                                                           
#> 801:  2 0.1179         2       364 2019 0.2649875 0.2649875 0.2649875 0.8707500
#> 802:  3 0.0789         2       364 2019 0.2301750 0.2301750 0.2301750 0.8635525
#> 803:  4 0.1572         2       364 2019 0.2177150 0.2177150 0.2177150 0.8476000
#> 804:  5 0.0763         2       364 2019 0.3163400 0.3163400 0.3163400 0.8632175
#> 805:  6 0.1197         2       362 2019 0.3149325 0.3149325 0.3149325 0.8632000
#>      scaled
#>   1:      0
#>   2:      0
#>   3:      0
#>   4:      0
#>   5:      0
#>  ---       
#> 801:      0
#> 802:      0
#> 803:      0
#> 804:      0
#> 805:      0