predict_per_tiles: Derive daily space-time predictions at standard soil depths

View source: R/AgroSoil_generic_functions.R

predict_per_tilesR Documentation

Derive daily space-time predictions at standard soil depths

Description

Derives daily gridded distribution of soil moisture at standard soil depth intervals for a list of spatial tiles.

Usage

predict_per_tiles(
  i,
  model_,
  in_path,
  out_path,
  targ_var,
  method,
  days_,
  month_,
  month.lst_,
  pred.year_,
  rds_file,
  DDepth,
  stdps = c(5, 15, 30, 60, 100),
  weather_data = FALSE,
  weather_source = "ERA5",
  era5_depth = FALSE
)

Arguments

i

Vector of spatial tile IDs

model_

Saved model (random forest or xgboost models) to be used for spatial predictions on the larger grid or stacked tile grids (.rds file)

in_path

Directory holding the stacked spatial tiles

out_path

Directory holding the stacked spatial tiles. Just to keep predictions with their respective stacked covariates.

targ_var

Target variable to predict

method

Machine learning algorithm to be used for the prediction. Values are "ranger" and "xgboost". Default value is "ranger" random forest algorithm.

days_

Numeric. Days in the respective month of the targetted soil moisture prediction year. Default values are all days in the respective month of the year

month_

Character. Single month of the targetted soil moisture prediction year.Default value is the months of the in situ soil moisture meansurement. Values are abbreviated month name. E.g. "Jan", "Mar", "Oct".

month.lst_

Vector or a list. All months of the targetted soil moisture prediction year.

pred.year_

Numeric. Single soil moisture prediction year

rds_file

Saved stacked-spatial tile of covariates (i.e. prediction grid)

DDepth

TRUE/FALSE. Whether to predict for top soils (FALSE) or for specific standard soil depths (TRUE).

stdps

Vector. Numeric values of standard soil depths at which predictions are required. Default values are c(0,5,15,30,60,100,200)

Examples

library(rgdal)
library(raster)
library(lubridate)
library(plyr)
library(caret)

out <- predict_per_tiles(i, model_, in_path, out_path, targ_var, method, days_, month_, month.lst_,pred.year_, rds_file, DDepth, stdps)

kanj241/agrosoil documentation built on March 25, 2022, 12:22 a.m.