Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ClimDatDownloadR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jentsch, Helge
ClimDatDownloadR
Commits
1ccb6c9f
Commit
1ccb6c9f
authored
Jul 18, 2023
by
Jentsch, Helge
Browse files
Options
Downloads
Patches
Plain Diff
minor updates to Chelsa.CRUts-function
parent
2bb517ec
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
DESCRIPTION
+2
-2
2 additions, 2 deletions
DESCRIPTION
R/Chelsa_Download_functions.R
+15
-13
15 additions, 13 deletions
R/Chelsa_Download_functions.R
with
17 additions
and
15 deletions
DESCRIPTION
+
2
−
2
View file @
1ccb6c9f
Package: ClimDatDownloadR
Type: Package
Title: Downloads Climate Data from Chelsa and WorldClim
Version: 0.1.7-
2
Version: 0.1.7-
3
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-
06
09:
14:58
UTC;
admin
Packaged: 2023-07-
18
09:
50:31
UTC;
helge
Author: Helge Jentsch [aut, cre],
Maria Bobrowski [aut],
Johannes Weidinger [aut],
...
...
This diff is collapsed.
Click to expand it.
R/Chelsa_Download_functions.R
+
15
−
13
View file @
1ccb6c9f
...
...
@@ -53,7 +53,7 @@ Chelsa.Clim.download.deprecated<- function(save.location = "./",
delete.raw.data
=
FALSE
,
save.bib.file
=
TRUE
){
gc
()
call.time
<-
str_replace_all
(
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
call.time
<-
stringr
::
str_replace_all
(
stringr
::
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
# initial check -----------------------------------------------------------
# normalize Path for easier application later
save.location
<-
normalizePath
(
save.location
,
winslash
=
"/"
)
...
...
@@ -126,7 +126,7 @@ Chelsa.Clim.download.deprecated<- function(save.location = "./",
# set the 2nd order temporal save location to create a
# managable directory tree in the 1st order directory
temp.temp.save.location
<-
paste0
(
temp.save.location
,
str_replace_all
(
interm
,
stringr
::
str_replace_all
(
interm
,
pattern
=
"/"
,
"_"
),
vers_path
,
"/"
)
...
...
@@ -517,7 +517,7 @@ Chelsa.CMIP_5.download <- function(save.location = "./",
# requireNamespace("ncdf4")
gc
()
save.location
<-
normalizePath
(
save.location
,
winslash
=
"/"
)
call.time
<-
str_replace_all
(
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
call.time
<-
stringr
::
str_replace_all
(
stringr
::
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
# the build of this function is very similar to the Chelsa.Clim.download function.
if
(
is.element
(
"prec"
,
parameter
)
|
is.element
(
"temp"
,
parameter
)
|
is.element
(
"tmax"
,
parameter
)
|
is.element
(
"tmin"
,
parameter
)){
...
...
@@ -562,7 +562,7 @@ Chelsa.CMIP_5.download <- function(save.location = "./",
for
(
model
in
model.var
)
{
for
(
emission.scenario
in
emission.scenario.var
)
{
temp.temp.save.location
<-
paste0
(
temp.save.location
,
str_replace_all
(
interm
,
stringr
::
str_replace_all
(
interm
,
pattern
=
"/"
,
"_"
),
model
,
"_"
,
...
...
@@ -832,7 +832,7 @@ Chelsa.lgm.download <- function(save.location = "./",
# requireNamespace("RCurl")
# requireNamespace("ncdf4")
gc
()
call.time
<-
str_replace_all
(
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
call.time
<-
stringr
::
str_replace_all
(
stringr
::
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
# initial check -----------------------------------------------------------
# normalize Path for easier application later
save.location
<-
normalizePath
(
save.location
,
winslash
=
"/"
)
...
...
@@ -883,7 +883,7 @@ Chelsa.lgm.download <- function(save.location = "./",
for
(
model
in
model.var
)
{
# download of the requested datasets -------------------------------------
temp.temp.save.location
<-
paste0
(
temp.save.location
,
str_replace_all
(
interm
,
stringr
::
str_replace_all
(
interm
,
pattern
=
"/"
,
"_"
),
"LGM_PMIP_"
,
model
,
"/"
)
...
...
@@ -1188,7 +1188,7 @@ Chelsa.timeseries.download <- function(save.location = "./",
# requireNamespace("RCurl")
# requireNamespace("ncdf4")
gc
()
call.time
<-
str_replace_all
(
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
call.time
<-
stringr
::
str_replace_all
(
stringr
::
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
# initial check -----------------------------------------------------------
# normalize Path for easier application later
save.location
<-
normalizePath
(
save.location
,
winslash
=
"/"
)
...
...
@@ -1262,7 +1262,7 @@ Chelsa.timeseries.download <- function(save.location = "./",
temp.save.location
<-
paste0
(
save.location
,
"/"
,
i
,
"/"
)
# to go analog to the functions before
temp.temp.save.location
<-
paste0
(
temp.save.location
,
str_replace_all
(
interm
,
stringr
::
str_replace_all
(
interm
,
pattern
=
"/"
,
"_"
),
"timeseries"
,
"/"
)
...
...
@@ -1452,7 +1452,7 @@ Chelsa.CRUts.download <- function(save.location = "./",
# requireNamespace("RCurl")
# requireNamespace("ncdf4")
gc
()
call.time
<-
str_replace_all
(
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
call.time
<-
stringr
::
str_replace_all
(
stringr
::
str_replace_all
(
paste0
(
Sys.time
()),
pattern
=
":"
,
replacement
=
"-"
),
pattern
=
" "
,
replacement
=
"_"
)
# initial check -----------------------------------------------------------
# normalize Path for easier application later
save.location
<-
normalizePath
(
save.location
,
winslash
=
"/"
)
...
...
@@ -1531,7 +1531,7 @@ Chelsa.CRUts.download <- function(save.location = "./",
temp.save.location
<-
paste0
(
save.location
,
"/"
,
i
,
"/"
)
# to go analog to the functions before
temp.temp.save.location
<-
paste0
(
temp.save.location
,
str_replace_all
(
interm
,
stringr
::
str_replace_all
(
interm
,
pattern
=
"/"
,
"_"
),
"CRU_timeseries"
,
"/"
)
...
...
@@ -1584,8 +1584,9 @@ Chelsa.CRUts.download <- function(save.location = "./",
mustWork
=
T
),
"/temp_gdalwarped.tif"
)
# gdalUtils::gdalwarp(dest.temp, raster.temp.file.dest)
raster.temp
<-
terra
::
rast
(
raster.temp.file.dest
)
raster.temp
<-
terra
::
clamp
(
raster.temp
,
lower
=
-1000
,
useValues
=
FALSE
)
# raster.temp <- terra::rast(raster.temp.file.dest)
raster.temp
<-
terra
::
rast
(
dest.temp
)
raster.temp
<-
terra
::
clamp
(
raster.temp
,
lower
=
-1000
)
raster.temp
<-
process.raster.int.doub
(
raster.temp
)
terra
::
writeRaster
(
x
=
raster.temp
,
filename
=
dest.temp
,
...
...
@@ -1659,3 +1660,4 @@ Chelsa.CRUts.download <- function(save.location = "./",
# Saving BIB File
if
(
save.bib.file
==
TRUE
)
save.citation
(
save.location
=
save.location
,
dataSetName
=
"CHELSA"
)
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment