Learn R Programming

BioCro

BioCro is a model that predicts plant growth over time given crop-specific parameters and environmental data as input.

It uses models of key physiological and biophysical processes underlying plant growth (Humphries and Long, 1995), and has previously been used for predicting biomass yield and leaf area index of switchgrass and miscanthus (Miguez et al., 2009). In 2022, BioCro was reorganized to take a truly modular approach to modeling (Lochocki et al., 2022) and a new soybean model was developed (Matthews et al., 2022).

BioCro has also been integrated into a suite of tools that link the model directly to crop trait and yield data (LeBauer et al., 2013). The Predictive Ecosystem Analyzer (PEcAn) couples BioCro to the Biofuel Ecophysiological Traits and Yields database.

See References below for a full list of scientific publications using the BioCro framework.

An example

The run_biocro() function accepts initial values, parameters, climate variables, and sets of modules to run. It returns the results in a data frame.

library(BioCro)
library(lattice)

result <- with(soybean, {run_biocro(
  initial_values,
  parameters,
  soybean_weather$'2002',
  direct_modules,
  differential_modules,
  ode_solver
)})

xyplot(Stem + Leaf ~ TTc, data = result, type='l', auto = TRUE)

There are parameters and modules for soybean (Glycine max), miscanthus (Miscanthus x giganteus), and willow (Saliceae salix).

Simple installation

BioCro is available on CRAN, so it can be installed from R as follows:

install.packages('BioCro')

Installation from source

Requirements

  • The R environment version 3.6.0 or greater.
  • On Windows, a version of Rtools appropriate for your version of R.
  • On Linux, gcc and g++ version 4.9.3 or greater (consult documentation for your distribution for installation instructions).
  • On MacOS, Xcode.

Installation steps

  1. Obtain a local copy of this repository, making sure to include the Git submodule code. This can be accomplished using either of two methods:
    1. If you are new to Git, the easiest way to get a local copy is to install GitHub Desktop and use the "Open with GitHub Desktop" option in the "Code" dropdown on the GitHub page for this repository.
    2. Alternatively, clone the repository using Git on the command line in the usual fashion by running git clone https://github.com/biocro/biocro The repository contains a Git submodule, so you will need to take the additional step of running git submodule update --init to obtain it.
  2. Install the BioCro R package using one of the following sets of comands. These assume that the source files are in a directory named "biocro" residing in a parent directory located at "path_to_source_code_parent_directory".
    1. To install from the command line:
      cd path_to_source_code_parent_directory
      R CMD INSTALL biocro
    2. To install from within R:
      setwd('path_to_source_code_parent_directory')
      install.packages('biocro', repos=NULL, type='SOURCE')

Making contributions

Please see the contribution guidelines before submitting changes. These may be found in Chapter One of the Developer's Manual on the public BioCro Documentation web site.

Software Documentation

See the public BioCro Documentation web site. There will be found not only the usual package documentation, but also documentation of the C++ code, including notes on the biological models used in BioCro and their implementation. Also included is documentation for BioCro package developers and maintainers.

There is also a separate page that documents all of the quantities used by the Standard BioCro Module Library.

License

The BioCro R package is licensed under the MIT license, while the BioCro C++ framework is licensed under version 3 or greater of the GNU Lesser General Public License (LGPL). This scheme allows people to freely develop models for any use (public or private) under the MIT license, but any changes to the framework that assembles and solves models must make source code changes available to all users under the LGPL. See LICENSE.note for more details.

Citing BioCro

Appropriate references for BioCro are Miguez et al. (2009) and Lochocki et al. (2022), with details given below. To cite the package itself, use citation('BioCro') in R to get details for the current installed version.

References

Copy Link

Version

Install

install.packages('BioCro')

Monthly Downloads

12,091

Version

3.3.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Justin M. McGrath

Last Published

February 6th, 2026

Functions in BioCro (3.3.1)

module_case_files

Define and modify BioCro module test case files
model_testing

The BioCro model testing system
miscanthus_x_giganteus

Miscanthus model definition
get_growing_season_climate

Truncate weather data to one growing season
module_creators

Create instances of modules
soybean_clock

Soybean-BioCro circadian clock model definition
system_derivatives

Calculate Derivatives for Differential Quantities
module_paste

Prepend library name to module names
module_testing

The BioCro module testing system
soil_parameters

Soil properties
soybean

Soybean-BioCro model definition
run_model_test_cases

Run BioCro model test cases
run_biocro

Simulate Crop Growth with BioCro
test_module

Run BioCro module test cases
willow

Willow model definition
module_write

Generate a BioCro module header file.
obsNaid

Miscanthus assimilation data
Time Variable

The `time` variable in BioCro
modules

BioCro module functions
update_stored_model_results

Updated stored result for a BioCro model test case
obsBeaC

Complete Miscanthus assimilation field data
obsBea

Miscanthus assimilation field data
partial_application

Convenience Functions for Partial Application
test_module_library

Run module test cases for an entire BioCro module library
cmi_soybean_weather_data

Champaign, IL weather data for Soybean-BioCro
dynamical_system

Validating dynamical system inputs
get_all

Get lists of modules, quantities, and solvers
add_time_to_weather_data

Add a time component to input
compare_model_output

Compare new and stored results for a BioCro model test case
model_test_case

Define BioCro model test cases
default_ode_solvers

Default ODE solver settings
cmi_weather_data

Champaign, IL weather data
catm_data

Global annual mean atmopspheric CO2 levels
annualDB

Miscanthus dry biomass data.
crop_model_definitions

Crop model definitions