View source: R/ndvi_extraction.R
This function matches NDVI values to spatial point data. It will return:
1. iNDVI: interpolated NDVI, giving the estimated value of NDVI if the date of the spatial data falls in between the dates of NDVI layers (which are produced at 16 day intervals)
2. dNDVI: delta NDVI describes the change in NDVI between the closest date layer and the layer previous
3. aNDVI: anomally NDVI is (iNDVI-mNDVI)/mNDVI where mNDVI is the long-term mean NDVI value for the given cell
4. cNDVI: cummulative NDVI is the sum of the raw NDVI value for a given number of NDVI files backwards from the observation date
The function is most accurate using projected data, i.e. both the NDVI files and point data should be in UTM (or similar). The function will still work if the data are in latlong, however there may be some cases where the values returned are associated with a neighbouring NDVI cell. This is due to rounding issues.
The code used in this function is based off code written by Jon Lindsay and Thomas Morrison.
1 2 3 4 5 6 7 8 9 10 | ndvi_extraction(
files_desc,
array,
extent,
resolution,
avg_matrix = NULL,
cndvi_range = NA,
date,
coords
)
|
files_desc |
object returned from build_ndvi_desc |
array |
an array with dimensions 1 and 2 being the y and x values (respectively) of the rasters layers identified in files_desc, the 3rd dimension is multiple dates for same spatial extent. Build using build_ndvi_array |
extent |
an extent object. contains xmin, xmax, ymin, ymax of the raster layers used to make the array |
resolution |
a vector with 2 values indicating the x and y resolution of each raster cell |
avg_matrix |
(default: NULL) if calculating anomally NDVI this is a matrix with the long-term mean NDVI values |
cndvi_range |
(default: NA) if calculating cummulative NDVI, this is the number of scenes back to include |
date |
a vector of the dates |
coords |
a 2 column matrix/dataframe with the x and y coordinates in same projection as extent |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.