Lingranr: >> Run a LINGRA-N simulation for one year

View source: R/Lingranr.R

LingranrR Documentation

>> Run a LINGRA-N simulation for one year

Description

Computes potential or water-limited production on freely draining soils without water table.

Usage

Lingranr(
  w,
  s,
  h,
  f,
  lat,
  alt,
  return = "GRASS",
  wb = NULL,
  weightCut = FALSE,
  waterStress = TRUE,
  nitrogenStress = TRUE,
  outName = "LingraOut"
)

Arguments

w

Dataframe of weather data for one year. Column names must be:

"Year": year

"DOY": julian day

"RAD": total solar radiation [kJ/m2*day]

"MINTMP": minimum daily tempterature [°C]

"MAXTMP": maximum daily tempterature [°C]

"VP": vapour pressure [kPa]

"WIND": mean daily wind speed [m/s]

"RAIN": total daily rainfall [mm]

"Country": slot for inserting country name for reference (optional)

"Site": slot for inserting country name for reference (optional)

s

Dataframe containing soil data. Column names must be:

"sdpt": soil depth [mm]

"mcfc": moisture content at field capacity [mm3/mm3]

"mcsat": moisture content at saturation [mm3/mm3]

"mcwp": moisture content at wilting point [mm3/mm3]

h

Either numeric vector of harvest dates in Julian days with maximum 11 entries or, if weightCut == T, numeric value of dry weight of green leaves [kg/ha] used to determine harvest dates. (Harvests when specified weight is produced.) if fewer cuts are requested fill remaining spots with NAs (First entry is date of "Clearing cut".)

f

Dataframe of nitrogen fertilisation events.

Column "Dates" containing fertilisation dates in julian days.

Column "kgN_ha" containing fertilisation amount in kg/ha of equivalent mineral nitrogen

lat

Numeric. Latitude

alt

Numeric. Altitude

return

Character specifying the variable to return.

"GRASS" returns numeric value of total weight of harvested green leaves.

"Biomass" returns numeric value of total weight of harvested biomass.

"all" saves output to disk (file name given in outName) and returns content of "Calculation" sheet.

wb

Workbook object from package "xlsx" containing the Lingra-n excel model. Mostly for internal usage. Note that the function won't load package "xslx" if wb is specified, terefore you have to run "options(java.parameters = "-Xmx2048m")" outside of this function.

weightCut

Logical. If FALSE (default) "h" must specify harvest dates. If TRUE, "h" must specify the biomass threshold at which harvesting occurs.

waterStress

Logical. Do you want to model water stress?

nitrogenStress

Logical. Do you want to model nitrogen stress?

outName

Character. The name of the output file if required. File extention must be ".xlsx". Defaults to "LingraOut.xlsx".

Details

Lingranr() feeds into LINGRA-N Tool the required input variables, runs the LINGRA-N model and returns the ouput of the model (the "Computations" sheet) as an R object. All grass growth and soil water and mineral balance simulations are carried out internally to the LINGRA-N Tool.

See the original LINGRA-N Tool daocumentation for details.

Value

A data frame of "tbl_df" class (a tibble, see ?tbl_df for details) of 365 rows and 423 variables containing the "computations" sheet of the LINGRA-N Tool. Each row in the dataframe is a day in the simulation.

Examples


## Not run: 

# Run model:
lo <- Lingranr(w = weatherExmpl[1:365,],
               s = soilExmpl,
               h = harvestExmpl,
               f = fertilisExmpl,
               lat = 50,
               alt = 50,
               return = 'all')

# Plot outputs:
op <- par(mfrow = c(3,1))
plotw(weatherExmpl[1:365,])
plotdm(lo)
plotn(lo)


## End(Not run)


lucabutikofer/LingraNR documentation built on April 7, 2023, 7:20 a.m.