Skip to contents

makeFiles takes a base SORTIE parameter file (base xmls) and replaces specific values (new vals) to generate new parameter files (new xmls) to be run in SORTIE.

Usage

makeFiles(
  lstFiles,
  path_basexmls = path_basexmls,
  path_newvals = path_newvals,
  path_newxmls = path_newxmls,
  variable_names = rsortie::VariableNames
)

Arguments

lstFiles

The name of a text file (string) or a data.frame() that contains all the file names to update and be updated

path_basexmls

(optional) the file path to the base parameter file(s) location character()

path_newvals

(optional) the file path to the new value file(s) location character()

path_newxmls

(optional) the file path to the new output parameter file(s) location character()

variable_names

Value

This function will generate new .xml files in the path_newxmls directory, or if path_newxmlsis not defined, the new .xml will be exported to the working directory.

Details

Common use of this function would be to change the number of timesteps, initiate different starting stands, or test the effect of changing the values that define a given behaviour (process)

The makeFiles function requires a table indicating the base SORTIE parameter file (.xml) and the files containing values to replace in the base parameter file. This table can be read from file, with lstFiles() being a string that contains the pathway and file name of the list of files table (i.e. "pathway/listofmyfiles.csv"). If the list of files is held in a data.frame in the R environment (as the example), then lstFiles() requires just the name of that object.

There are two optional pathway arguments available if the required files (base parameter file(s), and new values file(s)) are not yet present in the R environment. makeFiles() will read those files in and translate them into the appropriate format, but requires file directory location be passed by the path_basexml and path_newvals arguments. The path_newxmls is provided to allow users the ability to organize and store newly generated SORTIE parameter files in different directories, but if not passed, the new files will be placed in the working directory.

NOTE - you do not need to assign the makeFiles function to a named object in R, as the output is written to file, not returned as an object.

Examples

exFiles <- data.frame("type"=c(0,1), "name"=c("samplebasexml","gmf_time_new"))
makeFiles(lstFiles=exFiles)
#> [1] "parameter file samplebas-gmf_time.xml created"