PaleoRegion | R Documentation |
R6
class representing a study region of temporally changing
spatial grid cells, defined via a RasterLayer object
(see raster
) and a temporal mask indicating
which cells are included at each time step.
poems::GenericClass
-> poems::Region
-> PaleoRegion
attached
A list of dynamically attached attributes (name-value pairs).
coordinates
Data frame (or matrix) of X-Y population (WGS84) coordinates in longitude (degrees West) and latitude (degrees North) (get and set), or distance-based coordinates dynamically returned by region raster (get only).
region_raster
A RasterLayer object (see raster
) defining the region with finite values (NAs elsewhere).
use_raster
Boolean to indicate that a raster is to be used to define the region (default TRUE).
strict_consistency
Boolean to indicate that, as well as resolution, extent and CRS, consistency checks also ensure that a raster's finite/occupiable cells are the same or a subset of those defined by the region (default TRUE).
temporal_mask
Matrix of booleans indicating which region cells are included at each time step.
region_cells
Dynamically calculated number of region coordinates or raster cells with finite/non-NA values.
region_indices
Dynamically calculated region indices for raster cells with finite/non-NA values (all if not a raster).
new()
Initialization method sets temporally changing raster layers for paleontological region.
PaleoRegion$new(template_raster = NULL, remove_zeros = FALSE, ...)
template_raster
A RasterLayer, RasterBrick, or RasterStack object (see raster
) defining the paleontological region with example finite values (NAs elsewhere)
remove_zeros
Boolean to indicate that cells that are zero across all layers (times) are to be removed, i.e. set to NA (default is FALSE).
...
Additional parameters passed individually.
raster_from_values()
Converts an array (or matrix) of values into a raster (or stack) consistent with the region raster (matching extent, resolution, and finite/NA cells), and with the temporal mask (if any) applied.
PaleoRegion$raster_from_values(values)
values
An array (or matrix) of values to be placed in the raster (or stack) having dimensions consistent with the region cell number.
A RasterLayer (or RasterStack/Brick) object consistent with the region raster with temporal mask (if any) applied.
temporal_mask_raster()
Returns the temporal mask as a raster stack/brick object consistent with the region raster.
PaleoRegion$temporal_mask_raster()
A RasterStack/Brick) object with temporal mask values of 1 (true) and NA elsewhere.
clone()
The objects of this class are cloneable with this method.
PaleoRegion$clone(deep = FALSE)
deep
Whether to make a deep clone.
library(poems)
library(raster)
# Ring Island example region
coordinates <- data.frame(x = rep(seq(-178.02, -178.06, -0.01), 5),
y = rep(seq(19.02, 19.06, 0.01), each = 5))
template_raster <- Region$new(coordinates = coordinates)$region_raster # full extent
sealevel_raster <- template_raster
template_raster[][c(7:9, 12:14, 17:19)] <- NA # make Ring Island
sealevel_raster[][c(7:9, 12:14, 17:18)] <- NA
raster_stack <- raster::stack(x = append(replicate(9, template_raster), sealevel_raster))
region <- PaleoRegion$new(template_raster = raster_stack)
raster::plot(region$temporal_mask_raster()[[1]], main = "Ring Island (first timestep)",
xlab = "Longitude (degrees)", ylab = "Latitude (degrees)",
colNA = "blue", legend = FALSE)
raster::plot(region$temporal_mask_raster()[[10]], main = "Ring Island (last timestep)",
xlab = "Longitude (degrees)", ylab = "Latitude (degrees)",
colNA = "blue", legend = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.