Skip to content

Commit

Permalink
add argentina and dmonths fix #228
Browse files Browse the repository at this point in the history
  • Loading branch information
ibarraespinosa committed Dec 2, 2024
1 parent 110ab4f commit 9006884
Show file tree
Hide file tree
Showing 293 changed files with 201 additions and 3,715 deletions.
21 changes: 15 additions & 6 deletions R/dmonth.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Number of days of the month
#'
#' \code{\link{ef_ldv_speed}} return the number of day sof the month
#' \code{\link{ef_ldv_speed}} return the number of days of the month
#'
#'
#' @param year Numeric
Expand All @@ -10,13 +10,22 @@
#' @export
#' @examples \dontrun{
#' dmonth(2022, 1)
#' dmonth(Sys.Date())
#' }
dmonth <- function(year, month) {
date <- ISOdate(year, month, 1, 0, 0, 0)
m <- format(date, format="%m")

while (format(date, format="%m") == m) {
date <- date + 1*3600
if(inherits(year, "Date")) {
date <- year
} else {
date <- as.Date(ISOdate(year, month, 1, 0, 0, 0))

}
return(as.integer(format(date - 1, format="%d")))

datef <- as.Date(unlist(lapply(seq_along(date), function(i) {
seq.Date(date[i], length.out = 2, by = "1 months")[2]
})))

ddif <- datef - date

return(as.integer(ddif))
}
19 changes: 19 additions & 0 deletions R/get_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @param case Character; One of of the following:
#' \tabular{llll}{
#' \strong{case} \tab \strong{Description}\tab \strong{EF} \tab \strong{Notes} \cr
#' argentina \tab top down\tab COPERT \tab .rds\cr
#' emislacovid \tab Bottom-up March 2020\tab CETESB \tab .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
Expand Down Expand Up @@ -131,6 +132,24 @@ get_project <- function(directory,
utils::untar(tarfile = tf, exdir = directory)
message("Your directory is in ", directory)

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

URL <- "https://gitlab.com/ibarraespinosa/veinextras/-/raw/master/wrf_argentina/wrfinput_d01"
tf <- paste0(tempfile(), ".tar.gz")
utils::download.file(url = URL,
destfile = paste0(directory, "/wrfinput_d01"))

message("Your directory is in ", directory)


message("Your directory is in ", directory)

# brazil_bu_chem_streets ####
} else if(case %in% c("brazil_bu_chem_streets",
"brazil_bu_chem_streets_im")){
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

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

2 changes: 1 addition & 1 deletion docs/CODE_OF_CONDUCT.html

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

2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.html

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

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

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

2 changes: 1 addition & 1 deletion docs/articles/basics.html

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

2 changes: 1 addition & 1 deletion docs/articles/index.html

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

2 changes: 1 addition & 1 deletion docs/authors.html

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

2 changes: 1 addition & 1 deletion docs/index.html

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

2 changes: 1 addition & 1 deletion docs/news/index.html

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

4 changes: 2 additions & 2 deletions docs/pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
pandoc: 3.1.11
pkgdown: 2.1.0
pkgdown: 2.1.1
pkgdown_sha: ~
articles:
basics: basics.html
last_built: 2024-08-21T04:00Z
last_built: 2024-12-02T06:11Z
urls:
reference: http://atmoschem.github.io/vein/reference
article: http://atmoschem.github.io/vein/articles
2 changes: 1 addition & 1 deletion docs/reference/EmissionFactors.html

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

2 changes: 1 addition & 1 deletion docs/reference/EmissionFactorsList.html

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

2 changes: 1 addition & 1 deletion docs/reference/Emissions.html

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

2 changes: 1 addition & 1 deletion docs/reference/EmissionsArray.html

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

2 changes: 1 addition & 1 deletion docs/reference/GriddedEmissionsArray.html

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

Binary file modified docs/reference/Speed-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/Speed-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/reference/Speed-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/reference/Speed.html

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

2 changes: 1 addition & 1 deletion docs/reference/Vehicles.html

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

2 changes: 1 addition & 1 deletion docs/reference/add_lkm.html

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

2 changes: 1 addition & 1 deletion docs/reference/add_miles.html

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

2 changes: 1 addition & 1 deletion docs/reference/add_polid.html

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

2 changes: 1 addition & 1 deletion docs/reference/addscale.html

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

2 changes: 1 addition & 1 deletion docs/reference/adt.html

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

2 changes: 1 addition & 1 deletion docs/reference/age.html

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

2 changes: 1 addition & 1 deletion docs/reference/age_hdv.html

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

2 changes: 1 addition & 1 deletion docs/reference/age_ldv.html

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

2 changes: 1 addition & 1 deletion docs/reference/age_moto.html

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

2 changes: 1 addition & 1 deletion docs/reference/aw.html

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

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.
2 changes: 1 addition & 1 deletion docs/reference/celsius.html

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

2 changes: 1 addition & 1 deletion docs/reference/check_nt.html

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

2 changes: 1 addition & 1 deletion docs/reference/cold_mileage.html

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

2 changes: 1 addition & 1 deletion docs/reference/colplot.html

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

2 changes: 1 addition & 1 deletion docs/reference/decoder.html

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

Loading

0 comments on commit 9006884

Please sign in to comment.