Skip to contents

Function summary summarizes the model's output in different temporal steps (i.e. weekly, annual, ...).

Usage

# S3 method for class 'spwb'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

# S3 method for class 'pwb'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

# S3 method for class 'growth'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

# S3 method for class 'fordyn'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

Arguments

object

An object of class spwb, pwb, growth or fordyn.

freq

Frequency of summary statistics (see cut.Date).

output

The data table to be summarized. Accepted values are the path to data tables in object, such as 'WaterBalance', 'Soil', 'Stand' or 'Plants$LAI'. It is also possible to use strings like 'Transpiration' and the function will interpret it as 'Plants$Transpiration'.

FUN

The function to summarize results (e.g., sum, mean, ...)

bySpecies

Allows aggregating output by species before calculating summaries (only has an effect with some values of output). Aggregation can involve a sum (as for plant lai or transpiration) or a LAI-weighted mean (as for plant stress or plant water potential).

months

A vector of month numbers (1 to 12) to subset the season where summaries apply.

...

Additional parameters for function summary.

Value

A matrix with dates as row names and the desired summaries in columns

Note

When applied to fordyn objects, the summary function can be used to gather the results of different yearly steps into a single table while keeping a daily resolution (i.e. using freq = "days".

Author

Miquel De Cáceres Ainsa, CREAF

Examples

# \donttest{
#Load example daily meteorological data
data(examplemeteo)

#Load example plot plant data
data(exampleforest)

#Default species parameterization
data(SpParamsMED)

#Define soil with default soil params (4 layers)
examplesoil <- defaultSoilParams(4)

#Initialize control parameters
control <- defaultControl("Granier")

#Initialize input
x <- spwbInput(exampleforest,examplesoil, SpParamsMED, control)

#Call simulation function
S1<-spwb(x, examplemeteo, latitude = 41.82592, elevation = 100)
#> Initial plant water content (mm): 7.05859
#> Initial soil water content (mm): 290.875
#> Initial snowpack content (mm): 0
#> Performing daily simulations
#> 
#>  [Year 2001]:....................................
#> 
#> Final plant water content (mm): 7.05713
#> Final soil water content (mm): 278.275
#> Final snowpack content (mm): 0
#> Change in plant water content (mm): -0.00146023
#> Plant water balance result (mm): -0.00146023
#> Change in soil water content (mm): -12.6
#> Soil water balance result (mm): -12.6
#> Change in snowpack water content (mm): 0
#> Snowpack water balance result (mm): -7.10543e-15
#> Water balance components:
#>   Precipitation (mm) 513 Rain (mm) 462 Snow (mm) 51
#>   Interception (mm) 92 Net rainfall (mm) 370
#>   Infiltration (mm) 399 Infiltration excess (mm) 22 Saturation excess (mm) 0 Capillarity rise (mm) 0
#>   Soil evaporation (mm) 30  Herbaceous transpiration (mm) 14 Woody plant transpiration (mm) 185
#>   Plant extraction from soil (mm) 185  Plant water balance (mm) -0 Hydraulic redistribution (mm) 1
#>   Runoff (mm) 22 Deep drainage (mm) 182

#Queries the tables in 'Soil'
names(S1$Soil)
#> [1] "SWC"            "RWC"            "REW"            "ML"            
#> [5] "Psi"            "PlantExt"       "HydraulicInput"

#Monthly summary (averages) of soil relative water content
summary(S1, freq="months",FUN=mean, output="RWC")
#>                    1         2         3         4   Overall
#> 2001-01-01 0.9947723 0.9995946 0.9998435 1.0261451 1.0012949
#> 2001-02-01 0.9540594 0.9906994 0.9960319 0.9938971 0.9838337
#> 2001-03-01 0.9663205 0.9944153 1.0017314 1.0618216 0.9967573
#> 2001-04-01 0.9136701 0.9707045 0.9851106 0.9790159 0.9619544
#> 2001-05-01 0.9208798 0.9789202 0.9923659 0.9899156 0.9699638
#> 2001-06-01 0.7641297 0.8895088 0.9542680 0.9428554 0.8825444
#> 2001-07-01 0.9409512 0.9555964 0.9657773 0.9583469 0.9551017
#> 2001-08-01 0.9427344 0.9843846 0.9937349 1.0010101 0.9787896
#> 2001-09-01 0.9470056 0.9853224 0.9930335 0.9911254 0.9789545
#> 2001-10-01 0.9646826 0.9938919 0.9974091 1.0185912 0.9905348
#> 2001-11-01 0.9619348 0.9920544 1.0099939 1.0984648 1.0007513
#> 2001-12-01 0.9147474 0.9813201 0.9941758 0.9912765 0.9701021

#Queries the tables in 'Plants'
names(S1$Plants)
#>  [1] "LAI"                 "LAIlive"             "FPAR"               
#>  [4] "AbsorbedSWRFraction" "Transpiration"       "GrossPhotosynthesis"
#>  [7] "PlantPsi"            "LeafPLC"             "StemPLC"            
#> [10] "PlantWaterBalance"   "LeafRWC"             "StemRWC"            
#> [13] "LFMC"                "PlantStress"        

#Monthly summary (averages) of plant stress
summary(S1, freq="months",FUN=mean, output="PlantStress", 
        bySpecies = TRUE)
#>            Pinus halepensis Quercus coccifera Quercus ilex
#> 2001-01-01      0.005969668       0.003146563   0.01073669
#> 2001-02-01      0.007721584       0.003815570   0.01218731
#> 2001-03-01      0.007320915       0.003653157   0.01181755
#> 2001-04-01      0.010410407       0.004842652   0.01444765
#> 2001-05-01      0.009964954       0.004639780   0.01390170
#> 2001-06-01      0.029938011       0.011616458   0.02744552
#> 2001-07-01      0.011133685       0.005178799   0.01537285
#> 2001-08-01      0.008683548       0.004179858   0.01298398
#> 2001-09-01      0.008436869       0.004090109   0.01279848
#> 2001-10-01      0.007199201       0.003616892   0.01175938
#> 2001-11-01      0.007571662       0.003745146   0.01201678
#> 2001-12-01      0.009937948       0.004634110   0.01389359
# }