Learn R Programming

apsimx (version 2.8.0)

edit_apsim_replace_soil_profile: Edit APSIM ‘Classic’ file with a replaced soil profile

Description

Edits an APSIM Classic simulation by replacing the soil profile

Usage

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

Value

writes an APSIM file to disk with the supplied soil profile

Arguments

file

name of the .apsim file to be edited

src.dir

source directory

wrt.dir

writing directory

soil.profile

a soil profile object with class ‘soil_profile’

swim

list with SWIM specific parameters

soilwat

list with SoilWat specific parameters

initialwater

list with InitialWater specific parameters

edit.tag

default edit tag ‘-edited’

overwrite

default FALSE

verbose

default TRUE. Will print messages indicating what was done.

root

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

Details

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

Examples

Run this code
# \donttest{
sp <- apsimx_soil_profile(nlayers = 20,
                          crops = c("Barley", "Chickpea", "Lucerne", 
                          "Maize", "Perennial Grass", "Sorghum", 
                          "Wheat", "Millet"))

extd.dir <- system.file("extdata", package = "apsimx")

## Writing to a temp directory
tmp.dir <- tempdir()
edit_apsim_replace_soil_profile("Millet.apsim", soil.profile = sp, 
                                edit.tag = "-newsoil",
                                src.dir = extd.dir, 
                                wrt.dir = tmp.dir)
                                
inspect_apsim("Millet-newsoil.apsim", src.dir = tmp.dir,
              node = "Soil", soil.child = "Water")
 # }

Run the code above in your browser using DataLab