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
emis_grid(spobj = net, g, sr, type = "lines", FN = "sum", flux = TRUE, k = 1)
A spatial dataframe of class "sp" or "sf". When class is "sp" it is transformed to "sf".
A grid with class "SpatialPolygonsDataFrame" or "sf".
Spatial reference e.g: 31983. It is required if spobj and g are not projected. Please, see http://spatialreference.org/.
type of geometry: "lines", "points" or "polygons".
Character indicating the function. Default is "sum"
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.
Numeric to multiply emissions
1) If flux = TRUE (default), emissions are flux = mass / area / time (implicit), as polygons. If flux = FALSE, emissions are mass / time (implicit), as points. Time untis are not displayed because each use can have different time units for instance, year, month, hour second, etc.
2) Therefore, it is good practice to have time units in 'spobj'. This implies that spobj MUST include units!.
3) In order to check the sum of the emissions, you must calculate the grid-area in km^2 and multiply by each column of the resulting emissions grid, and then sum.
4) If FN = "sum", is mass conservative!.
if (FALSE) { # \dontrun{
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)
} # }