diff --git a/DESCRIPTION b/DESCRIPTION index c0f12781d474cddb686c2d80d705b2e4d275c791..1a3ded97c87a0a9cb630baf87169a72015295b19 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -39,7 +39,7 @@ Suggests: knitr, testthat, usethis, rmarkdown VignetteBuilder: knitr SystemRequirements: Tested with at least 4 GB RAM. NeedsCompilation: no -Packaged: 2021-03-18 13:46:36 UTC; helge +Packaged: 2021-03-18 22:01:05 UTC; helge Author: Helge Jentsch [aut, cre], Maria Bobrowski [aut], Johannes Weidinger [aut], diff --git a/NAMESPACE b/NAMESPACE index bded6901791f25349fd62b6f352b61c2979bf94e..755652686a8ab823dbce9aaf5f517ec4a3465f09 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -21,6 +21,7 @@ import(raster) import(sf) import(sp) import(stringr) +importFrom(RefManageR,ReadBib) importFrom(RefManageR,ReadCrossRef) importFrom(RefManageR,WriteBib) importFrom(utils,download.file) diff --git a/R/auxiliary.R b/R/auxiliary.R index 9387b7b86ed51db334731cf96c1c4ef92a0eb9fd..3d0d35b5b487ac9961ed09624ad6ee9735b4e733 100644 --- a/R/auxiliary.R +++ b/R/auxiliary.R @@ -380,7 +380,9 @@ stacking.downloaded.data <- function(stack.save.location = "./", #'@note DISCLAIMER: No warranty or liability! The citations are provided without any warranty of any kind whatsoever, either expressed or implied, including warranties of merchantability and fitness for a particular purpose. The author should not be responsible for any incomplete citation of datasets or climate data products downloaded through this package. #' #'@importFrom RefManageR ReadCrossRef +#'@importFrom RefManageR ReadBib #'@importFrom RefManageR WriteBib +#'@importFrom utils download.file #' #'@export save.citation <- function(save.location = "./", @@ -392,25 +394,57 @@ save.citation <- function(save.location = "./", save.location <- paste0(normalizePath(save.location, winslash = "/"), "/") if(dataSetName == "Chelsa"){ + print("Please regard 'https://chelsa-climate.org/downloads/' for correct citations.") if(!file.exists(paste0(save.location, "chelsa_citation.bib"))){ + # citation_ <- RefManageR::ReadCrossRef("") + citation_paper <- RefManageR::ReadCrossRef("10.1038/sdata.2017.122") + citation_CHELSA_cmip5_ts <- RefManageR::ReadCrossRef("10.1038/s41597-020-00587-y") + citation_PBCOR <- RefManageR::ReadCrossRef("10.1175/JCLI-D-19-0332.1") + + # Data citation_data <- RefManageR::ReadCrossRef("10.5061/dryad.kd1d4") - print(citation_paper) - print(citation_data) - RefManageR::WriteBib(bib = c(citation_paper, citation_data), file = paste0(save.location, "chelsa_citation.bib")) + utils::download.file("https://www.envidat.ch/dataset/eur11/export/bibtex.bib", + destfile = paste0(tempdir(),"/bib_chelsa.bib"), quiet = T) + citation_EUR11 <- RefManageR::ReadBib(paste0(tempdir(),"/bib_chelsa.bib")) + unlink(x = paste0(tempdir(),"/bib_chelsa.bib")) + utils::download.file("https://www.envidat.ch/dataset/chelsacruts/export/bibtex.bib", + destfile = paste0(tempdir(),"/bib_chelsa.bib"), quiet = T) + citation_CHELSAcruts_data <- RefManageR::ReadBib(paste0(tempdir(),"/bib_chelsa.bib")) + unlink(x = paste0(tempdir(),"/bib_chelsa.bib")) + utils::download.file("https://www.envidat.ch/dataset/chelsa_cmip5_ts/export/bibtex.bib", + destfile = paste0(tempdir(),"/bib_chelsa.bib"), quiet = T) + citation_CHELSA_cmip5_ts_data <- RefManageR::ReadBib(paste0(tempdir(),"/bib_chelsa.bib")) + unlink(x = paste0(tempdir(),"/bib_chelsa.bib")) + + # Old versions + citation_Version1.0 <- RefManageR::ReadCrossRef("10.1594/WDCC/CHELSA_v1") + citation_Version1.1 <- RefManageR::ReadCrossRef("10.1594/WDCC/CHELSA_v1_1") + + eval(parse(text = paste0("print(c(", paste(ls(pattern = "citation_"), collapse = ","),"))"))) + eval(parse(text = paste0("RefManageR::WriteBib(bib = c(", + paste(ls(pattern = "citation_"), collapse = ","), + "), file = paste0(save.location, 'chelsa_citation.bib'))"))) } } if (dataSetName == "WorldClim1.4") { + print("Please regard 'www.worldclim.org' for correct citations.") if(!file.exists(paste0(save.location, "Worldclim14_citation.bib"))){ - citation <- RefManageR::ReadCrossRef("10.1002/joc.1276") - RefManageR::WriteBib(bib = citation, file = paste0(save.location, "Worldclim14_citation.bib")) + citation_WC14 <- RefManageR::ReadCrossRef("10.1002/joc.1276") + # citation_ <- RefManageR::ReadCrossRef("") + print(citation_WC14) + RefManageR::WriteBib(bib = citation_WC14, file = paste0(save.location, "Worldclim14_citation.bib")) } } if (dataSetName == "WorldClim2.1") { + print("Please regard 'www.worldclim.org' for correct citations.") if(!file.exists(paste0(save.location, "WorldClim21_citation.bib"))){ - citation <- RefManageR::ReadCrossRef("10.1002/joc.5086") - print(citation) - RefManageR::WriteBib(bib = citation, file = paste0(save.location, "WorldClim21_citation.bib")) + citation_WC21_hist_Clim_Monthly <- RefManageR::ReadCrossRef("10.1002/joc.5086") + citation_WC21_CRUTS403 <- RefManageR::ReadCrossRef("10.1002/joc.3711") + + print(c(citation_WC21_hist_Clim_Monthly, citation_WC21_CRUTS403)) + RefManageR::WriteBib(bib = c(citation_WC21_hist_Clim_Monthly, citation_WC21_CRUTS403), + file = paste0(save.location, "WorldClim21_citation.bib")) } } }