Skip to content
Snippets Groups Projects
Commit b1004931 authored by Jentsch, Helge's avatar Jentsch, Helge
Browse files

230814: Update Chelsa Timeseries Download. Note: Stacking is not available for...

230814: Update Chelsa Timeseries Download. Note: Stacking is not available for Chelsa.timeseries.download()-function at the moment.
parent 1ccb6c9f
No related branches found
No related tags found
No related merge requests found
Package: ClimDatDownloadR
Type: Package
Title: Downloads Climate Data from Chelsa and WorldClim
Version: 0.1.7-3
Version: 0.1.7-4
Authors@R: c(person("Helge", "Jentsch",
email = "helge.marc.ole.jentsch@uni-hamburg.de",
role = c("aut", "cre"),
......@@ -45,7 +45,7 @@ Suggests: knitr, testthat, usethis, rmarkdown
VignetteBuilder: knitr
SystemRequirements: Tested with at least 4 GB RAM.
NeedsCompilation: no
Packaged: 2023-07-18 09:50:31 UTC; helge
Packaged: 2023-08-14 18:54:05 UTC; helge
Author: Helge Jentsch [aut, cre],
Maria Bobrowski [aut],
Johannes Weidinger [aut],
......
......@@ -1138,7 +1138,6 @@ Chelsa.lgm.download <- function(save.location = "./",
#'@param clip.extent numeric (vector). Input vector with four numeric values. This is following the input order c("xleft", "xright", "ybottom", "ytop").\cr Default: \code{c(-180, 180, -90, 90)}
#'@param buffer numeric. Input of decimal degrees of buffer around the shapefile and/or extent. \cr Default: \code{0}
#'@param convert.files.to.asc logical. Input whether files should be converted into the ASCII format.\cr If \code{TRUE}: a new subdirectory is created and the rawdata is saved there. \cr If \code{clipping} is \code{TRUE}: the clipped raster files are also saved as ASCII grids. \cr Default: \code{FALSE}
#'@param stacking.data logical. Input whether the downloaded data should be stacked as a netCDF-rasterstack. \cr Default: \code{FALSE}
#'@param combine.raw.zip logical. Should the downloaded raw-data be "zipped". \cr Default: \code{FALSE}
#'@param delete.raw.data logical. Should the downloaded raw-data be deleted. If \code{combine.raw.zip} is \code{TRUE}: raw-data is still available in the zipped file. \cr Default: \code{FALSE}
#'@param save.bib.file logical. Whether a BibTex-citation file of the dataset should be provided in the Working directory. \cr Default: \code{TRUE}
......@@ -1166,7 +1165,7 @@ Chelsa.lgm.download <- function(save.location = "./",
#'@importFrom utils unzip download.file setTxtProgressBar txtProgressBar
#'
#'
#'@export
#'
Chelsa.timeseries.download <- function(save.location = "./",
parameter = c("prec", "tmax", "tmin"),
start.year.var = 1979,
......
This diff is collapsed.
......@@ -592,6 +592,10 @@ getDownloadSize <- function(URLVector){
filesizes <- sum(filesizes,fileISize)
# return(Downloadsize)
}
availDiscSpaceMB <- as.numeric(stringr::str_remove(base::system("wmic logicaldisk get freespace", inter=TRUE)[2], pattern = " \r"))/1024/1024
# if(availDiscSpaceMB < round(filesizes*0.000001, 2)){
# print(paste0(round(filesizes*0.000001, 2),"MB will be downloaded. These is only ", availDiscSpaceMB, "MB available. Please consider another download location."))
# }
return(round(filesizes*0.000001, 2))
# Download size in MB
......
......@@ -350,18 +350,18 @@ provided by <a href="http://chelsa-climate.org/">Chelsa</a> and <a href="https:/
<p>To start, you’ll have to install the package and it’s dependencies
first, if not already done. Then you can activate the package with the
<code>library</code>-function.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="co"># install.packages(&quot;ClimDatDownloadR&quot;, dependencies = TRUE)</span></span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(ClimDatDownloadR)</span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: terra</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; terra 1.7.39</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; which was just loaded, will retire in October 2023.</span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Please refer to R-spatial evolution reports for details, especially</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; https://r-spatial.org/r/2023/05/15/evolution4.html.</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; It may be desirable to make the sf package available;</span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; package maintainers should consider adding sf to Suggests:.</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; The sp package is now running under evolution status 2</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; (status 2 uses the sf package in place of rgdal)</span></span></code></pre></div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" tabindex="-1"></a><span class="co"># install.packages(&quot;ClimDatDownloadR&quot;, dependencies = TRUE)</span></span>
<span id="cb1-2"><a href="#cb1-2" tabindex="-1"></a><span class="fu">library</span>(ClimDatDownloadR)</span>
<span id="cb1-3"><a href="#cb1-3" tabindex="-1"></a><span class="co">#&gt; Loading required package: terra</span></span>
<span id="cb1-4"><a href="#cb1-4" tabindex="-1"></a><span class="co">#&gt; terra 1.7.39</span></span>
<span id="cb1-5"><a href="#cb1-5" tabindex="-1"></a><span class="co">#&gt; The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,</span></span>
<span id="cb1-6"><a href="#cb1-6" tabindex="-1"></a><span class="co">#&gt; which was just loaded, will retire in October 2023.</span></span>
<span id="cb1-7"><a href="#cb1-7" tabindex="-1"></a><span class="co">#&gt; Please refer to R-spatial evolution reports for details, especially</span></span>
<span id="cb1-8"><a href="#cb1-8" tabindex="-1"></a><span class="co">#&gt; https://r-spatial.org/r/2023/05/15/evolution4.html.</span></span>
<span id="cb1-9"><a href="#cb1-9" tabindex="-1"></a><span class="co">#&gt; It may be desirable to make the sf package available;</span></span>
<span id="cb1-10"><a href="#cb1-10" tabindex="-1"></a><span class="co">#&gt; package maintainers should consider adding sf to Suggests:.</span></span>
<span id="cb1-11"><a href="#cb1-11" tabindex="-1"></a><span class="co">#&gt; The sp package is now running under evolution status 2</span></span>
<span id="cb1-12"><a href="#cb1-12" tabindex="-1"></a><span class="co">#&gt; (status 2 uses the sf package in place of rgdal)</span></span></code></pre></div>
<p>Very well, now that you have the package installed and attached,
let’s start with the data sets of the climatologies of Chelsa and
WorldClim.</p>
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Chelsa_Download_functions.R
% Please edit documentation in R/Chelsa_Download_functions.R,
% R/Chelsa_new_download_functions.R
\name{Chelsa.timeseries.download}
\alias{Chelsa.timeseries.download}
\title{CHELSA Timeseries Download}
\usage{
Chelsa.timeseries.download(
save.location = "./",
parameter = c("prec", "tmax", "tmin"),
parameter = c("prec", "temp", "tmax", "tmin"),
start.year.var = 1979,
start.month.var = 1,
end.year.var = 2013,
end.month.var = 12,
include.month.var = c(1:12),
version.var = c("1.2"),
clipping = FALSE,
clip.shapefile = NULL,
buffer = 0,
clip.extent = c(-180, 180, -90, 90),
convert.files.to.asc = FALSE,
combine.raw.zip = FALSE,
delete.raw.data = FALSE,
save.bib.file = TRUE
)
Chelsa.timeseries.download(
save.location = "./",
parameter = c("prec", "temp", "tmax", "tmin"),
start.year.var = 1979,
start.month.var = 1,
end.year.var = 2013,
end.month.var = 12,
include.month.var = c(1:12),
version.var = c("1.2"),
clipping = FALSE,
clip.shapefile = NULL,
buffer = 0,
clip.extent = c(-180, 180, -90, 90),
convert.files.to.asc = FALSE,
stacking.data = FALSE,
combine.raw.zip = FALSE,
delete.raw.data = FALSE,
save.bib.file = TRUE
......@@ -38,6 +58,8 @@ Chelsa.timeseries.download(
\item{include.month.var}{integer (vector). Input which monthly data should be downloaded. \cr Default: \code{c(1:12)}}
\item{version.var}{string (vector). Input which version of the dataset should be downloaded. Multiple selection is _not_ possible. Select between version _1.2_ and _2.1_.\cr Default: \code{c("1.2")}}
\item{clipping}{logical. Input whether the downloaded data should be clipped.\cr If \code{FALSE}: \code{clip.shapefile}, \code{buffer}, \code{clip.extent} will be ignored. \cr Default: \code{FALSE}}
\item{clip.shapefile}{string. Input which shapefile should be used for clipping. \cr Default: \code{NULL}}
......@@ -48,8 +70,6 @@ Chelsa.timeseries.download(
\item{convert.files.to.asc}{logical. Input whether files should be converted into the ASCII format.\cr If \code{TRUE}: a new subdirectory is created and the rawdata is saved there. \cr If \code{clipping} is \code{TRUE}: the clipped raster files are also saved as ASCII grids. \cr Default: \code{FALSE}}
\item{stacking.data}{logical. Input whether the downloaded data should be stacked as a netCDF-rasterstack. \cr Default: \code{FALSE}}
\item{combine.raw.zip}{logical. Should the downloaded raw-data be "zipped". \cr Default: \code{FALSE}}
\item{delete.raw.data}{logical. Should the downloaded raw-data be deleted. If \code{combine.raw.zip} is \code{TRUE}: raw-data is still available in the zipped file. \cr Default: \code{FALSE}}
......@@ -57,12 +77,18 @@ Chelsa.timeseries.download(
\item{save.bib.file}{logical. Whether a BibTex-citation file of the dataset should be provided in the Working directory. \cr Default: \code{TRUE}}
}
\value{
Custom dataset of CHELSA Timeseries for a chosen timeseries.
Custom dataset of CHELSA Timeseries for a chosen timeseries.
}
\description{
This function supports a download of the CHELSA Timeseries dataset (Jan. 1979 - Dec. 2013). This includes precipitation sums (mm) and temperature (average, maximum, minimum; °C) parameters. For further information, please regard \url{http://chelsa-climate.org/timeseries/}.\cr To allow pre-processing, clipping and buffering, conversion to ASCII-grids and stacking options are included.\cr Optional an output of a .bib-file of the cited literature can be retrieved.\cr For user convenience, saving directories will be created automatically. Also options to "zip" and/or delete the RAW-files are included.
This function supports a download of the CHELSA Timeseries dataset (Jan. 1979 - Dec. 2013). This includes precipitation sums (mm) and temperature (average, maximum, minimum; °C) parameters. For further information, please regard \url{http://chelsa-climate.org/timeseries/}.\cr To allow pre-processing, clipping and buffering, conversion to ASCII-grids and stacking options are included.\cr Optional an output of a .bib-file of the cited literature can be retrieved.\cr For user convenience, saving directories will be created automatically. Also options to "zip" and/or delete the RAW-files are included.
}
\note{
Please note that the downloaded data for temperature are processed to °C with one significant decimal without offset and factor. Processing and conversion to other file-formats on a global dataset may take some time.
Please note that the downloaded data for temperature are processed to °C with one significant decimal without offset and factor. Processing and conversion to other file-formats on a global dataset may take some time.
}
\examples{
......@@ -75,10 +101,24 @@ Chelsa.timeseries.download(parameter = "prec",
include.month.var = c(1,12))
}
\dontrun{
Chelsa.timeseries.download(parameter = "prec",
start.year.var = 2000,
start.month.var = 1,
end.year.var = 2002,
end.month.var = 12,
version.var = "1.2",
include.month.var = c(1,12))
}
}
\references{
D. N. Karger, O. Conrad, J. B{\"o}hner , et al. "Climatologies at high resolution for the earth's land surface areas". In: _Scientific Data_ 4.1 (Sep. 2017). DOI: 10.1038/sdata.2017.122. <URL: https://doi.org/10.1038/sdata.2017.122>.
D. N. Karger, O. Conrad, J. B{\"o}hner , et al. _Data from: Climatologies at high resolution for the earth's land surface areas_. En. 2018. DOI: 10.5061/DRYAD.KD1D4. <URL: http://datadryad.org/stash/dataset/doi:10.5061/dryad.kd1d4>.
D. N. Karger, O. Conrad, J. B{\"o}hner , et al. "Climatologies at high resolution for the earth's land surface areas". In: _Scientific Data_ 4.1 (Sep. 2017). DOI: 10.1038/sdata.2017.122. <URL: https://doi.org/10.1038/sdata.2017.122>.
D. N. Karger, O. Conrad, J. B{\"o}hner , et al. _Data from: Climatologies at high resolution for the earth's land surface areas_. En. 2018. DOI: 10.5061/DRYAD.KD1D4. <URL: http://datadryad.org/stash/dataset/doi:10.5061/dryad.kd1d4>.
}
\author{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment