Learn R Programming

apsimx (version 2.2)

edit_apsimx_replace_soil_profile: Edit APSIM-X file with a replaced soil profile

Description

Edits an APSIM-X simulation by replacing the soil profile

Usage

edit_apsimx_replace_soil_profile(
  file = "",
  src.dir = ".",
  wrt.dir = NULL,
  soil.profile = NULL,
  edit.tag = "-edited",
  overwrite = FALSE,
  verbose = TRUE,
  root
)

Arguments

file

name of the .apsimx file to be edited

src.dir

source directory

wrt.dir

writing directory

soil.profile

a soil profile object with class ‘soil_profile’

edit.tag

default edit tag ‘-edited’

overwrite

default FALSE

verbose

default TRUE and it will print messages to console

root

supply the node postion in the case of multiple simulations such as factorials.

Value

writes a file to disk with the supplied soil profile

Details

This function is designed to batch replace the whole soil in an APSIM simulation file.

Examples

Run this code
# NOT RUN {
sp <- apsimx_soil_profile()
extd.dir <- system.file("extdata", package = "apsimx")

## I write to a temp directory but replace as needed
tmp.dir <- tempdir()

edit_apsimx_replace_soil_profile("Maize.apsimx", soil.profile = sp, 
                                  src.dir = extd.dir, wrt.dir = tmp.dir)
inspect_apsimx("Maize-edited.apsimx", src.dir = tmp.dir,
                 node = "Soil")
 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab