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

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

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

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

# S3 method for 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

#Load example daily meteorological data
data(examplemeteo)

#Load example plot plant data
data(exampleforest)

#Default species parameterization
data(SpParamsMED)

#Initialize soil with default soil params (2 layers)
examplesoil = soil(defaultSoilParams(2))

#Initialize control parameters
control = defaultControl("Granier")

#Initialize input
x = forest2spwbInput(exampleforest,examplesoil, SpParamsMED, control)

#Call simulation function
S1<-spwb(x, examplemeteo, latitude = 41.82592, elevation = 100)
#> Initial plant water content (mm): 5.25158
#> Initial soil water content (mm): 184.827
#> Initial snowpack content (mm): 0
#> Performing daily simulations
#> 
#>  [Year 2001]:....................................
#> 
#> Final plant water content (mm): 5.25209
#> Final soil water content (mm): 208.81
#> Final snowpack content (mm): 0
#> Change in plant water content (mm): 0.000517349
#> Plant water balance result (mm): 0.000517349
#> Change in soil water content (mm): 23.9834
#> Soil water balance result (mm): 23.9834
#> 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) 392 Infiltration excess (mm) 29 Saturation excess (mm) 0 Capillarity rise (mm) 0
#>   Soil evaporation (mm) 11  Herbaceous transpiration (mm) 14 Woody plant transpiration (mm) 187
#>   Plant extraction from soil (mm) 187  Plant water balance (mm) 0 Hydraulic redistribution (mm) 0
#>   Runoff (mm) 29 Deep drainage (mm) 156

#Monthly summary (averages) of soil status
summary(S1, freq="months",FUN=mean, output="Soil")
#>                 W.1       W.2     ML.1     ML.2    MLTot SaturatedDepth
#> 2001-01-01 1.213011 1.1296647 82.69562 131.7787 214.4744       592.7624
#> 2001-02-01 1.137852 1.2145784 77.57168 141.6842 219.2559       527.9452
#> 2001-03-01 1.192168 1.2587576 81.27467 146.8378 228.1125       397.2154
#> 2001-04-01 1.043371 1.1544507 71.13058 134.6701 205.8007       701.4914
#> 2001-05-01 1.064710 1.1344335 72.58537 132.3350 204.9204       712.6538
#> 2001-06-01 0.851380 0.9888871 58.04182 115.3566 173.3984       945.2099
#> 2001-07-01 1.079961 1.0296241 73.62503 120.1087 193.7337       747.0807
#> 2001-08-01 1.085933 1.1224387 74.03221 130.9358 204.9680       716.2913
#> 2001-09-01 1.088872 1.1485265 74.23259 133.9790 208.2116       672.7404
#> 2001-10-01 1.115387 1.1504673 76.04022 134.2054 210.2456       647.8450
#> 2001-11-01 1.169737 1.2201570 79.74545 142.3349 222.0804       477.5544
#> 2001-12-01 1.091859 1.2176833 74.43622 142.0464 216.4826       557.2134
#>                   SWE PlantExt.1 PlantExt.2 HydraulicInput.1 HydraulicInput.2
#> 2001-01-01 1.65619239  0.1531841 0.02091795                0     2.324505e-03
#> 2001-02-01 0.27608905  0.2193091 0.17288475                0     0.000000e+00
#> 2001-03-01 0.01762496  0.2444760 0.16344317                0     1.215595e-04
#> 2001-04-01 0.58072652  0.2681751 0.26203029                0     0.000000e+00
#> 2001-05-01 0.00000000  0.3441316 0.28471988                0     1.798269e-06
#> 2001-06-01 0.00000000  0.3388673 0.55487504                0     0.000000e+00
#> 2001-07-01 0.00000000  0.6241809 0.13750231                0     8.832043e-03
#> 2001-08-01 0.00000000  0.4986024 0.26852059                0     4.148976e-04
#> 2001-09-01 0.00000000  0.3449382 0.24893600                0     0.000000e+00
#> 2001-10-01 0.00000000  0.2581139 0.15563956                0     2.453062e-04
#> 2001-11-01 2.60802857  0.1801458 0.11535477                0     2.362159e-04
#> 2001-12-01 0.00000000  0.1391421 0.13748280                0     0.000000e+00
#>                  psi.1        psi.2
#> 2001-01-01 -0.01145655 -0.017996809
#> 2001-02-01 -0.01779960 -0.011136209
#> 2001-03-01 -0.01299259 -0.008115956
#> 2001-04-01 -0.02750827 -0.015737343
#> 2001-05-01 -0.02640533 -0.017459417
#> 2001-06-01 -0.07077660 -0.036538272
#> 2001-07-01 -0.02596713 -0.029870977
#> 2001-08-01 -0.02273007 -0.018253293
#> 2001-09-01 -0.02200275 -0.015993769
#> 2001-10-01 -0.01956329 -0.015760748
#> 2001-11-01 -0.01535297 -0.010782351
#> 2001-12-01 -0.02189052 -0.010959092

#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="Plants$PlantStress", 
        bySpecies = TRUE)
#>            Pinus halepensis Quercus coccifera Quercus ilex
#> 2001-01-01      0.001672185      0.0010900570  0.004740343
#> 2001-02-01      0.002163812      0.0011763456  0.004378302
#> 2001-03-01      0.001509356      0.0008418765  0.003270724
#> 2001-04-01      0.004130687      0.0020619479  0.006821447
#> 2001-05-01      0.003999717      0.0020268144  0.006851966
#> 2001-06-01      0.016171037      0.0068150423  0.017738835
#> 2001-07-01      0.005466379      0.0028088607  0.009480181
#> 2001-08-01      0.003382010      0.0018094338  0.006494889
#> 2001-09-01      0.003120956      0.0016637753  0.005972349
#> 2001-10-01      0.002657582      0.0014698649  0.005507603
#> 2001-11-01      0.002010407      0.0010983368  0.004117833
#> 2001-12-01      0.002875851      0.0014735643  0.005071803