Skip to content

Commit c7d7bad

Browse files
committed
update readme
1 parent 7105b89 commit c7d7bad

File tree

2 files changed

+927
-561
lines changed

2 files changed

+927
-561
lines changed

README.Rmd

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ knitr::opts_chunk$set(
1212
library(magrittr)
1313
library(modisfast)
1414
library(dplyr)
15+
library(kableExtra)
1516
```
1617
# modisfast
1718
<!-- <img src="man/figures/logo.png" align="right" /> -->
@@ -175,13 +176,13 @@ Currently `modisfast` supports download of `r nrow(mf_list_collections())` data
175176

176177
Details of each product available for download are provided in the tables below or through the function `mf_list_collections()`.
177178

178-
<details><summary><b>MODIS and VIIRS data collections accessible with modisfast (click to expand)</b></summary>
179-
<p>
180179

181180
```{r, eval = TRUE, echo=F,message=F}
182-
library(kableExtra)
183-
mf_list_collections() %>%
184-
dplyr::filter(source %in% c("MODIS", "VIIRS")) %>%
181+
182+
fun_display_coll <- function(filts){
183+
184+
cols <- mf_list_collections() %>%
185+
dplyr::filter(nature %in% filts) %>%
185186
dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
186187
dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
187188
dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
@@ -192,32 +193,29 @@ mf_list_collections() %>%
192193
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
193194
kable("html", escape = FALSE) %>%
194195
kable_styling(bootstrap_options = c("hover", "condensed"))
196+
197+
return(cols)
198+
199+
}
200+
201+
cols_natures <- unique(mf_list_collections()$nature)
202+
195203
```
196204

197-
</p>
198-
</details>
199205

200-
<details><summary><b>Other (non-MODIS or VIIRS) data collections accessible with modisfast (click to expand)</b></summary>
201-
<p>
206+
```{r, eval = TRUE, echo=F, message=F, results='asis'}
207+
for(i in 1:length(cols_natures)){
208+
if(i==1){
209+
cat('<details><summary><b>',cols_natures[i],'</b> data collections <b>(click to expand)</b></summary>')
210+
} else {
211+
cat('<details><summary><b>',cols_natures[i],'</b> data collections</summary>')
212+
}
213+
cat(knitr::asis_output(fun_display_coll(cols_natures[i])))
214+
cat('</details>')
215+
}
202216
203-
```{r, eval = TRUE, echo=F,message=F}
204-
library(kableExtra)
205-
mf_list_collections() %>%
206-
dplyr::filter(!(source %in% c("MODIS", "VIIRS"))) %>%
207-
dplyr::mutate(collection = cell_spec(collection, "html", link = doi)) %>%
208-
dplyr::mutate(spatial_resolution_m = paste0(spatial_resolution_m, " m")) %>%
209-
dplyr::mutate(temporal_resolution = paste0(temporal_resolution," ",temporal_resolution_unit)) %>%
210-
dplyr::mutate(temporal_resolution = ifelse(temporal_resolution=="1 day", "Daily", temporal_resolution)) %>%
211-
dplyr::mutate(start_date = paste0(start_date," to present")) %>%
212-
dplyr::select(collection, source, nature, long_name, spatial_resolution_m, temporal_resolution, start_date) %>%
213-
dplyr::arrange(nature, source, spatial_resolution_m, rev(temporal_resolution)) %>%
214-
dplyr::rename(Collection = collection, Type = nature, Name = long_name, Source = source, 'Spatial resolution' = spatial_resolution_m, 'Temporal resolution' = temporal_resolution, 'Temporal extent' = start_date) %>%
215-
kable("html", escape = FALSE) %>%
216-
kable_styling(bootstrap_options = c("hover", "condensed"))
217217
```
218218

219-
</p>
220-
</details>
221219

222220
## Manual testing of the functionality
223221

0 commit comments

Comments
 (0)