From 23ec641c57f7152edeb66edc7e7323fc609c296b Mon Sep 17 00:00:00 2001 From: rafnuss Date: Wed, 19 Oct 2022 14:17:51 -0400 Subject: [PATCH] Bump to 2.7. Minor style and update --- DESCRIPTION | 2 +- R/graph.R | 24 +++++++++++------------- man/geopressureviz.Rd | 2 +- man/graph_download_wind.Rd | 15 +++------------ 4 files changed, 16 insertions(+), 27 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 379a6d8f..2b953a1a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: GeoPressureR Title: Global Positioning by Atmospheric Pressure -Version: 2.6 +Version: 2.7 Authors@R: c( person("Raphaƫl", "Nussbaumer", , "rafnuss@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-8185-1020")), diff --git a/R/graph.R b/R/graph.R index d2d8f1da..623e48d6 100644 --- a/R/graph.R +++ b/R/graph.R @@ -375,13 +375,11 @@ graph_trim <- function(gr) { #' ](https://raphaelnussbaumer.com/GeoPressureManual/wind-graph.html#download-wind-data) #' @export graph_download_wind <- function(pam, - area, # area is specified as N, W, S, E - sta_id = seq_len(nrow(pam$sta) - 1), - cds_key = Sys.getenv("cds_key"), - cds_user = Sys.getenv("cds_user"), - transfer = FALSE, - path = paste0("data/5_wind_graph/", pam$id, "/"), - verbose = TRUE) { + area, # area is specified as N, W, S, E + sta_id = seq_len(nrow(pam$sta) - 1), + cds_key = Sys.getenv("cds_key"), + cds_user = Sys.getenv("cds_user"), + path = paste0("data/5_wind_graph/", pam$id, "/")) { assertthat::assert_that(is.list(pam)) assertthat::assert_that(assertthat::has_name(pam, "pressure")) assertthat::assert_that(is.data.frame(pam$pressure)) @@ -834,14 +832,14 @@ graph_marginal <- function(grl) { # forward mapping of marginal probability map_f <- Matrix::sparseMatrix(rep(1, length(grl$equipment)), - grl$equipment, - x = 1, dims = c(1, n) + grl$equipment, + x = 1, dims = c(1, n) ) # backward mapping of marginal probability map_b <- Matrix::sparseMatrix(grl$retrieval, - rep(1, length(grl$retrieval)), - x = 1, dims = c(n, 1) + rep(1, length(grl$retrieval)), + x = 1, dims = c(n, 1) ) # build iteratively the marginal probability backward and forward by re-using the mapping @@ -850,12 +848,12 @@ graph_marginal <- function(grl) { map_f[1, grl$equipment] <- 1 map_f <- map_f %*% trans - map_b[grl$retrieval,1] <- 1 + map_b[grl$retrieval, 1] <- 1 map_b <- trans %*% map_b } # add the retrieval and equipment at the end to finish it map_f[1, grl$equipment] <- 1 - map_b[grl$retrieval,1] <- 1 + map_b[grl$retrieval, 1] <- 1 # combine the forward and backward map <- map_f * Matrix::t(map_b) diff --git a/man/geopressureviz.Rd b/man/geopressureviz.Rd index e7f45cf1..2df50e71 100644 --- a/man/geopressureviz.Rd +++ b/man/geopressureviz.Rd @@ -61,7 +61,7 @@ geopressureviz( pressure_prob = pressure_prob, light_prob = light_prob, pressure_timeserie = static_timeserie - ) +) } } \seealso{ diff --git a/man/graph_download_wind.Rd b/man/graph_download_wind.Rd index f30af6ee..0b933eb6 100644 --- a/man/graph_download_wind.Rd +++ b/man/graph_download_wind.Rd @@ -10,9 +10,7 @@ graph_download_wind( sta_id = seq_len(nrow(pam$sta) - 1), cds_key = Sys.getenv("cds_key"), cds_user = Sys.getenv("cds_user"), - transfer = FALSE, - path = paste0("data/5_wind_graph/", pam$id, "/"), - verbose = TRUE + path = paste0("data/5_wind_graph/", pam$id, "/") ) } \arguments{ @@ -29,14 +27,10 @@ list ordered by North, West, South, East (e.g. \code{c(50,-16,0,20)}).} \item{cds_user}{Token provided by ECMWF. See \code{\link[=wf_set_key]{wf_set_key()}}.} -\item{transfer}{logical, download data (default = FALSE)} - \item{path}{Path were to store the downloaded data.} - -\item{verbose}{show feedback on processing (default = TRUE)} } \value{ -List of the R6 object with download/transfer information if \code{transfer = FALSE}. See +The path of the downloaded (requested file). } \description{ This function download the wind data from \href{https://cds.climate.copernicus.eu/cdsapp#!/dataset/reanalysis-era5-pressure-levels?tab=overview}{ERA5 hourly pressure level} @@ -47,10 +41,7 @@ The flight are determined from the stationary periods classified \code{pam$sta} (see \code{pam_classify()}). It request a single file for each flight using the exact time (hourly basis) and pressure (altitude). To make the download more efficient, \href{https://bluegreen-labs.github.io/ecmwfr/articles/advanced_vignette.html#batch-parallel-requests}{\code{wf_request_batch()}} -is used to download all wind file at the same time (up to 20 requests in parallel). If more -data is downloaded at the same time (e.g., multiple tracks) and you don't want to wait or block -your R console, use \code{transfer=FALSE} to make the requests on the CDS and download the queries -later with \code{req$transfer()}. +is used to download all wind file at the same time (up to 20 requests in parallel). To be able to download data from the Climate Data Store (CDS), you will need to create an account on \url{https://cds.climate.copernicus.eu}. You can then save