The Dynamic Agroforestry Coffee Crop Model in Julia
Author VEZY
3 Stars
Updated Last
2 Years Ago
Started In
July 2019

DynACof: The Dynamic Agroforestry Coffee Crop Model logo

Stable Dev CI Codecov


DynACof is a process-based model that computes plot-scale Net Primary Productivity, carbon allocation, growth, yield, energy, and water balance of coffee plantations according to management, while accounting for spatial effects using metamodels from the 3D process-based MAESPA. The model also uses coffee bud and fruit cohorts for reproductive development to better represent fruit carbon demand distribution along the year.

This is the Julia version of the DynACof model, the only one that is maintained. To get to the (unmaintained) R version, please follow this link.


To download DynACof, simply execute these lines of code in the REPL:

using Pkg; Pkg.add("DynACof")

The package is tested routinely to pass all tests using Github actions.


This is a basic example using the parameters and meteorology from Vezy et al. (2019). First, you have to download the data from this Github repository.

Then, simply execute this line of code to run a simulation over the whole period:

using DynACof
Sim, Meteo, Parameters= dynacof(input_path= "the_path_where_you_downloaded_the_data/DynACof.jl_inputs",
                                file_name= (constants= "constants.jl",site="site.jl",meteo="meteorology.txt",

To use your own data, you have to tell DynACof where to find it using the input_path argument, and what are the file names with the file_name argument. A separate Github repository is available for input files templates, and some help on how to proceed.

Example of a simulation without shade trees:

Sim, Meteo, Parameters= dynacof(input_path= "the_path_where_you_downloaded_the_data/DynACof.jl_inputs",
                                file_name= (constants= "constants.jl",site="site.jl",meteo="meteorology.txt",


The model first computes the shade tree, then the coffee and then the soil. So if you need to update the metamodels, please keep in mind that the state of soil of a given day is only accessible on the next day for the tree and the coffee, unless the code is updated too. The model is implemented like this for simplicity, based on the hypothesis that the soil has a rather slow dynamic compared to plants dynamics.

Code of conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


The DynACof model was mainly developed thanks to the MACCAC project[1], which was funded by the french ANR (Agence Nationale de la Recherche). The authors were funded by CIRAD[2] and INRA[3]. The authors are grateful for the support of the Aquiares farm and the CATIE[4] for the long-term coffee agroforestry trial, the SOERE F-ORE-T which is supported annually by Ecofor, Allenvi and the French national research infrastructure ANAEE-F; the CIRAD-IRD-SAFSE project (France) and the PCP platform of CATIE. CoffeeFlux observatory was supported and managed by CIRAD researchers. We are grateful to the staff from Costa-Rica, in particular Alvaro Barquero, Alejandra Barquero, Jenny Barquero, Alexis Perez, Guillermo Ramirez, Rafael Acuna, Manuel Jara, Alonso Barquero for their technical and field support.

The DynACof logo was made using LogoMakr.com

  1. MACACC project ANR-13-AGRO-0005, Viabilité et Adaptation des Ecosystèmes Productifs, Territoires et Ressources face aux Changements Globaux AGROBIOSPHERE 2013 program

  2. Centre de Coopération Internationale en Recherche Agronomique pour le Développement

  3. Institut National de la Recherche Agronomique

  4. Centro Agronómico Tropical de Investigación y Enseñanza