df: a valid MODISTools data frame with a single band (filter for a particular band using the dplyr filter() function or base subset()
reproject: reproject output to lat / long (default = FALSE)
method: character. Method used for estimating the new cell values of a SpatRaster. One of: near: nearest neighbor. This method is fast, and it can be the preferred method if the cell values represent classes. It is not a good choice for continuous values. This is used by default if the first layer of x is categorical. bilinear: bilinear interpolation. This is the default if the first layer of x is numeric (not categorical). cubic: cubic interpolation. cubicspline: cubic spline interpolation.
Returns
A terra SpatRaster populated with the tidy dataframe values
Examples
# list all available MODIS Land Products Subsets products# download dataLC <- mt_subset(product ="MCD12Q1", lat =48.383662, lon =2.610250, band ="LC_Type1", start ="2005-01-01", end ="2005-12-30", km_lr =2, km_ab =2, site_name ="testsite", internal =TRUE, progress =FALSE)head(LC)# convert to rasterLC_r <- mt_to_terra(df = LC)