Learn R Programming

YplantQMC (version 0.6-6)

setMet: Generate a weather object

Description

To run Yplant, a weather object needs to be constructed, that contains solar position data, radiation, air temperature, and so on. This function generates a daily diurnal weather dataset using a fairly standard weather generator, or constructs the weather object with user-specified data. See Details.

A built-in weather generator simulates the following variables:

altitude,azimuth
Position of the sun (degrees).

PAR
Photosynthetically active radiation (mu mol m-2 s-1).

fbeam
Fraction direct beam of PAR (-).
Tair
Air temperature (deg C).
VPD
Vapor pressure deficit.
The following two variables are user input, and have no within-day variation:
Ca
Atmospheric CO2 concentration (ppm). (Default = 390ppm).

Patm
Atmospheric pressure (kPa). (Default = 1.01kPa).

If you are curious about the algorithm, please check the code (type setMet).

To generate a weather dataset, simply use this command:

aprilday <- setMet(richmond, nsteps=12, Tmin=9, Tmax=25, month=6, day=21) 
Where richmond is a Yplant location object, generated with setLocation.

The weather object can be plotted: the following command produces a simple built-in graph of PAR, Tair, VPD and fbeam:

 plot(aprilday) 

Alternatively, the user can input a dataframe (or CSV file) that contains the weather variables (or a subset of them). For example,

 mymet <-
data.frame(Tair=20, PAR0=seq(5,1000,length=10), fbeam=0, Ca=400) 
The names of the variables need to be *exactly* as described above (and are case-sensitive!).

If solar altitude and azimuth are not provided, they will be calculated from the location object. In the case that fbeam = 0, though, the solar position has no effect and is ignored, and not calculated.

Usage

setMet(location = NULL, metdat = NULL, year = 2012, month = NA, day = NA, nsteps = 10, PARday = 22, AtmTrans = 0.76, fbeamday = NA, fbeammethod = c("spitters", "constant"), Tmin = 10, Tmax = 25, VPDmax = NA, maxlag = 0.1, Ca = 390, Patm = 101)

Arguments

location
A Yplant location object (class 'yplocation', see setLocation).
metdat
Optionally, a dataframe (or name of CSV file) with standard weather variables.
year
Optional (slight effects on solar path).
month
1-12
day
day of month
nsteps
number of steps (will affect number of simulation steps in YplantDay.
PARday
Total daily PAR on a horizontal surface (MJ m-2 d-1).
AtmTrans
Atmospheric transmission.
fbeamday
Daily beam fraction.
fbeammethod
If 'Spitters', uses the Spitters algorithm to estimate fbeam by timestep, otherwise it is constant (and given by fbeamday.
Tmin, Tmax
Daily minimum and maximum temperature (deg C).
VPDmax
Optional. Daily maximum VPD (if not given, estimated from Tmin).
maxlag
Lag of temperature maximum behind solar maximum (fraction of day).
Ca
Atmospheric CO2 concentration (ppm).
Patm
Atmospheric pressure (kPa).

Value

An object of class 'ypmet', a list with the following components:
dat
A dataframe with the weather variables (see Details for a description).
method
Either 'generated' (weather generator was used), or 'input' when user provided metdata.
daylength
in hours
sunset,sunrise
in hours
location
A Yplant location object (class 'yplocation', see setLocation

References

For fraction diffuse radiation, uses the 'Spitters algorithm':

Spitters, C.J.T., Toussaint, H.A.J.M., Goudriaan, J., 1986, Separating the diffuse and direct component of global radiation and its implications for modeling canopy photosynthesis. Part I. Components of incoming radiation, Ag. For. Meteorol., 38:217-229.

See Also

setPhy,setLocation