Skip to content

Commit 2a872bf

Browse files
Merge pull request #1925 from LaviniaBaumstark/REMIND_release3p4p0
remind release 3.4.0
2 parents 337d130 + 66d8468 commit 2a872bf

File tree

860 files changed

+8255
-21682
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

860 files changed

+8255
-21682
lines changed

.Rprofile

Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@ local({
33
# for some reason this also has implications for symlinking into the global cache
44
Sys.setenv(RENV_PATHS_LIBRARY = "renv/library")
55

6-
# remind's renv integration previously relied on renv.lock, but now it should generally not be used anymore
7-
# this can safely be removed in January 2024
8-
if (file.exists("renv.lock") && file.exists("README.md") && !file.exists("renv/old_renv.lock")) {
9-
file.rename("renv.lock", "renv/old_renv.lock")
10-
message("moved legacy renv.lock to renv/old_renv.lock")
11-
}
12-
136
# do not check if library and renv.lock are in sync, because normally renv.lock does not exist
147
options(renv.config.synchronized.check = FALSE)
158

16-
source("renv/activate.R")
9+
# always set the renv project to the current directory
10+
Sys.setenv("RENV_PROJECT" = getwd())
1711

1812
# when increasing renvVersion first commit new version's activate script and
19-
# put that commit's hash into the download.file call below
13+
# put that commit's hash into the git checkout call below
2014
renvVersion <- "1.0.7"
15+
16+
# reset renv/activate.R to match renv 1.0.7
17+
gitRoot <- system2("git", c("rev-parse", "--show-toplevel"), stdout = TRUE)
18+
if (Sys.getenv("RESET_RENV_ACTIVATE_SCRIPT", unset = "TRUE") == "TRUE" &&
19+
normalizePath(gitRoot) == normalizePath(".")) {
20+
system2("git", c("checkout", "b83bb1811ff08d8ee5ba8e834af5dd0080d10e66", "--", "renv/activate.R"))
21+
}
22+
23+
source("renv/activate.R")
24+
2125
if (packageVersion("renv") != renvVersion) {
2226
renvLockExisted <- file.exists(renv::paths$lockfile())
2327
renv::install(paste0("renv@", renvVersion))
24-
message("Downloading 'renv/activate.R' of renv version 1.0.7")
25-
download.file("https://raw.githubusercontent.com/remindmodel/remind/b83bb1811ff08d8ee5ba8e834af5dd0080d10e66/renv/activate.R", "renv/activate.R")
2628
if (!renvLockExisted) {
2729
unlink(renv::paths$lockfile())
2830
}
@@ -36,30 +38,10 @@ if (!"https://rse.pik-potsdam.de/r/packages" %in% getOption("repos")) {
3638
if (isTRUE(rownames(installed.packages(priority = "NA")) == "renv")) {
3739
message("R package dependencies are not installed in this renv, installing now...")
3840
renv::install("rmarkdown", prompt = FALSE) # rmarkdown is required to find dependencies in Rmd files
39-
renv::hydrate() # auto-detect and install all dependencies
41+
renv::hydrate(prompt = FALSE, report = FALSE) # auto-detect and install all dependencies
4042
message("Finished installing R package dependencies.")
4143
}
4244

43-
# bootstrapping python venv, will only run once after remind is freshly cloned
44-
if (!dir.exists(".venv/")
45-
&& (Sys.which("python3") != ""
46-
|| (Sys.which("python.exe") != ""
47-
&& suppressWarnings(isTRUE(startsWith(system2("python.exe", "--version", stdout = TRUE), "Python 3")))
48-
))) {
49-
message("Python venv is not available, setting up now...")
50-
# use system python to set up venv
51-
if (.Platform$OS.type == "windows") {
52-
system2("python.exe", c("-mvenv", ".venv"))
53-
pythonInVenv <- normalizePath(file.path(".venv", "Scripts", "python.exe"), mustWork = TRUE)
54-
} else {
55-
system2("python3", c("-mvenv", ".venv"))
56-
pythonInVenv <- normalizePath(file.path(".venv", "bin", "python"), mustWork = TRUE)
57-
}
58-
# use venv python to install dependencies in venv
59-
system2(pythonInVenv, c("-mpip", "install", "--upgrade", "pip", "wheel"))
60-
system2(pythonInVenv, c("-mpip", "install", "-r", "requirements.txt"))
61-
}
62-
6345
# Configure locations of REMIND input data
6446
# These can be located in directories on the local machine, remote directories,
6547
# or default directories on the cluster.
@@ -74,51 +56,12 @@ if (!dir.exists(".venv/")
7456
# REMIND_repos_dirs="C:\my\first\path;D:\my\second\path"
7557
remindReposDirs <- Sys.getenv("REMIND_repos_dirs")
7658

77-
# for scp targets, you need to set three environment variables
78-
# on linux e.g. (separate multiple paths by semicolons)
79-
# REMIND_repos_scp="scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output;scp://cluster.pik-potsdam.de/p/projects/remind/inputdata/CESparametersAndGDX"
80-
# REMIND_repos_scp_user="myusername" # use your user name on the scp target, e.g. the cluster
81-
# REMIND_repos_scp_key="/home/myusername/.ssh/id_ed25519" # path to your your ssh private key on your laptop
82-
# on windows e.g.
83-
# REMIND_repos_scp="scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output;scp://cluster.pik-potsdam.de/p/projects/remind/inputdata/CESparametersAndGDX"
84-
# REMIND_repos_scp_user="myusername" # use your user name on the scp target, e.g. the cluster
85-
# REMIND_repos_scp_key="C:\Users\myusername\.ssh\id_ed25519" # path to your your ssh private key on your laptop
86-
remindReposSCP <- Sys.getenv("REMIND_repos_scp") # scp URL
87-
remindReposSCPUser <- Sys.getenv("REMIND_repos_scp_user") # ssh user name
88-
remindReposSCPKey <- Sys.getenv("REMIND_repos_scp_key") # ssh key path
89-
90-
# unless specified otherwise, use cluster defaults
91-
use_cluster_defaults <- TRUE
92-
9359
# add local directories, if any
9460
if ("" != remindReposDirs) {
95-
directories <- unlist(strsplit(remindReposDirs, .Platform$path.sep,
96-
fixed = TRUE))
61+
directories <- unlist(strsplit(remindReposDirs, .Platform$path.sep, fixed = TRUE))
9762
directoriesList <- rep(list(NULL), length(directories))
9863
names(directoriesList) <- directories
99-
10064
options(remind_repos = c(options("remind_repos")[[1]], directoriesList))
101-
use_cluster_defaults <- FALSE
102-
}
103-
104-
# add remote directories, if any remote directory and username and SSH key are set
105-
if ("" != remindReposSCP && "" != remindReposSCPUser && "" != remindReposSCPKey) {
106-
SCPUrls <- unlist(strsplit(remindReposSCP, ";", fixed = TRUE))
107-
config <- list(list(username = remindReposSCPUser, ssh_private_keyfile = remindReposSCPKey))
108-
for (SCPUrl in SCPUrls) {
109-
names(config) <- SCPUrl
110-
options(remind_repos = c(options("remind_repos")[[1]], config))
111-
}
112-
use_cluster_defaults <- FALSE
113-
}
114-
115-
# default to cluster directories
116-
if (use_cluster_defaults &&
117-
all(file.exists(c("/p/projects/rd3mod/inputdata/output",
118-
"/p/projects/remind/inputdata/CESparametersAndGDX")))) {
119-
options(remind_repos = list(
120-
"/p/projects/rd3mod/inputdata/output" = NULL,
121-
"/p/projects/remind/inputdata/CESparametersAndGDX" = NULL))
12265
}
12366

12467
# Include local calibration results, if they exist, from either the main

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.6.0
3+
rev: v5.0.0
44
hooks:
55
- id: check-case-conflict
66
- id: check-json

.zenodo.json

Lines changed: 0 additions & 253 deletions
This file was deleted.

0 commit comments

Comments
 (0)