Skip to content

Commit

Permalink
update display of collections in Readme + very minor modifs
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaconet committed Nov 12, 2024
1 parent 715e8fa commit 41615f0
Show file tree
Hide file tree
Showing 8 changed files with 1,096 additions and 371 deletions.
2 changes: 1 addition & 1 deletion R/mf_download_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ mf_download_data <- function(df_to_dl, path = tempfile("modisfast_"), parallel =
if (verbose %in% c("inform","debug")) {
maxFileSizeEstimated <- sum(data_dl$maxFileSizeEstimated[which(data_dl$fileDl == FALSE)])
maxFileSizeEstimated <- dplyr::if_else(round(maxFileSizeEstimated/1000000)>1,round(maxFileSizeEstimated/1000000),1)
cat("Downloading the data ... (destination folder:",path,")\nEstimated maximum size of data to be downloaded is ~",maxFileSizeEstimated,"Mb\n")
cat("Downloading the data (destination folder:",path,") ...\nEstimated maximum size of data to be downloaded is ~",maxFileSizeEstimated,"Mb\n")
# cat("Downloading the data in",path,"...\n")
}
if (parallel) {
Expand Down
2 changes: 1 addition & 1 deletion R/mf_login.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mf_login <- function(credentials, verbose = "inform") {
} else if (verbose == "debug"){
x <- httr::with_verbose(f())
}
httr::stop_for_status(x, "login to Earthdata. Wrong username / password, or service / servers unavailable.")
httr::stop_for_status(x, "login to Earthdata. Wrong username / password, or service / servers unavailable")
httr::warn_for_status(x)
options(earthdata_user = credentials[1])
options(earthdata_pass = credentials[2])
Expand Down
5 changes: 3 additions & 2 deletions R/mf_modisfast.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#' Earth Observation data quickly and efficiently.
#' This function is a wrapper for
#' \link{mf_login}, \link{mf_get_url}, \link{mf_download_data} and \link{mf_import_data}.
#' Whenever possible, users should prefer executing the functions \link{mf_login},
#' \link{mf_get_url}, \link{mf_download_data} and \link{mf_import_data} sequentially
#' rather than using this high-level function
#'
#' @inheritParams mf_get_url
#' @inheritParams mf_download_data
Expand All @@ -19,8 +22,6 @@
#' object ; else a data.frame providing details of the data downloaded
#' (see output of \link{mf_download_data}).
#'
#' @note Whenever possible, users should prefer executing the functions \link{mf_login}, \link{mf_get_url}, \link{mf_download_data} and \link{mf_import_data} sequentially rather than using this \code{modisfast} high-level function
#'
#' @seealso \link{mf_login}, \link{mf_get_url}, \link{mf_download_data}, \link{mf_import_data}
#' @export
#' @examples
Expand Down
18 changes: 14 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,13 @@ library(kableExtra)
mf_list_collections() %>%
dplyr::filter(source %in% c("MODIS", "VIIRS")) %>%
dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
dplyr::select(collection, source, long_name, nature) %>%
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source) %>%
dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
dplyr::mutate(temporal_resolution = ifelse(temporal_resolution=="1 day", "Daily", temporal_resolution)) %>%
dplyr::mutate(start_date = paste0(start_date," to present")) %>%
dplyr::select(collection, source, nature, long_name, spatial_resolution_m, temporal_resolution, start_date) %>%
dplyr::arrange(nature, source, spatial_resolution_m, rev(temporal_resolution)) %>%
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
kable("html", escape = FALSE) %>%
kable_styling(bootstrap_options = c("hover", "condensed"))
```
Expand All @@ -200,8 +205,13 @@ library(kableExtra)
mf_list_collections() %>%
dplyr::filter(!(source %in% c("MODIS", "VIIRS"))) %>%
dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
dplyr::select(collection, source, long_name, nature) %>%
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source) %>%
dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
dplyr::mutate(temporal_resolution = ifelse(temporal_resolution=="1 day", "Daily", temporal_resolution)) %>%
dplyr::mutate(start_date = paste0(start_date," to present")) %>%
dplyr::select(collection, source, nature, long_name, spatial_resolution_m, temporal_resolution, start_date) %>%
dplyr::arrange(nature, source, spatial_resolution_m, rev(temporal_resolution)) %>%
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
kable("html", escape = FALSE) %>%
kable_styling(bootstrap_options = c("hover", "condensed"))
```
Expand Down
Loading

0 comments on commit 41615f0

Please sign in to comment.