trainTP.Rd
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.
trainTP( dat, tvarname = "tas", tlatvar = "lat", tlonvar = "lon", tvarconvert_fcn = NULL, pvarname = "pr", platvar = "lat", plonvar = "lon", pvarconvert_fcn = logPfloor, meanfield = pscl_analyze, globalAvg_file = NULL, record_absolute = FALSE )
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.The pairing of temperature and precipitation netCDF files in the directory relies on the CMIP5 file naming conventions. Other naming conventions are not currently supported. |
---|---|
tvarname | Name of the temperature variable in the temperature netCDF |
tlatvar | Name of the latitude coordinate variable in the temperature
netCDF files.
Normally this is |
tlonvar | Name of the longitude coordinate variable in the temperature netCDF files. Can vary between paired T and P. |
tvarconvert_fcn | The function used to transform the T variable prior to training so that it has support on -infinity to infinity. Defaults to NULL, as Temperature is effectively already supported on this range. |
pvarname | Name of the precipitation variable in the precipitation netCDF. |
platvar | Name of the latitude coordinate variable in the precipitation
netCDF files.
Normally this is |
plonvar | Name of the longitude coordinate variable in precipitation netCDF files. Can vary between paired T and P. |
pvarconvert_fcn | The function used to transform the P variable prior to analyis so that it has support on -infinity to infinity. Defaults to log() as precipitation values cannot be less than 0. |
meanfield | Function to compute the mean temperature response field. The default is a linear pattern scaling algorithm. |
globalAvg_file | Optional string to use in constructing the name of the file containing global mean temperatures, Tgav. If omitted, calculate Tgav as the mean of the grid cells in each frame. (See "Supplying global mean temperatures" for more information.) |
record_absolute | If |
A fldgen
object.
The steps run by this procedure are read.general
,
pscl_analyze
, and eof_analyze
. Additionally,
the global mean temperature, global mean precipitation, 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).
In some cases it may be desirable to supply global mean temperatures, rather than calculating them from the grid. For example, the grid may cover only part of the grid, so that the average of the values would not be a true global average. In such cases the true global mean temperatures can be supplied in a separate file.
If this input file is used, it should be a plain text file with one
temperature value per line, each line corresponding to one time slice in the
corresponding netCDF file containing the grid data. The name of the file
will be constructed by adding a suffix (specified in the
globalAvg_file
argument) to the name of the netCDF file. For example,
if the netCDF file is called larry.nc
, and the suffix is
curly.txt
, the name of the global mean temperature file will be
larry.nccurly.txt
. If multiple netCDF files are passed in, each one
will have its own file of global mean temperatures, constructed in the same
way.