---
title: "available datasets"
# output: rmarkdown::pdf_document
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{available datasets}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

## Overview of datasets available in `pastclim`

A number of datasets are available in pastclim. It is possible to use custom datasets as long as they are properly formatted (look at the article on how to format custom datasets if you are interested). It is possible to get a list of all available datasets with:

```{r}
library(pastclim)
```

```{r echo=FALSE, results='hide'}
data_path <- file.path(tempdir(), "pastclim_data")
# clear it in case it exists already
unlink(data_path, recursive = TRUE)
# set data path
set_data_path(
  path_to_nc = data_path,
  ask = FALSE,
  write_config = FALSE,
  copy_example = TRUE
)
```

```{r}
get_available_datasets()
```

A more comprehensive list can be obtained with:
```{r}
list_available_datasets()
```


For each dataset, you can get detailed information using the 
help function:

```{r eval=FALSE}
help("Example")
```

```{r echo=FALSE}
pastclim:::get_dataset_info(dataset = "Example")
```

Here we provide the full documentation for each dataset (sorted in alphabetical order):
```{r echo=FALSE}
list_datasets <- list_available_datasets()
# replace datasets with multiple versions with a single string
list_datasets <- c(
  list_datasets[!grepl("WorldClim_2.1", list_datasets)],
  "WorldClim_2.1"
)
list_datasets <- c(
  list_datasets[!grepl("paleoclim_1.0", list_datasets)],
  "paleoclim_1.0"
)
list_datasets <- c(
  list_datasets[!grepl("CHELSA_2.1", list_datasets)],
  "CHELSA_2.1"
)
for (i in sort(list_datasets)) {
  pastclim:::get_dataset_info(i)
  cat("\n#######################################################\n")
}
```