Learn R Programming

vein (version 1.1.3)

emis_grid: Allocate emissions into a grid returning point emissions or flux

Description

emis_grid allocates emissions proportionally to each grid cell. The process is performed by the intersection between geometries and the grid. It means that requires "sr" according to your location for the projection. It is assumed that spobj is a Spatial*DataFrame or an "sf" with the pollutants in data. This function returns an object of class "sf".

It is

Usage

emis_grid(spobj = net, g, sr, type = "lines", FN = "sum", flux = TRUE, k = 1)

Arguments

spobj

A spatial dataframe of class "sp" or "sf". When class is "sp" it is transformed to "sf".

g

A grid with class "SpatialPolygonsDataFrame" or "sf".

sr

Spatial reference e.g: 31983. It is required if spobj and g are not projected. Please, see http://spatialreference.org/.

type

type of geometry: "lines", "points" or "polygons".

FN

Character indicating the function. Default is "sum"

flux

Logical, if TRUE, it return flux (mass / area / time (implicit)) in a polygon grid, if false, mass / time (implicit) as points, in a similar fashion as EDGAR provide data.

k

Numeric to multiply emissions

Examples

Run this code
if (FALSE) {
data(net)
g <- make_grid(net, 1/102.47/2) #500m in degrees
names(net)
netsf <- sf::st_as_sf(net)
netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983)
plot(netg["ldv"],
     axes = TRUE,
     graticule = TRUE,
     bg = "black",
     lty = 0)
g <- sf::st_make_grid(net, 1/102.47/2, square = FALSE) #500m in degrees
g <- st_sf(i  =1, geometry = g)
netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983)
plot(netg["ldv"],
     axes = TRUE,
     graticule = TRUE,
     bg = "black",
     lty = 0)
plot(netg["hdv"], axes = TRUE)
netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983, FN = "mean")
plot(netg["ldv"], axes = TRUE)
plot(netg["hdv"], axes = TRUE)
netg <- emis_grid(spobj = netsf[, c("ldv", "hdv")], g = g, sr= 31983, flux = FALSE)
plot(netg["ldv"],
     axes = TRUE,
     pch = 16,
     pal = cptcity::cpt(colorRampPalette= TRUE,
                        rev = TRUE),
     cex = 3)
}

Run the code above in your browser using DataLab