Learn R Programming

⚠️There's a newer version (2.8.0) of this package.Take me there.

apsimx: R package for APSIM-X (NextGen) and APSIM Classic (7.x)

This package allows for interaction with APSIM-X ("Next Generation") and/or APSIM 'Classic' (7.10). It can inspect, edit, run and read APSIM files in both platforms. The format is JSON for APSIM-X and XML for 'Classic'.

Package requirements

  • Imported R packages: DBI, jsonlite, knitr, RSQLite, tools, utils, xml2

  • Suggested R packages: BayesianTools, datasets, daymetr, FedData, ggplot2, GSODR, listviewer, maps, mvtnorm, nasapower, nloptr, raster, reactR, rmarkdown, soilDB, sp, spData, sf

  • APSIMX:

  • and/or APSIM (7.x) 'Classic'

NOTE ON REQUIREMENTS:

  • Current (Nov 2021) versions of APSIM Next Gen do not require additional software

to run on Mac or Linux. The dotnet runtime environment is shipped with the image/package.

  • For current versions (Nov 2021), on Windows, the 'Microsoft Windows Desktop Runtime' 3.1.14 is required. The installer also updated GTK3 to 3.24.20 during the installation.

  • For older versions of APSIM Next Gen (before Sept 2021) the mono framework was required to run on Mac and Linux (Debian). Mono should be installed first (in Mac and Linux).

If you are running the latest version of APSIM Next Gen (Sept 2021 or later), you do not need to install the Mono Framework.

Mono framework download: https://www.mono-project.com/download/stable/

.Net Core download for Mac: https://dotnet.microsoft.com/download

APSIMX download: https://www.apsim.info/download-apsim/

Since APSIM Next Gen 2021.04.01 (at least) .NET framework 4.6 or higher is required for Windows and I have had to update the Mono framework to 6.12 on Mac (again this applies to pre Sep 2021).

If you want to install this package from github try in R:

library(devtools)
devtools::install_github("femiguez/apsimx")
library(apsimx)

or the lightweight 'remotes' package

library(remotes)
remotes::install_github("femiguez/apsimx")
library(apsimx)

It is not necessary to build the vignettes as they are also at: https://femiguez.github.io/apsimx-docs/

Note: Building the vignettes does not require the presence of APSIM-X as I have recently eliminated the APSIM-X dependency.

Still, if you want to build the vignettes, then use this instead of the second line above:

devtools::install_github("femiguez/apsimx", build_vignettes = TRUE, build_opts = c("--no-resave-data", "--no-manual"))

If you do build the vignettes, there is an introduction to the package

vignette("apsimx")

and a document which might help you build your own scripts either in R or other languages

vignette("apsimx-scripts")

If you have any questions contact Fernando E. Miguez (femiguez at iastate.edu)

Copy Link

Version

Install

install.packages('apsimx')

Monthly Downloads

1,215

Version

2.2

License

GPL-3

Maintainer

Fernando Miguez

Last Published

December 4th, 2021

Functions in apsimx (2.2)

apsimx_options

Setting some options for the package
apsim.options

Environment which stores APSIM options
apsimx_example

Access Example APSIM-X Simulations
apsimx

Run an APSIM-X simulation
apsimx_filetype

Test file format for .apsimx files
apsim_example

Access Example APSIM Simulations
apsim_version

Display available APSIM ‘Classic’ and APSIM-X versions
apsim

Run an APSIM (7.x) ‘Classic’ simulation
apsimx.options

Environment which stores APSIM-X options
apsim_options

Setting some options specific to APSIM (7.x) ‘Classic’
compare_apsim_soil_profile

Compare two or more soil profiles
apsimx_soil_profile

Create APSIM-X Soil Profiles
grep_json_list

grep but for json list
check_apsim_met

Check a met file for possible errors
get_chirps_apsim_met

Get CHIRPS data for an APSIM met file
get_apsimx_json

fetches the json file for a specific model from APSIMX github
carbon_stocks

Calculate soil carbon stocks
get_ssurgo_tables

Retrieve soil profile data and return a table with data
edit_apsimx

Edit an APSIM-X (JSON) Simulation
edit_apsim_xml

Edit an APSIM (Classic) Simulation auxiliary xml file
get_daymet2_apsim_met

Get DAYMET data for an APSIM met file
doy2date

Converts from doy to date
compare_apsim

Compare two or more apsim output objects
impute_apsim_met

Perform imputation for missing data in a met file
read_apsimx

Read APSIM-X generated .db files
edit_apsimx_replacement

Edit a replacement component in an .apsimx (JSON) file
read_apsimx_all

Read all APSIM-X generated .db files in a directory
compare_apsim_met

Compare two or more metfiles
extract_values_apsimx

Extract values from a parameter path
insert_replacement_node

Inserts a replacement node in a simple apsimx simulation file
get_daymet_apsim_met

Get DAYMET data for an APSIM met file
inspect_apsim

Inspect an .apsim (XML) file
inspect_apsimx

Inspect an .apsimx (JSON) file
get_ssurgo_soil_profile

Retrieve soil profile data and convert it to an object of class ‘soil_profile’
inspect_apsimx_json

Inspect an .apsimx or .json (JSON) file
get_power_apsim_met

Get NASA-POWER data for an APSIM met file
as_apsim_met

Conversion from data frame to met object
napad_apsim_met

Pad a met file with NAs when there are date discontinuities
wop

Wheat example optimization results
mcmc.apsimx.env

Environment to store data for apsimx MCMC
sens_apsim

Sensitivity Analysis for APSIM Next Generation simulation
print.met

Printer-friendly version of a metfile
read_apsim

Read APSIM generated .out files
sens_apsimx

Sensitivity Analysis for APSIM Next Generation simulation
auto_detect_apsimx_examples

Auto detect where apsimx examples are located
edit_apsimx_replace_soil_profile

Edit APSIM-X file with a replaced soil profile
get_isric_soil_profile

Generate a synthetic APSIM soil profile from the ISRIC soil database
edit_apsimx_batch

Edit an APSIM-X (JSON) Simulation in Batch mode
get_iemre_apsim_met

Get weather data from Iowa Environmental Mesonet Reanalysis
auto_detect_apsim_examples

Auto detect where apsim examples are located
ssurgo2sp

Take in SSURGO csv files and create a soil profile
summary.met

Summary for an APSIM met file
edit_apsim_replace_soil_profile

Edit APSIM ‘Classic’ file with a replaced soil profile
edit_apsim

Edit an APSIM (Classic) Simulation
inspect_apsim_xml

Inspect an APSIM Classic auxiliary (XML) file
soilorganicmatter_parms

Helper function to supply additional Soil Organic Matter parameters
read_apsim_all

Read all APSIM generated .out files in a directory
read_apsim_met

Read in an APSIM met file
soilwat_parms

Helper function to supply SoilWat parameters
write_apsim_met

Write an APSIM met file
xargs_apsimx

Provide extra arguments for APSIM-X
wop.h

Wheat example optimization results plus Hessian
optim_apsim

Optimize parameters in an APSIM simulation
tt_apsim_met

Calculates Thermal Time taking a ‘met’ object
view_apsim_xml

View an APSIM Classic auxiliary (XML) file
get_gsod_apsim_met

Get GSOD data for an APSIM met file
swim_parms

Helper function to supply SWIM parameters
obsWheat

Observed wheat phenology, LAI and biomass
get_iem_apsim_met

Get weather data from Iowa Environmental Ag Weather Stations
inspect_apsimx_replacement

Inspect a replacement component in an .apsimx (JSON) file
view_apsimx

Viewing an APSIM-X file interactively
mcmc.apsim.env

Environment to store data for apsim MCMC
optim_apsimx

Optimize parameters in an APSIM Next Generation simulation
unit_conv

performs common unit conversions
view_apsim

Viewing an APSIM Classic file interactively
plot.met

Plot method for object of class ‘met’