generated from NERC-CEH/R_pkg_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.R
92 lines (80 loc) · 2.85 KB
/
run.R
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
84
85
86
87
88
89
90
91
92
here::i_am("./run.R")
library(targets)
# tar_config_set(script = "_targets.R", store = "_targets", project = "main")
# tar_config_set(script = "_targets_biochar1.R", store = "_targets_biochar1", project = "biochar1")
# tar_config_set(script = "_targets_digestate1.R", store = "_targets_digestate1", project = "digestate1")
# tar_config_set(script = "_targets_divine1.R", store = "_targets_divine1", project = "divine1")
# tar_config_set(script = "_targets_mix1.R", store = "_targets_mix1", project = "mix1")
# tar_config_set(script = "_targets_shading1.R", store = "_targets_shading1", project = "shading1")
# tar_config_set(script = "_targets_split1.R", store = "_targets_split1", project = "split1")
# tar_config_set(script = "_targets_yield1.R", store = "_targets_yield1", project = "yield1")
source("_targets.R")
Sys.setenv(TAR_PROJECT = "main")
tar_outdated()
Sys.setenv(TAR_PROJECT = "biochar1")
tar_make()
Sys.setenv(TAR_PROJECT = "digestate1")
tar_make()
Sys.setenv(TAR_PROJECT = "divine1")
tar_make()
Sys.setenv(TAR_PROJECT = "mix1")
tar_make()
Sys.setenv(TAR_PROJECT = "shading1")
tar_make()
Sys.setenv(TAR_PROJECT = "split1")
tar_make()
Sys.setenv(TAR_PROJECT = "yield1")
tar_make()
tar_outdated()
# running in parallel seems to cause some problems for individual experiment projects
system.time(tar_make_future(workers = 4L))
tar_make()
tar_read(test)
summary(tar_read(dt)$TA)
summary(dt$TA)
summary(dt$PPFD_IN)
# for debugging
lapply(v_pkgs, require, character.only = TRUE)
tar_load_everything(strict = FALSE)
tar_load_everything(store = here("_targets_biochar1"))
tar_outdated(starts_with("dt_"))
tar_outdated(starts_with("manuscript_"))
system.time(tar_make(starts_with("p_")))
system.time(tar_make(starts_with("manuscript_")))
system.time(tar_make())
tar_load(starts_with("p_"))
p_unfilt
ggsave(p_unfilt, file = "output/HRG/diurnal1/p_unfilt__2023-06-01.png")
ggsave(p_chi_co2, file = "output/HRG/diurnal1/p_chi_co2_2023-06-01.png")
ggsave(p_chi_ch4, file = "output/HRG/diurnal1/p_chi_ch4_2023-06-01.png")
ggsave(p_chi_n2o, file = "output/HRG/diurnal1/p_chi_n2o_2023-06-01.png")
p_chi_co2
p_chi_ch4
p_chi_n2o
p_flux_co2
p_flux_ch4
p_flux_n2o
l_meta$dt_site
l_meta$dt_expt
l_meta$dt_trmt
length(unique(dt$core_id))
length(unique(dt$site_id))
length(unique(dt[survey == "RAC", core_id]))
dim(dt)
(unique(dt[survey == "RAC", lat]))
tar_manifest(fields = "command") # list the targets
# visualise the network of targets / pipeline workflow
g <- tar_glimpse()
g$height <- 1000; g$width <- "100%"
g
v <- tar_visnetwork(targets_only = TRUE)
v$height <- 1000; v$width <- "100%"
v
tar_visnetwork()
# serial
system.time(tar_make())
# parallel
system.time(tar_make_future(workers = 5L))
system.time(tar_make_future(workers = 5L))
system.time(tar_make_future(starts_with("l_"), workers = 5L))
use_targets()