Learn R Programming

paleofire (version 1.1.8)

pfGridding: Produce gridded maps of transformed charcoal values.

Description

The function uses weighted spatio-temporal interpolation to produce gridded maps of transformed charcoal values. Spatial grids are used to interpolate transformed charcoal values for a key period defined by Age. For each grid cell the function search charcoal sites located in a radius defined by distance_buffer from the grid centre and at an elevation within a range defined by elevation_buffer from the mean elevation of the cell. Then the function search for charcoal samples within a temporal range from the key date defined by time_buffer. Finally a tricube distance weighting function is applied to each sample by considering it spatial distance to the grid centre and it temporal distance to the key date. This approach that weight samples according to their spatio-temporal location also down-weight charcoal sites that are poorly sampled.

Usage

pfGridding(data, cell_sizex = NULL, cell_sizey = NULL, age = 0, cell_size = NULL, time_buffer = NULL, distance_buffer = NULL, raster_extent = NULL, elevation_buffer = NULL, proj4 = NULL, sea_mask = TRUE, other_mask = NULL, verbose = TRUE)

Arguments

data
An object returned by pfTransform.
cell_sizex
Numeric, grid cell width (m).
cell_sizey
Numeric, grid cell height (m).
age
Numeric, key date (years BP).
cell_size
Numeric, grid cell size (bypass cell_sizex and cell_sizey and produce square cells).
time_buffer
Numeric, temporal distance (years) from the key date to search for charcoal samples.
distance_buffer
Numeric, spatial distance from the grid centres to search for charcoal samples (m).
raster_extent
Numeric, define custom extent for the analysis such as raster_extent = c(xmin, xmax, ymin, ymax)
elevation_buffer
Numeric, elevation range from the mean grid cell elevation to search for charcoal sites.
proj4
String, proj.4 string representing the desired projection for plotted maps. Default is Robinson ("+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"). See http://www.spatialreference.org to look up the string for your favorite projections.
sea_mask
Logical, mask cells falling in the sea.
other_mask
A sp object (SpatialPolygonsDataFrame) used to mask data i.e. for not interpollating pixels under the mask (classical usage: ice extent mask). Note that the SpatialPolygonsDataFrame projection must be used in the analysis and defined using proj4 argument, otherwise the mask should be reprojected (e.g. using rgdal::spTransform).
verbose
Logical, verbose or not...

Value

A "pfGridding" object (list) that could be plotted using plot.pfGridding.

See Also

plot.pfGridding, pfTransform, pfDotMap

Examples

Run this code

ID=pfSiteSel(id_region=="ENA0", l12==1, long>-85)

TR=pfTransform(ID,method=c("MinMax","Box-Cox","Z-Score"),BasePeriod=c(200,4000))

p=pfGridding(TR,age=1000)
summary(p)

## Not run: 
# require(raster)
# plot(p$raster)
# 
# ## Example of other_mask usage: we will use here Dyke 2003 ice extent map for North 
#  America
# require(maptools)
# ID=pfSiteSel(id_region=="ENA0", long>-100,lat>40)
# TR=pfTransform(ID,method=c("MinMax","Box-Cox","Z-Score"),BasePeriod=c(200,4000))
# 
# ## Define projection (same as Dyke 2003)
# proj4="+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 
#  +lon_0=-95 +x_0=0 +y_0=0 +ellps=clrk66 +datum=NAD27 +units=m +no_defs"
# 
# ## Download the shapefile
# where=getwd() 
# download.file("http://blarquez.com/public/data/ice_9500_calBP_lcc.shp",
#                paste0(where,"/ice_9500_calBP_lcc.shp"))
# download.file("http://blarquez.com/public/data/ice_9500_calBP_lcc.dbf",
#                paste0(where,"/ice_9500_calBP_lcc.dbf"))
# download.file("http://blarquez.com/public/data/ice_9500_calBP_lcc.shx",
#                paste0(where,"/ice_9500_calBP_lcc.shx"))
# 
# ice_shp=readShapePoly(paste0(where,"/ice_9500_calBP_lcc.shp"), 
#                       proj4string=CRS(proj4))
# plot(ice_shp) 
# 
# p=pfGridding(TR,age=9500,cell_size=100000,distance_buffer=300000,
#              proj4=proj4,other_mask=ice_shp)
# plot(p,add=ice_shp)
# 
# # Citation: Dyke, A.S., Moore, A. And Robertson, L. 2003 :
# # Deglaciation of North America, Geological Survey of Canada Open File 1574.
# ## End(Not run)

Run the code above in your browser using DataLab