Description Objects from the Class Slots Methods Author(s) Examples
View source: R/Simulations-class.R
Class for maps of plume simulations with spatial reference and plume properties.
Objects hold plume simulations and additional data: plume simulations are maps, all defined by values at the same set of locations; there may be several maps for each plume (e.g. the concentration of different pollutants in the same accident scenario, values at different times, etc.).
As all maps have the same spatial properties, it is sufficient to hold the locations
once as a SpatialDataFrame
.
The simulations themselves can be represented by a matrix where rows refer to location and columns refer to different plumes; in case of several maps per plume this can be extended to an array. These values
arrays are actually implemented as raster
objects; thus they can hold more data than it fits into memory.
To keep information that refers to the single plumes like the kind of scenario they belong to or their probability to occur, a data.frame
of plumes
is part of each Simulations
object.
Objects may be created by calls to the function Simulations(locations, plumes, values)
.
locations
:SpatialDataFrame
; locations and location-related data, e.g. population or cost to put a sensor here (n locations)
plumes
:data.frame
; data related to plumes but not to locations, e.g. average impact of the plume (aggregated over space) or likelihood of this plume to occur — rows refer to plumes, columns to different kind of information (N plumes)
values
:raster
; maps of plume values; each column represents the map of one plume: raster layers do not represent maps, but contain the values of the maps of all plumes (n x N values) — spatial properties of the values
are meanigless and must have the standardised form —; there can be different layers to contain different kind of data, e.g. cumulative concentrations of a pollutant and time when pollution started.
number of locations
(equals nrows(values)
)
number of plumes
(equals ncols(values)
)
number of kind of values
(equals nlayers(values)
)
cbind-like method to combine the plumes of different Simulations
with same locations and value types; for details see cbind
extract one plume
from one layer of the values
and assign it to the locations
and return the resulting SpatialDataFrame
; ; for details see extractSpatialDataFrame
Kristina B. Helle, kristina.helle@uni-muenster.de
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # generate Simulations object: small, artificial example
data(SPixelsDF)
plumes = data.frame(source = c("A", "A", "B", "B", "B"),
date = c("2000-01-01", "2000-04-01",
"2000-07-01", "2000-01-01", "2000-01-03"),
totalCost = runif(5, min = 5, max = 15))
values1 = replicate(n = nrow(plumes), expr = rlnorm(length(SPixelsDF), sdlog = 2))
values2 = replicate(n = nrow(plumes), expr = rnorm(length(SPixelsDF), m = 10, sd = 3))
values = stack(raster(x = values1, xmn = -90, xmx = 90, ymn = -90, ymx = 90,
crs = "+init=epsg:4326" ),
raster(x = values2, xmn = -90, xmx = 90, ymn = -90, ymx = 90,
crs = "+init=epsg:4326" ))
Simulations1 = Simulations(locations = SPixelsDF, plumes, values)
# nLocations, nPlumes, nKinds
nLocations(Simulations1)
nPlumes(Simulations1)
nKinds(Simulations1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.