This is a reference book for the models implemented in medfate and medfateland, two R packages that provide functions for the simulation of functioning and dynamics of Mediterranean forests and landscapes.

How to use this book

This reference book is meant to help you understand the static and dynamic models included in packages medfate (ver. 4.4.0) and medfateland (ver. 2.4.4). Hands-on user guides to run simulation functions and static functions can be found as package vignettes within the packages. As any reference book, you are not expected to read the book linearly, but to jump to specific book sections whenever you have doubts about the design or implementation of certain processes or calculations.

The first part of the book presents the main functions of the package and describes the soil, vegetation and weather inputs that apply to all simulation models. After that, the book presents in detail each simulation model using a set of chapters. The first of those provides an overview of the model design and the remaining ones describe the details of formulations by groups of related processes. Process formulations that are common to more than one model are described only once, to avoid repeating material already presented, but links are provided whenever needed. Static models and their corresponding R functions are presented grouped at the end of the book, before the appendices, which include parameter estimation information and a list of all symbols for reference.

In this book we use objectname or variablename to refer to an R objects or a variable within data frames, and functionname() to refer to a package function. Whenever relevant, we indicate the correspondence between mathematical symbols, their units and the names used within the R package.

Our aim is to continuously update this reference book along with package developments, so that users have detailed and up-to-date information about the models at the time functions are run. Since the book evolves with the package, after any model application we recommend users to store a PDF version of the reference book to be sure it matches the version the package reported in their application report or article.

An collaborative project

You should look at medfate, medfateland and associated R packages as an ongoing research project for the development of forest ecosystem modelling tools. The models included in the package may contain bugs, and provide wrong predictions (all models are wrong, remember?). Package functions may evolve in the future, so that you may have to modify your scripts after package updates (hopefully not too often). Nevertheless, we feel the tool is mature enough to become useful for applications and that is why we made an effort to document it thoroughly.

The set of R packages are developed and maintained by the Ecosystem Modelling Facility unit at CREAF (in Spain), in close collaboration with researchers from URFM-INRAE (in France) and CTFC (in Spain):

At the individual level, the R packages are the result of collaborative work between modelers and experts in different disciplines. The following is a list of researchers that have contributed to the project with ideas, data or code:

  • Jordi Martínez-Vilalta (CREAF-UAB, Spain)
  • Maurizio Mencuccini (CREAF-ICREA, Spain)
  • Juli G. Pausas (CIDE-CSIC, Spain)
  • Pilar Llorens (CSIC, Spain)
  • Rafa Poyatos (CREAF, Spain)
  • Lluís Brotons (CREAF-CSIC, Spain)
  • Antoine Cabon (WSL, Switzerland)
  • Roberto Molowny (EMF-CREAF, Spain)
  • Victor Granda (EMF-CREAF, Spain)
  • Adriana Tovar (EMF-CREAF, Spain)
  • Alicia Forner (MNCN-CSIC, Spain)
  • Lluís Coll (UdL, Spain)
  • Pere Casals (CTFC, Spain)
  • Mario Beltrán (CTFC, Spain)
  • Jean-Marc Limousin (CEFE, France)
  • Aitor Améztegui (UdL, Spain)
  • Nicolas Martin-StPaul (INRAE, France)
  • Hervé Cochard (INRAE, France)
  • Julien Ruffault (INRAE, France)
  • François Pimont (INRAE, France)
  • Shengli Huang (USDA, USA)
  • Enric Batllori (UB-CREAF, Spain)
  • Santi Sabaté (UB-CREAF, Spain)
  • Daniel Nadal-Sala (UB, Spain)
  • Maria González Sanchis (UVA, Spain)
  • Daniel Caviedes-Voullième (Forschungszentrum Julich, Germany)
  • Mario Morales-Hernández (U Zaragoza, Spain)
  • Mario Morales (UdZ, Spain)
  • Raúl García Valdés (URJC, Spain)
  • Josep Mª Espelta (CREAF, Spain)
  • Francisco Lloret (CREAF, Spain)
  • Teresa Valor (CTFC, Spain)

If your own expertise includes any of the processes that are modeled in the package and you feel that your expertise could be helpful to improve the package, you are more than welcome to contact us!


I have been intensively working on medfate since 2013, when I obtained a Ramon y Cajal research fellowship from the Spanish government (Reference: RYC-2012-11109; Amount: 308.600 €). An investment on a long-term modelling project could not have started with this initial financial help and that of the following competitive research projects:

  • Title: Forecasting of ecosystem services on forests: impacts and adaptation to extreme climate events (FORESTCAST). Financial Entity: Ministerio de Economia y Competitividad (CGL2014-59742-C2-2-R). Amount: 152.460 €. Duration from: 01/01/2015 to: 31/12/2017. PI: Lluís Brotons/Miquel De Cáceres.
  • Title: Modeling plant water use and drought resistance strategies across scales (DRESS). Financial Entity: Ministerio de Economia y Competitividad (CGL2017-89149-C2-2-R). Amount: 93.170 €. Duration from: 01/01/2018 to: 31/12/2021. PI: Miquel De Cáceres.
  • Title: Boosting process-based models to project forest dynamics and associated ecosystem services at stand-to-regional scales (BOMFORES). Financial Entity: Ministerio de Ciencia e Innovación (PID2021-126679OB-I00). Amount: 75.020 €. Duration from: 01/09/2022 to: 31/08/2024. PI: Miquel De Cáceres.

Besides this specific funding, this model developments could not have occurred without the institutional support of the Forest Science and Technology Center of Catalonia (CTFC), where I worked until March 2021, and Center for Ecological Research and Forestry Applications (CREAF), where I currently coordinate its Ecosystem Modelling Facility (EMF).


The idea of an R package devoted to Mediterranean vegetation evolved after a previous attempt at modelling the dynamics of plant cohorts within a landscape model that tried to extend the MEDFIRE model. I made these initial efforts when I was still a post-doc at CTFC under the supervision of Lluís Brotons, to whom I am grateful for having greatly expanded my view of ecology and its applications. Undertaking this initial endeavor made us contact two excellent researchers in fire and drought ecology respectively, Juli G. Pausas (CIDE-CSIC, Spain) and Jordi Martínez-Vilalta (CREAF-UAB, Spain). While interacting with Juli was rewarding and fostered my interest in wildfires and fire ecology, Jordi had a profound influence on the project. Collaborating with him caused a slow but steady drift of my research interests towards the soil water balance, plant hydraulics and physiological responses to drought. His influence on my work was not so apparent when we published water balance model (and launched the R package) with the help of the forest hydrologist Pilar Llorens (CSIC, Spain) and other researchers (Rafa Poyatos, Lluís Coll and Pere Casals). However, it became undeniable when I started studying plant hydraulics, trying to understand and implement Sperry’s model in the package. Jordi made me interact with people in his research group and introduced me to Maurizio Mencuccini, another great ecophysiologist with whom he had been working for a long time. I have to thank Maurizio and Jordi for encouraging me to continue working on this development project and overcome the difficulty that entails learning scientific disciplines quite far from my previous experience.

The development of the package has benefited from many colleagues who have provided me with ideas or have struggled to use the models within it. Asaf Karavani was among the first package users besides me. Together, we used the package to predict soil moisture dynamics in forest plots where mushroom production was being monitored. Antoine Cabon (CTFC, Spain) was also an early user of the package. I have enjoyed endless discussions with him about several processes and how to implement them. While he was the Ph.D. student and I one of his advisors, I felt we both learned together. Moreover, Antoine has contributed with some functions to the package (and I hope he will contribute more!). Another key person for the development of medfate was working with Victor Granda (Ecosystem Modelling Facility at CREAF, Spain), whose great programming skills and profound knowledge about R technologies has encouraged me to embrace new programming habits and skills. I owe the idea of separating packages meteoland and medfate to Roberto Molowny (Ecosystem Modelling Facility at CREAF, Spain) an excellent modeller who has also contributed to the design of dispersal in medfateland. More recently, collaboration with another ecophysiologist, Nicolas Martin-StPaul (INRA, France), has stimulated improvements both in meteoland and medfate. In fact, Nicolas has became another key person in my research, with whom I share the interest for one of the interfaces between fire and drought, namely fuel moisture dynamics. Thanks to him and other colleagues (Julien Ruffault and François Pimont), since ver. 3.0 medfate includes an additional sub-model of plant hydraulics, based on SurEau-ECOS. Collaboration with Shengli Huang (Forest Service, US) on adapting the package for the US Forest Inventory and Analysis (FIA) program has expanded the horizons of its application. Collaboration with Josep Maria Espelta (CREAF) and Francisco Lloret (UAB-CREAF) has been key to the design of regeneration processes. The soil hydrology processes in the package, as well as recent coupling developments would be not possible without María Gonzalez Sanchís (UPV, Spain), Daniel Caviedes-Voullième (Forschungszentrum Jülich, Germany) and Mario Morales-Hernández (U. Zaragoza, Spain). The package have also benefited from the feed back of other users, such as Francesco d’Adamo (CREAF, Spain), Paula Martín (CTFC, Spain).

I would not like to finish the acknowledgements without thanking my former colleagues at CTFC (located in the small town of Solsona, Catalonia, Spain), for their collaboration and support. Particularly, Lluís Coll, Aitor Ameztegui and Pere Casals have been continuously supporting my efforts and finding new model applications. Moreover, they have contributed to the knowledge within the package with their expertise in forest dynamics, forest management, soils and fire issues. I also thank Mario Beltrán and Assu Gil for teaching me the basics of forest management.

Finally, I would like to thank José Manuel, who takes care of me and has to endure my endless talking about the package and its models, to my family for being there at difficult times, including my three nephews (Aran, Jan and Nil) that constantly remind me the joy of life.