emis_grid | R Documentation |
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)
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 |
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!.
## Not run:
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)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.