Skip to content

Commit

Permalink
merge projects
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarraespinosa committed May 23, 2023
1 parent 39fa472 commit dc3c509
Show file tree
Hide file tree
Showing 442 changed files with 720 additions and 68,501 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ NEWS
### vein 1.0.3 (date: 2023-05-05)

- Converts ef_emfac FC gallons to grams
- add survival logical parameter in projects

### vein 1.0.2

Expand Down
115 changes: 34 additions & 81 deletions R/get_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,49 @@
#' @param case Character; One of of the following:
#' \tabular{llll}{
#' \strong{case} \tab \strong{Description}\tab \strong{EF} \tab \strong{Notes} \cr
#' brazil or brazil_bu or brasil or brasil_bu \tab Bottom-up \tab CETESB \tab .rds\cr
#' emislacovid \tab Bottom-up March 2020\tab CETESB \tab .rds\cr
#' brazil_bu_csvgz \tab Bottom-up \tab CETESB+tunnel \tab .csv.gz\cr
#' brazil_csv \tab Bottom-up. Faster but heavier\tab CETESB\tab .csv\cr
#' brazil_td_chem \tab Top-down with chemical mechanisms\tab CETESB\tab .csv and .rds\cr
#' brazil_bu_chem \tab Bottom-up chemical mechanisms\tab CETESB+tunnel\tab .rds\cr
#' brazil_bu_chem_streets \tab Bottom-up chemical mechanisms for streets and MUNICH\tab CETESB+tunnel\tab .rds\cr
#' brazil_td_chem_im \tab Top-down with chemical mechanisms+IM\tab CETESB\tab .csv and .rds\cr
#' brazil_bu_chem_im \tab Bottom-up chemical mechanisms+IM\tab CETESB+tunnel\tab .rds\cr
#' brazil_bu_chem_month \tab Bottom-up chemical mechanisms\tab CETESB+tunnel\tab .rds\cr
#' brazil_bu_chem_streets_im \tab Bottom-up chemical mechanisms for streets and MUNICH+IM\tab CETESB+tunnel\tab .rds\cr
#' brazil_td_chem \tab Top-down with chemical mechanisms\tab CETESB\tab .csv and .rds\cr
#' masp2020 \tab Bottom-down\tab CETESB+tunnel\tab csv and.rds\cr
#' sebr_cb05co2 \tab Top-down SP, MG and RJ\tab CETESB+tunnel\tab .rds\cr
#' amazon2014 \tab Top-down Amazon\tab CETESB+tunnel\tab csv and.rds\cr
#' curitiba \tab Bottom-down +GTFS\tab CETESB+tunnel\tab csv and.rds\cr
#' masp2020 \tab Bottom-down\tab CETESB+tunnel\tab csv and.rds\cr
#' ecuador_td \tab Top-down. Renamed ecuador_td_im\tab EEA\tab csv and.rds\cr
#' ecuador_td_im \tab Top-down. \tab EEA\tab csv and.rds\cr
#' ecuador_td_hot \tab Top-down. Renamed ecuador_td_im\tab EEA\tab csv and.rds\cr
#' ecuador_td_hot_month \tab Top-down\tab EEA\tab csv and.rds\cr
#' moves_bu \tab Bottom-up\tab US/EPA MOVES \tab csv and.rds (requires MOVES >=3.0 on Windows)\cr
#' manizales_bu \tab Bottom-up chemical mechanisms\tab EEA\tab csv, csv.gz, .rds\cr
#' sebr_cb05co2_im \tab Top-down SP, MG and RJ IM\tab CETESB+tunnel\tab .rds\cr
#' eu_bu_chem \tab Bottom-up chemical mechanisms\tab EEA 2019\tab .rds\cr
#' eu_bu_chem_simple\tab Bottom-up chemical mechanisms 7 veh\tab EEA 2019\tab .rds\cr
#' china_bu_chem \tab Bottom-up chemical mechanisms\tab MEE China\tab .rds\cr
#' }
#' @param url String, with the URL to download VEIN project
#' @note default case can be any of "brasil", "brazil", "brazil_bu", "brasil_bu", they are
#' the same
#' @note All projects include option to apply survival functions
#' @note \strong{brazil_bu_chem} covers
#' "brazil",
#' "brazil_bu",
#' "brasil_bu",
#' "brazil_bu_chem",
#' "brazil_bu_csvgz",
#' "brazil_bu_csv",
#' "brazil_bu_cb05",
#' "brazil_mech",
#' "brazil_bu_chem_month",
#' "brazil_bu_chem_im"
#' "brazil_bu_chem_streets_im" (type <- 'streets')
#' "brazil_bu_chem_streets" (type <- 'streets')
#'
#' \strong{brazil_td_chem} covers
#' "brazil_td_chem_im"
#'
#' \strong{sebr_cb05co2} covers
#' "sebr_cb05co2_im"
#'
#' \strong{ecuador_td} covers
#' "ecuador_td",
#' "ecuador_td_hot",
#' "ecuador_td_im"
#'
#' In any case, if you find any error, please, send a pull request in github.
#'
#' In Sao Paulo the IM programs was functioning until 2011.
Expand Down Expand Up @@ -66,7 +80,8 @@ get_project <- function(directory,
"brazil_bu_csv",
"brazil_bu_cb05",
"brazil_mech",
"brazil_bu_chem_month")) {
"brazil_bu_chem_month",
"brazil_bu_chem_im")) {
URL <- "https://raw.githubusercontent.com/atmoschem/vein/master/projects/brazil_bu_chem.tar.gz"
tf <- paste0(tempfile(), ".tar.gz")
utils::download.file(url = URL,
Expand All @@ -92,25 +107,9 @@ get_project <- function(directory,
utils::untar(tarfile = tf, exdir = directory)
message("Your directory is in ", directory)

# brazil_bu_chem_im ####
} else if(case %in% c("brazil_bu_chem_im")){
URL <- "https://raw.githubusercontent.com/atmoschem/vein/master/projects/brazil_bu_chem.tar.gz"
tf <- paste0(tempfile(), ".tar.gz")
utils::download.file(url = URL,
destfile = tf)
utils::untar(tarfile = tf,
exdir = directory)

x <- readLines(paste0(directory, "/main.R"))
x <- gsub(pattern = "IM <- FALSE",
replacement = "IM <- TRUE",
x = x)
writeLines(x, paste0(directory, "/main.R"))

message("Your directory is in ", directory)

# manizales_bu ####
} else if(case %in% c("manizales_bu")){
} else if(case %in% c("manizales_bu",
"manizales")){
URL <- "https://raw.githubusercontent.com/atmoschem/vein/master/projects/manizales_bu.tar.gz"
tf <- paste0(tempfile(), ".tar.gz")
utils::download.file(url = URL,
Expand Down Expand Up @@ -154,25 +153,6 @@ get_project <- function(directory,
utils::untar(tarfile = tf, exdir = directory)
message("Your directory is in ", directory)

# brazil_td_chem_im ####
} else if(case %in% c("brazil_td_chem_im")){
URL <- "https://raw.githubusercontent.com/atmoschem/vein/master/projects/brazil_td_chem_im.tar.gz"
tf <- paste0(tempfile(), ".tar.gz")
utils::download.file(url = URL,
destfile = tf)
utils::untar(tarfile = tf, exdir = directory)
message("Your directory is in ", directory)

# ecuador_td ####
# } else if(case %in% c("ecuador_td",
# "ecuador_td_hot")){
# URL <- "https://raw.githubusercontent.com/atmoschem/vein/master/projects/ecuador_td.tar.gz"
# tf <- paste0(tempfile(), ".tar.gz")
# utils::download.file(url = URL,
# destfile = tf)
# utils::untar(tarfile = tf, exdir = directory)
# message("Your directory is in ", directory)
#
# ecuador_td_im ####
} else if(case %in% c("ecuador_td",
"ecuador_td_hot",
Expand Down Expand Up @@ -259,7 +239,8 @@ get_project <- function(directory,
utils::untar(tarfile = tf, exdir = paste0(directory, "/industry"))
message("Your directory for industrial emissions is in ", directory)

} else if(case %in% c("sebr_cb05co2")){
} else if(case %in% c("sebr_cb05co2",
"sebr_cb05co2_im")){
dir.create(directory)
tf <- paste0(tempfile(), ".tar.gz")

Expand Down Expand Up @@ -287,34 +268,6 @@ get_project <- function(directory,

message("Your directory is in ", directory) #nocov end

# sebr_cb05co2_im ####
} else if(case %in% c("sebr_cb05co2_im")){
dir.create(directory)
tf <- paste0(tempfile(), ".tar.gz")

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_im/MG.tar.gz",
destfile = tf)
utils::untar(tarfile = tf, exdir = paste0(directory, "/MG"))

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_im/SP.tar.gz",
destfile = tf)
utils::untar(tarfile = tf, exdir = paste0(directory, "/SP"))

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_im/RJ.tar.gz",
destfile = tf)
utils::untar(tarfile = tf, exdir = paste0(directory, "/RJ"))

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_im/merge_wrf.R",
destfile = paste0(directory, "/merge_wrf.R"))

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_im/sebr_cb05co2.Rproj",
destfile = paste0(directory, "/sebr_cb05co2.Rproj"))

utils::download.file(url = "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/sebr_cb05co2_wrfi.tar.gz",
destfile = paste0(directory, "/sebr_cb05co2_wrfi.tar.gz"))
utils::untar(tarfile = paste0(directory, "/sebr_cb05co2_wrfi.tar.gz"), exdir = directory)

message("Your directory is in ", directory) #nocov end
} else{
stop("Other cases not supported yet")
}
Expand Down
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-05-14T22:27Z
last_built: 2023-05-23T04:41Z
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.
42 changes: 21 additions & 21 deletions docs/reference/celsius.html

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

28 changes: 24 additions & 4 deletions docs/reference/get_project.html

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

Loading

0 comments on commit dc3c509

Please sign in to comment.