Skip to contents

This function helps to create the training dataset of specific variable type and locations for downscaling. TODO: Add a ratio argument (training sample size/total sample size) so that we could calculate the out-of-sample accuracy.

Usage

prepare_train_dat(pts, analysis, covariates.dir, variable)

Arguments

pts

spatialpoints: spatial points returned by `terra::vectors` function.

analysis

numeric: data frame (rows: ensemble member; columns: site*state_variables) of updated ensemble analysis results from the `sda_enkf` function.

covariates.dir

character: path to the exported covariates GeoTIFF file.

variable

character: name of state variable. It should match up with the column names of the analysis data frame.

Value

matrix (num.sites, num.variables * num.ensemble + num.covariates) within which the first sets of columns contain values of state variables for each ensemble member of every site, and the rest columns contain the corresponding covariates.

Author

Dongchen Zhang