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): 4.73001
#> Initial soil water content (mm): 290.875
#> Initial snowpack content (mm): 0
#> Performing daily simulations
#> 
#>  [Year 2001]:............
#> 
#> Final plant water content (mm): 4.7285
#> Final soil water content (mm): 274.723
#> Final snowpack content (mm): 0
#> Change in plant water content (mm): -0.00151775
#> Plant water balance result (mm): -0.00151775
#> Change in soil water content (mm): -16.1521
#> Soil water balance result (mm): -16.1521
#> 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) 400 Infiltration excess (mm) 21 Saturation excess (mm) 0 Capillarity rise (mm) 0
#>   Soil evaporation (mm) 26  Herbaceous transpiration (mm) 14 Woody plant transpiration (mm) 249
#>   Plant extraction from soil (mm) 249  Plant water balance (mm) -0 Hydraulic redistribution (mm) 5
#>   Runoff (mm) 21 Deep drainage (mm) 128

#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.9937304 0.9994008 0.9997788 1.0244248 1.0007769
#> 2001-02-01 0.9423965 0.9861124 0.9943597 0.9914261 0.9785677
#> 2001-03-01 0.9583998 0.9914674 1.0000150 1.0446498 0.9914829
#> 2001-04-01 0.8806847 0.9512837 0.9773734 0.9684922 0.9433238
#> 2001-05-01 0.9005826 0.9670081 0.9744642 0.9570583 0.9523449
#> 2001-06-01 0.7172931 0.8395073 0.9166568 0.9016920 0.8374319
#> 2001-07-01 0.9173939 0.9160650 0.8687492 0.8540340 0.8975930
#> 2001-08-01 0.9142114 0.9657525 0.9204613 0.8950861 0.9345169
#> 2001-09-01 0.9269493 0.9749139 0.9861720 0.9678313 0.9658662
#> 2001-10-01 0.9533352 0.9845780 0.9833501 0.9905773 0.9775606
#> 2001-11-01 0.9515680 0.9873851 1.0003348 1.0852800 0.9925602
#> 2001-12-01 0.8988802 0.9739989 0.9915305 0.9875471 0.9623698

#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.004773280       0.003160206  0.006381122
#> 2001-02-01      0.006705762       0.004059289  0.007649057
#> 2001-03-01      0.006241447       0.003834123  0.007320306
#> 2001-04-01      0.010550415       0.005819370  0.010187824
#> 2001-05-01      0.009599211       0.005341480  0.009424160
#> 2001-06-01      0.037076275       0.016427375  0.023913153
#> 2001-07-01      0.012835893       0.007043919  0.012459017
#> 2001-08-01      0.008878109       0.005121251  0.009235359
#> 2001-09-01      0.007878910       0.004608889  0.008458217
#> 2001-10-01      0.006250142       0.003881840  0.007456718
#> 2001-11-01      0.006570576       0.003988078  0.007550018
#> 2001-12-01      0.008947174       0.005057706  0.009012524
# }