Skip to content

Commit

Permalink
add experimental VOC speciation
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarraespinosa committed Sep 25, 2023
1 parent 994b696 commit f63ab4c
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 24 deletions.
9 changes: 6 additions & 3 deletions R/speciate.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#' \item{"road"}{: Splits PM in PM10 and PM2.5.}
#' \item{"nox"}{: Splits NOx in NO and NO2.}
#' \item{"nmhc"}{: Splits NMHC in compounds, see \code{\link{ef_ldv_speed}}.}
#' \item{"voc"}{: Splits NMHC in voc groups according EDGAR.
#' \item{"voc"}{: Splits NMHC in voc groups according EDGAR.}
#' \item{"pmiag", "pmneu", "pmneu2"}{: Splits PM in groups, see note below.}
#' }
#' @param veh Type of vehicle:
Expand Down Expand Up @@ -381,6 +381,7 @@ speciate <- function(x = 1,
# voc ####
} else if (spec == "voc") {
nmhc <- sysdata$mech
nmhc <- as.data.frame(nmhc)

if(!veh %in% unique(nmhc$veh)) {
choice <- utils::menu(unique(nmhc$veh),
Expand All @@ -402,7 +403,9 @@ speciate <- function(x = 1,
eu <- unique(nmhc$eu)[choice]
}
df <- nmhc[nmhc$eu == eu , ]

df <- data.table::as.data.table(df)
voc <- NULL
df <- df[, sum(x), by = voc]
names(df)[2] <- "x"

Expand All @@ -411,13 +414,13 @@ speciate <- function(x = 1,
dfb <- lapply(1:nrow(df), function(i) {
df[i, ]$x * x / 100
})
names(dfb) <- df$species
names(dfb) <- df$voc

} else {

dfb <- data.table::rbindlist(lapply(1:nrow(df), function(i) {
data.frame(x = df[i, ]$x * x / 100,
pol = df$species[i])
pol = df$voc[i])
}))
if(!is.null(names(x))) names(dfb) <- c(names(x), "pol")
}
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
basics: basics.html
last_built: 2023-09-20T05:04Z
last_built: 2023-09-25T05:22Z
urls:
reference: http://atmoschem.github.io/vein/reference
article: http://atmoschem.github.io/vein/articles
Expand Down
Binary file modified docs/reference/celsius-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 20 additions & 20 deletions docs/reference/celsius.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions docs/reference/speciate.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions man/speciate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f63ab4c

Please sign in to comment.