vignettes/modis_interpolation.Rmd
modis_interpolation.Rmd
use_sites <- c("CH-Dav", "AT-Neu", "US-MMS", "AU-Tum")
"modis_fpar"
: MODIS collection 6,
MCD15A3H, band Fpar_500m
method_interpol = "loess"
)
settings_modis <- get_settings_modis(
bundle = "modis_fpar",
data_path = "~/data/modis_subsets/",
method_interpol = "loess",
keep = TRUE,
overwrite_raw = FALSE,
overwrite_interpol= TRUE,
n_focal = 0,
network = "FLUXNET"
)
Define a function to plot the data.
plot_fapar_ingestr_bysite <- function(df, settings, sitename = NULL){
if (is.null(sitename)) sitename <- df$sitename[[1]]
ddf <- df %>%
pivot_longer(cols = c(linear, spline, loess, sgfilter),
names_to = "method",
values_to = "modisvar_interpol")
gg <- ggplot() +
geom_point( data = df, aes(x = date, y = modisvar), color = "red") +
# geom_point( data = df, aes(x = date, y = modisvar_filled), col = 'blue') +
geom_point( data = df, aes(x = date, y = modisvar_filtered), color = "black") +
# geom_line( data = ddf, aes(x = date, y = modisvar_interpol, color = method)) +
# geom_line( data = df, aes(x = date, y = linear, color = "linear")) +
geom_line( data = df, aes(x = date, y = spline, color = "Spline")) +
geom_line( data = df, aes(x = date, y = loess, color = "LOESS")) +
# geom_line( data = df, aes(x = date, y = sgfilter), col = 'green') +
labs(x = "Date", y = settings$varnam,
title = sitename, subtitle = paste(settings$prod, settings$band_var)) +
scale_color_manual(name = "Interpolation",
breaks = c("LOESS", "Spline"),
# breaks = c("linear", "spline", "loess"),
# values = c("linear" = "red", "spline" = "cyan", "loess" = "blue") )
values = c("LOESS" = "springgreen3", "Spline" = "royalblue") )
ylim(0, max(df$modisvar, na.rm = TRUE))
return(gg)
}