forked from PredictiveEcology/LandWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path05-options.R
More file actions
83 lines (74 loc) · 2.87 KB
/
05-options.R
File metadata and controls
83 lines (74 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
################################################################################
## Options
################################################################################
rep <- as.integer(substr(runName, nchar(runName) - 1, nchar(runName)))
.plotInitialTime <- if (is.na(rep)) {
NA
} else if (user("emcintir")) {
0
} else if (user("achubaty") && rep == 1) {
0
} else {
NA
}
maxMemory <- if (grepl("LandWeb", runName)) 5e+12 else 5e+9
scratchDir <- if (dir.exists(computeCanadaScratch)) {
computeCanadaScratch
} else {
file.path("/tmp/scratch/LandWeb")
}
rasterOptions(default = TRUE)
opts <- options(
"fftempdir" = scratchDir,
"future.globals.maxSize" = 1000*1024^2,
"LandR.assertions" = if (user("emcintir")) FALSE else FALSE,
"LandR.verbose" = if (user("emcintir")) 1 else 1,
"map.dataPath" = normPath(paths1$inputPath), # not used yet
"map.overwrite" = TRUE,
"map.tilePath" = tilePath,
"map.useParallel" = mapParallel,
"rasterMaxMemory" = maxMemory,
"rasterTmpDir" = scratchDir,
"reproducible.destinationPath" = normPath(paths1$inputPath),
#"reproducible.devMode" = if (user("emcintir")) TRUE else FALSE,
"reproducible.futurePlan" = if (.Platform$OS.type != "windows" && user("emcintir")) FALSE else FALSE,
"reproducible.inputPaths" = if (user("emcintir")) path.expand("~/data") else NULL,
"reproducible.overwrite" = TRUE,
"reproducible.quick" = FALSE,
"reproducible.showSimilar" = TRUE,
"reproducible.useCache" = if (pemisc::user("emcintir")) TRUE else TRUE,
"reproducible.useCloud" = TRUE,
"reproducible.useGDAL" = FALSE, ## NOTE: gdal is faster, but mixing gdal with raster causes inconsistencies
"reproducible.useMemoise" = ifelse(isTRUE(batchMode), FALSE, if (pemisc::user("emcintir")) FALSE else TRUE),
"reproducible.useGDAL" = FALSE,
"reproducible.useNewDigestAlgorithm" = TRUE,
"spades.moduleCodeChecks" = FALSE,
"spades.recoveryMode" = FALSE,
"spades.useRequire" = FALSE # Don't use Require... meaning assume all pkgs installed
)
library(googledrive)
httr::set_config(httr::config(http_version = 0))
token <- if (dir.exists(computeCanadaScratch)) {
file.path(activeDir, "landweb-82e0f9f29fbc.json")
} else if (Sys.info()['nodename'] == "landweb") {
file.path(activeDir, "landweb-e3147f3110bf.json")
} else {
NA_character_
} %>%
normPath(.)
if (is.na(token) || !file.exists(token))
message(crayon::red("no Google service token found"))
if (pemisc::user("achubaty")) {
if (utils::packageVersion("googledrive") < "1.0.0") {
#drive_auth(service_token = token)
drive_auth(email = "alex.chubaty@gmail.com")
} else {
#drive_auth(path = token)
drive_auth(email = "alex.chubaty@gmail.com")
}
} else if (pemisc::user("emcintir")) {
drive_auth(email = "eliotmcintire@gmail.com")
} else {
drive_auth(use_oob = quickPlot::isRstudioServer())
}
message(crayon::silver("Authenticating as: "), crayon::green(drive_user()$emailAddress))