Learn R Programming

apsimx (version 2.2)

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,
  edit.tag = "-edited",
  overwrite = FALSE,
  verbose = TRUE
)

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

edit.tag

default edit tag ‘-edited’

overwrite

default FALSE

verbose

default TRUE. Will print messages indicating what was done.

Value

writes an APSIM file to disk with the supplied soil profile

Details

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

Examples

Run this code
# NOT RUN {
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")
 
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab