This function runs all of the steps in the analysis that depend only on the input data. The results are saved in a structure of class fldgen. This structure contains everything the emulator has learned about the model. Therefore, it can be saved and reloaded in future sessions to bypass the analysis step.

train(
  dat,
  latvar = "lat",
  lonvar = "lon",
  meanfield = pscl_analyze,
  record_absolute = FALSE
)

Arguments

dat

A single directory name, or a list of netCDF files. If a directory name is given, all netCDF files in the directory will be used.

latvar

Name of the latitude coordinate variable in the netCDF files. Normally this is 'lat', but occasionally it will be something different, such as 'lat_2'.

lonvar

Name of the longitude coordinate variable in the netCDF files.

meanfield

Function to compute the mean temperature response field. The default is a linear pattern scaling algorithm.

record_absolute

If TRUE, record absolute paths for the input files; otherwise, record relative paths.

Value

A fldgen object.

Details

The steps run by this procedure are read.temperatures, pscl_analyze, and eof_analyze. Additionally, the global mean temperature and the FFT of the EOF decomposition are calculated and stored. For backward compatibility, all of those functions remain part of the public interface.

At present the field generation functions still take as arguments the individual components of the structure; however, in the next version they will expect a fldgen object, which can be constructed manually using fldgen_object.

The names of the input files are recorded in the infiles field of the returned object. This is for the your information only; none of the code here does anything with the recorded filenames. You have the choice of recording either absolute filenames (useful for determining exactly which dataset was used, if you have a lot of similarly named files) or relative filenames (useful if you might distribute a saved model to other users who might not have the same directory structure as you).