| calculate.horizons {SoPhy} | R Documentation |
The function updates the positions of the boundary points, the affiliation of the pixels to the horizons and the location and the size of the smallest rectangle that include a horizon.
calculate.horizons(h)
h |
a list of the same format as the output of
xswms2d |
a list of the same format as the output of xswms2d.
The values of the following list elements are changed:
h[[i]]$points |
points defining the vertices of the boundary line for horizon i; changed if x-coordinates of a boundary definition are all genuinely within the grid size |
idx.rf |
affiliation number of each grid point |
h[[i]]$border |
grid points defining the boundary of horizon i |
h[[i]]$cut.x, h[[i]]$cut.y |
clipping rectangle that includes the horizon i |
h[[i]]$idx |
indication of the points within the clipping area that belong to horizon i |
RF |
NULL |
Stone.R |
NULL |
Root.RF |
NULL |
The function must be called after the definition of the horizons has been changed by the user. If a first or a last defining point for a boundary is truely within the range of the x-coordinates of the grid then a point with the respective x coordinate on the boundary of the grid is added.
Martin Schlather, schlath@hsu-hh.de http://www.unibw-hamburg.de/WWEB/math/schlath/schlather.html
draw.horizons,
modify.horizons,
plotRF,
plotWater,
simulateHorizons,
SoPhy,
swms2d
xswms2d
############ fetch the standard definition of a profile ###########
h <- xswms2d(xlim=c(1, 100), ylim=c(1, 100), step=1, new=NULL)
## new=NULL: xswms2d returns the standard definition for h
## without entering the interactive surface
############ modify the profile definition ########################
h$n <- 2 ## define a second horizon
h$H2 <- h$H1
h$H2$type <- "H" ## genuine horizon, not polygon
h$H2$model$model[[1]]$scale <- 30 ## different
## coordinates of the boundary segments between the horizons:
h$H2$points <- list(x=seq(1, 100, 5)) ## x coordinates
h$H2$points$y <- 80 + 20 * cos(h$H2$points$x / 10) ## y coordinates
h <- calculate.horizons(h) ## update the internal parameters
## after modifying the profile definition
draw.horizons(h) ## plot the profile
############ simulate water flux for the specified profile ########
h <- simulateHorizons(h) ## simulate stochastic components
plotRF(h) ## plot the simulated random field
swms2d.out <- swms2d(h, iter.print=1) ## numerical simulation
if (is.character(swms2d.out)) {
cat(swms2d.out, "\n") ## an error has occured
} else {
plotWater(swms2d.out, what="theta") ## plot the water contents
}