prepare_climate {r3PG}R Documentation

Subsets or replicate a climate data

Description

Prepares the climate table, by either replicating the average climate for the required number of years, or by sub-setting from a longer time-series of climate data.

Usage

prepare_climate(climate, from = "2000-04", to = "2010-11")

Arguments

climate

table containing the information about monthly values for climatic data. If the climate table have exactly 12 rows it will be replicated for the number of years and months specified by from - to. Otherwise, it will be subsetted to the selected time period. If this is required, year and month columns must be included in the climate table. The minimum required columns are listed below, but additionally you can include: tmp_ave, c02, d13catm. Please refer to d_climate for example.

  • year: year of observation (only required for subsetting) (numeric).

  • month: months of observation (only required for subsetting) (numeric).

  • tmp_min: monthly mean daily minimum temperature (C).

  • tmp_max: monthly mean daily maximum temperature (C).

  • tmp_ave: monthly mean daily average temperature (C) (optional).

  • prcp: monthly rainfall (mm month-1).

  • srad: monthly mean daily solar radiation (MJ m-2 d-1).

  • frost_days: frost days per month (d month-1).

  • co2: monthly mean atmospheric co2 (ppm), required if calculate_d13c=1 (optional).

  • d13catm: monthly mean isotopic composition of air (‰), required if calculate_d13c=1 (optional).

from

year and month indicating the start of simulation. Provided in form of year-month. E.g. "2000-01".

to

year and month indicating the end of simulation. Provided in form of year-month. E.g. "2009-12", will include December 2009 as last simulation month.

Details

This function prepares the climate table for run_3PG.

In case a user provides only average climate, this is replicated for the desired simulation period.

In case a larger climate file is provided, the simulation period is selected from this.

Value

a data.frame with number of rows corresponding to number of simulated month and 10 columns

See Also

run_3PG, prepare_input, prepare_parameters, prepare_sizeDist, prepare_thinning

Examples

# sub-setting climate data
prepare_climate( climate = d_climate, from = '2003-04', to = '2010-11')

# replicating climate data
set.seed(1)
climate = data.frame( tmp_min = rnorm(12, mean = 10),
                      tmp_max = rnorm(12, mean = 20),
                      prcp = sample(c(0:200), 12),
                      srad = sample(c(1:100), 12),
                      frost_days = sample(c(0:30), 12))

prepare_climate( climate = climate, from = '2000-04', to = '2010-11')


[Package r3PG version 0.1.6 Index]