This function takes in a trained emulator - a structure of class fldgen. This structure contains everything the emulator has learned about the model, and is used to generate new fields of residuals. Also taking in a list of generated residual fields and a global average yield, a global gridded mean field is constructed accoring to the input reconstruction_function. The mean field and residual fields are added to return a list of different realizations of full fields.

generate.TP.fullgrids(
  emulator,
  residgrids,
  tgav,
  tvarunconvert_fcn = NULL,
  pvarunconvert_fcn = exp,
  reconstruction_function = pscl_apply
)

Arguments

emulator

A trained fldgen temperature precipitation joint emulator.

residgrids

A list of new residual fields, each entry in the list is a new realization, a matrix that is [Nyears x 2 * Ngrid]; the first 1:Ngrid cols are the temperature residuals and columns (Ngrid + 1):(2*Ngrid) are the precipitation residuals.

tgav

A vector (or N x 1 matrix) of global mean temperatures, used to calculate the mean warming response field.

tvarunconvert_fcn

The function to undo any transformation done to the input training data in trainTP to correct the support. This should be the inverse function of the tvarconvert_fcn argument to trainTP. This is stored in a trainTP emulator under emulator$griddattaT$tvarconvert_fcn. Defaults to NULL as temperature typically doesn't need to be transformed to correct the support. WARNING: currently rely on the user to define the correct inverse function here, though we do some checks and throw warnings if it looks like there may be an issue.

pvarunconvert_fcn

The function to undo any transformation done to the input training data in trainTP to correct the support. This should be the inverse function of the pvarconvert_fcn argument to trainTP. This is stored in a trainTP emulator under emulator$griddattaP$pvarconvert_fcn. Defaults to exp() as precipitation is usually log-transformed in ordere to correct the support. WARNING: currently rely on the user to define the correct inverse function here, though we do some checks and throw warnings if it looks like there may be an issue.

reconstruction_function

A function for constructing a mean field from trained pattern scaling result + a vector of global annual mean temperatures.

Value

A list of: 1) fullgrids = A list of new full fields, each entry in the list is a new realization, a matrix that is [Nyears x 2 * Ngrid]; the first 1:Ngrid cols are the temperature field and columns (Ngrid + 1):(2*Ngrid) are the precipitation field. 2) meanfieldT = the reconstructed, pattern scaled temperature mean field. 3) meanfieldP = the reconstructed, pattern scaled precipitation mean field.