# Preface

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. 2.7.7) and medfateland (ver. 0.4.3). 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 present the main functions of the package and describes the soil, vegetation and meteorology inputs that apply to all simulation models. After that, the book presents each simulation model using a set of chapters. The first of them provides an overview of the model design and the remaining ones describe the details of formulations by processes. Those process formulations that are common to more than one model (like hydrology) 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 parametrization 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 ongoing project

You should look at medfate and medfateland as both R packages and 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). Some 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 R packages are the result of collaborative work between modellers and experts in different disciplines. If your own expertise includes any of the processes that are modelled in the package and you feel that your expertise could be helpful to improve the package, you are more than welcome to contact us!

## Acknowledgements

I have been intensively working on medfate since 2013, when I obtained a Ramon y Cajal research fellowship from the Spanish government. An investment on a long-term modelling project could not have started with this initial financial help, that of other competitive research projects and the support of CTFC, the research institution until March 2021, and CREAF, my current institution where I coordinate its Ecosystem Modelling Facility.

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 endeavour 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, 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. 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. Recently, 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.

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 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, soils and fire issues. I also thank Mario Beltrán and Assu Gil for teaching me forestry.

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 from whom I learn the joy of life.