Preparing inputs

Miquel De Caceres

2021-06-17

About this vignette

Any forest water balance model needs information on climate, vegetation and soils of the forest stand to be simulated. Moreover, since medfate differentiates between species, species-specific parameters are also needed. This vignette explains data structures required as input to run simulations using the package. Package medfateutils provides functions for creating suitable inputs for simulations with medfate.

Species-specific parameters

Simulation models in medfate require a data frame with species parameter values. The package provides a default data set of parameter values for Mediterranean species (rows), resulting from bibliographic search, fit to empirical data or expert-based guesses:

data("SpParamsMED")

These species commonly occur in the Spanish forest inventory of Catalonia, but may not be sufficient for other areas. A large number of parameters (columns) can be found in SpParamsMED:

names(SpParamsMED)
##   [1] "Name"                 "IFNcodes"             "SpIndex"             
##   [4] "Group"                "Order"                "Family"              
##   [7] "GrowthForm"           "Hmed"                 "Hmax"                
##  [10] "Z50"                  "Z95"                  "a_ash"               
##  [13] "b_ash"                "a_bsh"                "b_bsh"               
##  [16] "a_btsh"               "b_btsh"               "cr"                  
##  [19] "a_fbt"                "b_fbt"                "c_fbt"               
##  [22] "d_fbt"                "a_cr"                 "b_1cr"               
##  [25] "b_2cr"                "b_3cr"                "c_1cr"               
##  [28] "c_2cr"                "a_cw"                 "b_cw"                
##  [31] "PhenologyType"        "LeafDuration"         "Sgdd"                
##  [34] "Tbgdd"                "Ssen"                 "Phsen"               
##  [37] "Tbsen"                "SLA"                  "LeafDensity"         
##  [40] "WoodDensity"          "FineRootDensity"      "conduit2sapwood"     
##  [43] "r635"                 "pDead"                "Al2As"               
##  [46] "LeafWidth"            "SRL"                  "RLD"                 
##  [49] "minFMC"               "maxFMC"               "LeafPI0"             
##  [52] "LeafEPS"              "LeafAF"               "StemPI0"             
##  [55] "StemEPS"              "StemAF"               "LigninPercent"       
##  [58] "ParticleDensity"      "LeafLitterFuelType"   "Flammability"        
##  [61] "SAV"                  "HeatContent"          "gammaSWR"            
##  [64] "alphaSWR"             "kPAR"                 "g"                   
##  [67] "Tmax_LAI"             "Tmax_LAIsq"           "Psi_Extract"         
##  [70] "Psi_Critic"           "WUE"                  "pRootDisc"           
##  [73] "Gswmin"               "Gswmax"               "VCleaf_kmax"         
##  [76] "VCleaf_c"             "VCleaf_d"             "Kmax_stemxylem"      
##  [79] "VCstem_c"             "VCstem_d"             "Kmax_rootxylem"      
##  [82] "VCroot_c"             "VCroot_d"             "Narea"               
##  [85] "Vmax298"              "Jmax298"              "WoodC"               
##  [88] "RERleaf"              "RERsapwood"           "RERfineroot"         
##  [91] "RGRleafmax"           "RGRsapwoodmax"        "RGRfinerootmax"      
##  [94] "fHDmin"               "fHDmax"               "SeedProductionHeight"
##  [97] "RecrTreeDBH"          "RecrTreeHeight"       "RecrShrubHeight"     
## [100] "RecrTreeDensity"      "RecrShrubCover"       "RecrZ50"             
## [103] "RecrZ95"              "MinTempRecr"          "MinMoistureRecr"     
## [106] "MinFPARRecr"

Not all parameters are needed for all models. The user can find parameter definitions in the help page of this data set. However, to fully understand the role of parameters in the model, the user should read the details of model design and formulation at https://emf-creaf.github.io/medfatebook/index.html.

Vegetation

Forest objects

Models included in medfate were primarily designed to be ran on forest inventory plots. In this kind of data, the vegetation of a sampled area is often described by several records of woody plants (trees and shrubs) along with their size and species identity. Forest plots in medfate are assumed to be in a format that follows closely the Spanish national forest inventory. Each forest plot is represented in an object of class forest, a list that contains several elements. Among them, the most important items are two data frames, treeData (for trees) and shrubData for shrubs:

data(exampleforestMED)
exampleforestMED
## $ID
## [1] "1"
## 
## $patchsize
## [1] 10000
## 
## $treeData
##   Species   N   DBH Height Z50  Z95
## 1      54 168 37.55    800 750 3000
## 2      68 384 14.60    660 750 3000
## 
## $shrubData
##   Species Cover Height Z50  Z95
## 1      65  3.75     80 300 1500
## 
## $herbCover
## [1] 10
## 
## $herbHeight
## [1] 20
## 
## attr(,"class")
## [1] "forest" "list"

Trees are expected to be primarily described in terms of species, diameter (DBH; cm) and height (cm), whereas shrubs are described in terms of species, percent cover (%) and mean height (cm). Root distribution has to be specified for both growth forms, in terms of the depths (mm) corresponding to 50% and 95% of cumulative fine root distribution. Functions are provided to map variables in user data frames into tables treeData and shrubData (see function forest_mapWoodyTables()).

Aboveground and belowground data

We recommend users to define forest objects as starting point for simulations with medfate. However, simulation functions in medfate allow starting in a more general way using two data frames, one with aboveground information (i.e. the leave area and size of plants) and the other with belowground information (i.e. root distribution). The aboveground data frame does not distinguish between trees and shrubs. It includes, for each plant cohort to be considered in rows, its species identity, height and leaf area index (LAI). While users can build their input data themselves, we use function forest2aboveground() on the object exampleforestMED to show how should the data look like:

above = forest2aboveground(exampleforestMED, SpParamsMED)
above
##       SP        N   DBH Cover   H        CR   LAI_live LAI_expanded LAI_dead
## T1_54 54 168.0000 37.55    NA 800 0.7150421 0.81670117   0.81670117        0
## T2_68 68 384.0000 14.60    NA 660 0.6055642 0.79779523   0.79779523        0
## S1_65 65 749.4923    NA  3.75  80 0.8032817 0.04817502   0.04817502        0

Note that the call to forest2aboveground() included species parameters, because species-specific values are needed to calculate leaf area from tree diameters or shrub cover. Columns N, DBH and Cover are required for simulating growth, but not for soil water balance, which only requires columns SP, H (in cm), CR (i.e. the crown ratio), LAI_live, LAI_expanded and LAI_dead. Here plant cohorts are given unique codes that tell us whether they correspond to trees or shrubs, but the user can use other row identifiers as long as they are unique. In practice, the user only needs to worry to calculate the values for LAI_live. LAI_live and LAI_expanded can contain the same LAI values, and LAI_dead is normally zero. This is so because models update LAI_expanded and LAI_dead according to the leaf phenology of species.

Aboveground leaf area distribution (with or without distinguishing among cohorts) can be examined by calling function vprofile_leafAreaDensity():

vprofile_leafAreaDensity(above, byCohorts = F)

vprofile_leafAreaDensity(above, byCohorts = T)

Regarding belowground information, we need vectors with depths corresponding to 50% and 95% of fine roots, which we simply concatenate from our forest data:

Z50 = c(exampleforestMED$treeData$Z50, exampleforestMED$shrubData$Z50)
Z95 = c(exampleforestMED$treeData$Z95, exampleforestMED$shrubData$Z95)

These parameters specify a continuous distribution of fine roots. Users can visually inspect the distribution of fine roots of forest objects by calling function vprofile_rootDistribution():

vprofile_rootDistribution(exampleforestMED, SpParamsMED)

Soils

Soil physical description

Simulation models in medfate require information on the physical attributes of soil, namely soil depth, texture, bulk density and rock fragment content. Soil physical attributes can be initialized to default values, for a given number of layers, using function defaultSoilParams():

spar = defaultSoilParams(2)
print(spar)
##   widths clay sand om  bd rfc
## 1    300   25   25 NA 1.5  25
## 2    700   25   25 NA 1.5  45

where widths are soil layer widths in mm; clay and sand are the percentage of clay and sand, in percent of dry weight, om stands for organic matter, bd is bulk density (in \(g \cdot cm^{-3}\)) and rfc the percentage of rock fragments. Because soil properties vary strongly at fine spatial scales, ideally soil physical attributes should be measured on samples taken at the forest stand to be simulated. For those users lacking such data, soil properties modelled at larger scales are available via SoilGrids.org (see function soilgridsParams() in package medfateutils).

Soil input object

The soil input for simulations is an object of class soil (a list) that is created using a function with the same name:

examplesoil = soil(spar)
class(soil)
## [1] "function"

In addition to the physical soil description, this object contains soil parameters needed for soil water balance simulations:

names(examplesoil)
##  [1] "SoilDepth"    "W"            "SWE"          "Temp"         "Ksoil"       
##  [6] "Gsoil"        "dVec"         "sand"         "clay"         "om"          
## [11] "VG_alpha"     "VG_n"         "VG_theta_res" "VG_theta_sat" "Ksat"        
## [16] "Kdrain"       "macro"        "bd"           "rfc"

For example, macro specifies the macroporosity of each layer; Gsoil and Ksoil are parameters needed to model the process of water infiltration into the soil. The meaning of all elements in the soil object can be found in the help page for function soil().

At any time, one can show the characteristics and status of the soil object using its print function:

print(examplesoil, model = "SX")
## Soil depth (mm): 1000 
## 
## Layer  1  [ 0  to  300 mm ] 
##     clay (%): 25 silt (%): 50 sand (%): 25 organic matter (%): NA [ Silt loam ]
##     Rock fragment content (%): 25 Macroporosity (%): 5 
##     Theta WP (%): 14 Theta FC (%): 30 Theta SAT (%): 49 Theta current (%) 30 
##     Vol. WP (mm): 32 Vol. FC (mm): 68 Vol. SAT (mm): 111 Vol. current (mm): 68 
##     Temperature (Celsius): NA 
## 
## Layer  2  [ 300  to  1000 mm ] 
##     clay (%): 25 silt (%): 50 sand (%): 25 organic matter (%): NA [ Silt loam ]
##     Rock fragment content (%): 45 Macroporosity (%): 5 
##     Theta WP (%): 14 Theta FC (%): 30 Theta SAT (%): 49 Theta current (%) 30 
##     Vol. WP (mm): 55 Vol. FC (mm): 117 Vol. SAT (mm): 190 Vol. current (mm): 117 
##     Temperature (Celsius): NA 
## 
## Total soil saturated capacity (mm): 300 
## Total soil water holding capacity (mm): 185 
## Total soil extractable water (mm): 116 
## Total soil current Volume (mm): 185 
## 
## Snow pack water equivalent (mm): 0 
## Soil water table depth (mm): 1000

Importantly, the soil object is used to store the degree of moisture of each soil layer. In particular, element W contains the state variable that represents moisture content - the proportion of moisture relative to field capacity - which is normally initialized to 1 for each layer:

examplesoil$W
## [1] 1 1

Advanced soil plant energy and water balance modelling requires considering the temperature of soil. Hence, Temp contains the temperature (in degrees) of soil layers:

examplesoil$Temp
## [1] NA NA

Soil layer temperatures are initialized to missing values, so that at the first time step they will be set to atmospheric temperature. While simple water balance modeling can be run using either Saxton’s or Van Genuchten’s equations as water retention curves, Van Genuchten’s model is forced for advanced modelling.

Water retention curves

The modelled moisture content of the soil depends on the water retention curve used to represent the relationship between soil volumetric water content (\(\theta\); %) and soil water potential (\(\Psi\); MPa). By default the Saxton (model = "SX") equations are used to model the water retention curve, but the user may choose to follow Van Genuchten - Mualem equations, which will give slightly different values for the same texture:

print(examplesoil, model="VG")
## Soil depth (mm): 1000 
## 
## Layer  1  [ 0  to  300 mm ] 
##     clay (%): 25 silt (%): 50 sand (%): 25 organic matter (%): NA [ Silt loam ]
##     Rock fragment content (%): 25 Macroporosity (%): 5 
##     Theta WP (%): 13 Theta FC (%): 29 Theta SAT (%): 42 Theta current (%) 29 
##     Vol. WP (mm): 30 Vol. FC (mm): 64 Vol. SAT (mm): 95 Vol. current (mm): 64 
##     Temperature (Celsius): NA 
## 
## Layer  2  [ 300  to  1000 mm ] 
##     clay (%): 25 silt (%): 50 sand (%): 25 organic matter (%): NA [ Silt loam ]
##     Rock fragment content (%): 45 Macroporosity (%): 5 
##     Theta WP (%): 13 Theta FC (%): 30 Theta SAT (%): 42 Theta current (%) 30 
##     Vol. WP (mm): 49 Vol. FC (mm): 117 Vol. SAT (mm): 163 Vol. current (mm): 117 
##     Temperature (Celsius): NA 
## 
## Total soil saturated capacity (mm): 258 
## Total soil water holding capacity (mm): 181 
## Total soil extractable water (mm): 118 
## Total soil current Volume (mm): 181 
## 
## Snow pack water equivalent (mm): 0 
## Soil water table depth (mm): 1000

While Saxton equations use texture and organic matter as inputs, the Van Genuchten-Mualem equations need other parameters, which are estimated using pedotransfer functions and their names start with VG_ (two alternative options are provided in function soil to estimate Van Genuchten parameters). The following code calls function soil_retentionCurvePlot() to illustrate the difference between the two water retention models in this soil:

soil_retentionCurvePlot(examplesoil, model="both")

Low-level functions, such as soil_psi2thetaSX() and soil_psi2thetaVG() (and their counterparts soil_theta2psiSX() and soil_theta2psiVG()), can be used to calculate volumetric soil moisture from the water potential (and viceversa) using the two models. When simulating soil water balance, the user can choose among the two models (see control parameters below).

Meteorological forcing

All simulations in the package require daily weather inputs. The weather variables that are required depend on the complexity of model we are using. In the simplest case, only mean temperature, precipitation and potential evapotranspiration is required, but the more complex simulation model also requires radiation, wind speed, min/max temparature and relative humitidy. Here we show an example of meteorological forcing data.

data(examplemeteo)
head(examplemeteo)
##            MeanTemperature MinTemperature MaxTemperature Precipitation
## 2001-01-01      3.57668969     -0.5934215       6.287950      4.869109
## 2001-01-02      1.83695972     -2.3662458       4.569737      2.498292
## 2001-01-03      0.09462563     -3.8541036       2.661951      0.000000
## 2001-01-04      1.13866156     -1.8744860       3.097705      5.796973
## 2001-01-05      4.70578690      0.3288287       7.551532      1.884401
## 2001-01-06      4.57036721      0.5461322       7.186784     13.359801
##            MeanRelativeHumidity MinRelativeHumidity MaxRelativeHumidity
## 2001-01-01             78.73709            65.15411           100.00000
## 2001-01-02             69.70800            57.43761            94.71780
## 2001-01-03             70.69610            58.77432            94.66823
## 2001-01-04             76.89156            66.84256            95.80950
## 2001-01-05             76.67424            62.97656           100.00000
## 2001-01-06             89.01940            74.25754           100.00000
##            Radiation WindSpeed WindDirection       PET
## 2001-01-01  12.89251  2.000000           172 1.3212770
## 2001-01-02  13.03079  7.662544           278 2.2185985
## 2001-01-03  16.90722  2.000000           141 1.8045176
## 2001-01-04  11.07275  2.000000           172 0.9200627
## 2001-01-05  13.45205  7.581347           321 2.2914449
## 2001-01-06  12.84841  6.570501           141 1.7255058

Simulation models in medfate have been designed to work along with data generated from package meteoland. The user is strongly recommended to resort to this package to obtain suitable weather input for medfate simulations.

Simulation control

Apart from data inputs, the behaviour of simulation models can be controlled using a set of global parameters. The default parameterization is obtained using function defaultControl():

control = defaultControl()
names(control)
##  [1] "modifyInput"                         "verbose"                            
##  [3] "subdailyResults"                     "transpirationMode"                  
##  [5] "soilFunctions"                       "defaultWindSpeed"                   
##  [7] "snowpack"                            "leafPhenology"                      
##  [9] "rockyLayerDrainage"                  "unlimitedSoilWater"                 
## [11] "plantWaterPools"                     "unfoldingDD"                        
## [13] "verticalLayerSize"                   "windMeasurementHeight"              
## [15] "cavitationRefill"                    "ndailysteps"                        
## [17] "nsubsteps"                           "cochard"                            
## [19] "capacitance"                         "taper"                              
## [21] "multiLayerBalance"                   "gainModifier"                       
## [23] "costModifier"                        "costWater"                          
## [25] "klatstem"                            "klatleaf"                           
## [27] "numericParams"                       "fracLeafResistance"                 
## [29] "fracRootResistance"                  "averageFracRhizosphereResistance"   
## [31] "Catm"                                "thermalCapacityLAI"                 
## [33] "boundaryLayerSize"                   "refillMaximumRate"                  
## [35] "allowDessication"                    "allowStarvation"                    
## [37] "allowDefoliation"                    "sinkLimitation"                     
## [39] "shrubDynamics"                       "allocationStrategy"                 
## [41] "nonStomatalPhotosynthesisLimitation" "phloemConductanceFactor"            
## [43] "nonSugarConcentration"               "equilibriumOsmoticConcentration"    
## [45] "minimumRelativeSugarForGrowth"       "respirationRates"                   
## [47] "turnoverRates"                       "constructionCosts"                  
## [49] "maximumRelativeGrowthRates"          "mortalityMode"                      
## [51] "mortalityBaselineRate"               "mortalityRelativeSugarThreshold"    
## [53] "mortalityRWCThreshold"               "recruitmentMode"                    
## [55] "removeDeadCohorts"                   "minimumCohortDensity"               
## [57] "seedRain"                            "seedProductionTreeHeight"           
## [59] "seedProductionShrubHeight"           "minTempRecr"                        
## [61] "minMoistureRecr"                     "minFPARRecr"                        
## [63] "recrTreeDBH"                         "recrTreeDensity"                    
## [65] "recrTreeHeight"                      "recrShrubCover"                     
## [67] "recrShrubHeight"                     "recrTreeZ50"                        
## [69] "recrShrubZ50"                        "recrTreeZ95"                        
## [71] "recrShrubZ95"

These parameters should normally be left to their default value under their effect on simulations is fully understood.

Input objects for simulation functions

Simulation functions spwb() and growth() (and similar functions) require first combining forest, soil, species-parameter and simulation control inputs into a single input object (of class spwbInput or growthInput) that is then used as input to the corresponding simulation function along with weather data. The combination of inputs is done via functions spwbInput() and growthInput(), respectively, or the more convenient forest2spwbInput() and forest2growthInput(). While it complicates the code, having this additional step is handy because cohort-level parameters and state variables initialized can then be modified by the user (or an automated calibration algorithm) before calling the actual simulation functions. The input objects for functions spwb() and growth() are presented in more detail in then vignettes corresponding to each model.

Function fordyn() is different from the other two models, in the sense that the user enters forest, soil, species-parameter and simulation control inputs directly into the simulation function (in fact, fordyn() internally calls forest2growthInput() to initialize the input object to function growth()).