Skip to content

Commit 8fffb9e

Browse files
committed
changed some verbose comment to cli
1 parent 7bcc0cd commit 8fffb9e

File tree

5 files changed

+43
-42
lines changed

5 files changed

+43
-42
lines changed

R/mf_download_data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ mf_download_data <- function(df_to_dl, path = tempfile("modisfast_"), parallel =
161161
if (verbose %in% c("inform","debug")) {
162162
maxFileSizeEstimated <- sum(data_dl$maxFileSizeEstimated[which(data_dl$fileDl == FALSE)])
163163
maxFileSizeEstimated <- dplyr::if_else(round(maxFileSizeEstimated/1000000)>1,round(maxFileSizeEstimated/1000000),1)
164-
cat("Downloading the data ... (destination folder:",path,")\nEstimated maximum data size to download is ~",maxFileSizeEstimated,"Mb\n")
164+
cat("Downloading the data ... (destination folder:",path,")\nEstimated maximum size of data to be downloaded is ~",maxFileSizeEstimated,"Mb\n")
165165
# cat("Downloading the data in",path,"...\n")
166166
}
167167
if (parallel) {
@@ -207,8 +207,8 @@ mf_download_data <- function(df_to_dl, path = tempfile("modisfast_"), parallel =
207207
actualFileSize <- dplyr::if_else(round(actualFileSize/1000000)>1,round(actualFileSize/1000000),1)
208208

209209
if (verbose %in% c("inform","debug")) {
210-
cat("\nData were all properly downloaded under the folder(s) ", paste(as.character(unique(dirname(df_to_dl$destfile))), collapse = " and "))
211-
cat("\nActual data size is",actualFileSize,"Mb\n")
210+
cli::cli_alert_success(paste0("\nData were all properly downloaded under the folder(s) ", paste(as.character(unique(dirname(df_to_dl$destfile))), collapse = " and ")))
211+
cat("\nActual size of downloaded data is",actualFileSize,"Mb\n")
212212
cli::cli_alert_info("\nTo import the data in R, use the function modisfast::mf_import_data() rather than terra::rast() or stars::read_stars(). More info at help(mf_import_data)\n")
213213
}
214214
}

R/mf_get_url.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ mf_get_url <- function(collection,
174174

175175
if (verbose %in% c("inform","debug")) {
176176
cli::cli_alert_success("URL(s) built.\n")
177-
cat("Estimated maximum data size is",maxFileSizeEstimated,"Mb\n")
177+
cat("Estimated maximum size of data to be downloaded is",maxFileSizeEstimated,"Mb\n")
178178
}
179179

180180
return(table_urls)

README.Rmd

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ library(dplyr)
2121
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/modisfast)](https://cran.r-project.org/package=modisfast)
2222
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.9.2-blue.svg)](https://github.com/ptaconet/modisfast)
2323
[![R-CMD-check](https://github.com/ptaconet/modisfast/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ptaconet/modisfast/actions/workflows/R-CMD-check.yaml)
24-
[![CRAN_downloads](https://cranlogs.r-pkg.org/badges/grand-total/modisfast)
25-
[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/ptaconet/modisfast/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/ptaconet/modisfast)
24+
<!-- [![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/ptaconet/modisfast/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/ptaconet/modisfast) -->
2625
<!-- [![DOI-zenodo](https://zenodo.org/badge/doi/10.5281/zenodo.8475.svg)](https://doi.org/10.5281/zenodo.12772739) -->
26+
[![CRAN_downloads](https://cranlogs.r-pkg.org/badges/grand-total/modisfast)
2727
[![DOI](https://joss.theoj.org/papers/abd5750a442de6a9d95b60bf49c440cb/status.svg)](https://joss.theoj.org/papers/abd5750a442de6a9d95b60bf49c440cb)
2828
<!-- badges: end -->
2929

@@ -49,8 +49,8 @@ This package enables to build OPeNDAP (https) URLs given input parameters such a
4949
• <a href="#installation">Installation</a><br>
5050
• <a href="#get-started">Get started</a><br>
5151
• <a href="#collections-available-in-modisfast">Data collections available</a><br>
52-
• <a href="#foundational-framework">Foundational framework</a><br>
5352
• <a href="#manual-testing-of-the-functionality">Manual testing of the functionality</a><br>
53+
• <a href="#foundational-framework">Foundational framework</a><br>
5454
• <a href="#comparison-with-similar-r-packages">Comparison with similar R packages</a><br>
5555
• <a href="#citation">Citation</a><br>
5656
• <a href="#future-developments">Future developments</a><br>
@@ -209,6 +209,18 @@ mf_list_collections() %>%
209209
</p>
210210
</details>
211211

212+
## Manual testing of the functionality
213+
214+
Since most `modisfast` functions depend on EarthData credentials, automated tests are disabled. However, after installation, users can manually test the package's functionality by running these lines of code :
215+
216+
```{r, eval = F, echo=T,message=F}
217+
# replace "username" and "password" with your own EOSDIS (Earthdata) credentials
218+
earthdata_un <- "username"
219+
earthdata_pw <- "password"
220+
221+
devtools::test("modisfast")
222+
```
223+
212224
## Foundational framework {#foundational-framework}
213225

214226
Technically, `modisfast` is a programmatic interface (R wrapper) to several NASA [OPeNDAP](https://www.opendap.org/) servers. OPeNDAP is the acronym for *Open-source Project for a Network Data Access Protocol* and designates both the software, the access protocol, and the corporation that develops them. The OPeNDAP is designed to simplify access to structured and high-volume data, such as satellite products, over the Web. It is a collaborative effort involving multiple institutions and companies, with open-source code, free software, and adherence to the [Open Geospatial Consortium](https://www.ogc.org/) (OGC) standards. It is widely used by NASA, which partly finances it.
@@ -231,19 +243,6 @@ The indices within the `[]` refer to values encoding for the spatial and tempora
231243

232244
These OPeNDAP URLs are not trivial to build. `modisfast` converts the spatial, temporal and dimensional filters (R objects) provided by the user through the function `mf_get_url()` into the appropriate OPeNDAP URL(s). Subsequently, the function `mf_download_data()` allows for downloading the data using the [`httr`](https://cran.r-project.org/package=httr) and `parallel` packages.
233245

234-
## Manual testing of the functionality
235-
236-
Since most `modisfast` functions depend on EarthData credentials, automated tests are disabled. However, after installation, users can manually test the package's functionality by running these lines of code :
237-
238-
```{r, eval = F, echo=T,message=F}
239-
# replace "username" and "password" with your own EOSDIS (Earthdata) credentials
240-
earthdata_un <- "username"
241-
earthdata_pw <- "password"
242-
243-
devtools::test("modisfast")
244-
```
245-
246-
247246
## Comparison with similar R packages
248247

249248
There are other R packages available for accessing MODIS data. Below is a comparison of modisfast with other packages available for downloading chunks of MODIS or VIIRS data :

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/modisfast)](https://cran.r-project.org/package=modisfast)
1111
[![Github_Status_Badge](https://img.shields.io/badge/Github-0.9.2-blue.svg)](https://github.com/ptaconet/modisfast)
1212
[![R-CMD-check](https://github.com/ptaconet/modisfast/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/ptaconet/modisfast/actions/workflows/R-CMD-check.yaml)
13-
\[![CRAN_downloads](https://cranlogs.r-pkg.org/badges/grand-total/modisfast)
14-
[![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/ptaconet/modisfast/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/ptaconet/modisfast)
13+
<!-- [![SWH](https://archive.softwareheritage.org/badge/origin/https://github.com/ptaconet/modisfast/)](https://archive.softwareheritage.org/browse/origin/?origin_url=https://github.com/ptaconet/modisfast) -->
1514
<!-- [![DOI-zenodo](https://zenodo.org/badge/doi/10.5281/zenodo.8475.svg)](https://doi.org/10.5281/zenodo.12772739) -->
15+
\[![CRAN_downloads](https://cranlogs.r-pkg.org/badges/grand-total/modisfast)
1616
[![DOI](https://joss.theoj.org/papers/abd5750a442de6a9d95b60bf49c440cb/status.svg)](https://joss.theoj.org/papers/abd5750a442de6a9d95b60bf49c440cb)
1717
<!-- badges: end -->
1818

@@ -38,10 +38,10 @@ This package enables to build OPeNDAP (https) URLs given input parameters such a
3838
<a href="#installation">Installation</a><br> •
3939
<a href="#get-started">Get started</a><br> •
4040
<a href="#collections-available-in-modisfast">Data collections
41-
available</a><br> • <a href="#foundational-framework">Foundational
42-
framework</a><br> •
41+
available</a><br> •
4342
<a href="#manual-testing-of-the-functionality">Manual testing of the
44-
functionality</a><br> •
43+
functionality</a><br> • <a href="#foundational-framework">Foundational
44+
framework</a><br> •
4545
<a href="#comparison-with-similar-r-packages">Comparison with similar R
4646
packages</a><br> • <a href="#citation">Citation</a><br> •
4747
<a href="#future-developments">Future developments</a><br> •
@@ -1380,6 +1380,21 @@ Rainfall
13801380
</p>
13811381
</details>
13821382

1383+
## Manual testing of the functionality
1384+
1385+
Since most `modisfast` functions depend on EarthData credentials,
1386+
automated tests are disabled. However, after installation, users can
1387+
manually test the package’s functionality by running these lines of code
1388+
:
1389+
1390+
``` r
1391+
# replace "username" and "password" with your own EOSDIS (Earthdata) credentials
1392+
earthdata_un <- "username"
1393+
earthdata_pw <- "password"
1394+
1395+
devtools::test("modisfast")
1396+
```
1397+
13831398
## Foundational framework
13841399

13851400
Technically, `modisfast` is a programmatic interface (R wrapper) to
@@ -1425,21 +1440,6 @@ downloading the data using the
14251440
[`httr`](https://cran.r-project.org/package=httr) and `parallel`
14261441
packages.
14271442

1428-
## Manual testing of the functionality
1429-
1430-
Since most `modisfast` functions depend on EarthData credentials,
1431-
automated tests are disabled. However, after installation, users can
1432-
manually test the package’s functionality by running these lines of code
1433-
:
1434-
1435-
``` r
1436-
# replace "username" and "password" with your own EOSDIS (Earthdata) credentials
1437-
earthdata_un <- "username"
1438-
earthdata_pw <- "password"
1439-
1440-
devtools::test("modisfast")
1441-
```
1442-
14431443
## Comparison with similar R packages
14441444

14451445
There are other R packages available for accessing MODIS data. Below is

vignettes/articles/get_started.Rmd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,13 @@ These issues can easily be dealt at the import phase in R using the function `mf
160160
# import MOD11A1.061
161161
# argument 'path' is the folder where the data are stored (here, in a temporary directory)
162162
modis_ts <- mf_import_data(path = dirname(list.files(path = tempdir(), pattern = "MOD13A3.061", recursive = TRUE, full.names = TRUE)),
163-
collection = "MOD13A3.061")
163+
collection = "MOD13A3.061",
164+
proj_epsg = 4326)
164165
165166
# import GPM
166167
gpm_ts <- mf_import_data(path = unique(dirname(list.files(path = tempdir(), pattern = "3IMERG", recursive = TRUE, full.names = TRUE))),
167-
collection = "GPM_3IMERGM.07")
168+
collection = "GPM_3IMERGM.07",
169+
proj_epsg = 4326)
168170
169171
modis_ts
170172
gpm_ts

0 commit comments

Comments
 (0)