Learn R Programming

splash (version 1.0.2)

spin_up: Calculate daily totals

Description

Calculate daily totals updating the soil moisture until equilibrium.

Usage

spin_up(mdat, dtot)

Value

list, daily totals

Arguments

mdat

list with meteorological data (see the details section).

dtot

list with daily totals (see the details section).

Details

The list with meteorological data, mdat, should have the following components:

  • num_lines ..... double, length of meteorol. variable lists

  • lat_deg ....... double latitude (degrees)

  • elv_m ......... double, elevation (m)

  • year .......... double, year

  • sf ............ list, fraction of sunshine hours

  • tair .......... list, mean daily air temperature (deg. C)

  • pn ............ list, precipitation (mm/d)

The list with daily totals, dtot, should have the following component:

  • wm ............ list, daily soil moisture (mm)

Examples

Run this code
daily_totals <- matrix(data = rep(0, 366), nrow = 366, ncol = 1)
daily_totals <- as.data.frame(daily_totals)
names(daily_totals) <- c("wn")
my_file <- system.file("extdata/example_data.csv", package = "splash")
my_data <- splash::read_csv(my_file, 2000)
my_data$lat_deg <- 37.7
my_data$elv_m <- 142
daily_totals <- splash::spin_up(my_data, daily_totals)
cat(sprintf("Spin-Up:\n"))
for (i in seq(from = 1, to = my_data$num_lines, by = 1)) {
  if (i == 1) cat(sprintf("Day\tWn (mm)\n"))
  cat(sprintf("%d\t%0.6f\n", i, daily_totals$wn[i]))
}

Run the code above in your browser using DataLab