-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path_targets.R
More file actions
274 lines (243 loc) · 8.92 KB
/
_targets.R
File metadata and controls
274 lines (243 loc) · 8.92 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Load packages required to define the pipeline:
library(targets)
library(tarchetypes)
# Set target options:
tar_option_set(
packages = c("tidyverse"),
memory = "transient",
garbage_collection = TRUE,
seed = 1
)
# Run the R scripts with custom functions:
tar_source(
files = c(
"src/",
"create_bookdown.R")
)
# Replace the target list below with your own:
config_targets <- list(
# Grab configuration information for the workflow run (config.yml)
tar_target(
name = p0_harmonization_config,
# The config package does not like to be used with library()
command = config::get(config = "admin_update"),
cue = tar_cue("always")
),
# Google Drive IDs
# More manual interaction with these datasets is required, so not designed to
# be locally passed from pipeline to pipeline
tar_target(
name = p2_general_drive_ids,
command = tribble(
~name, ~id,
"p1_global_grid_20240701.rds", "1Aiyd1hFyJXAdSOk8Q-BQBaHrnsIX4_96"
),
cue = tar_cue("always")
),
tar_target(
name = p2_chl_drive_ids,
command = tribble(
~name, ~id,
"p1_wqp_params_chl_20240701.rds", "1MtHbroy3d1wZgfiu1rxCTSdhMIO6lar8",
"p2_site_counts_chl_20240701.rds","1xkmY74scyQtxopimGEC_aMMD5XZo0IZy",
"p3_documented_drops_chla_20240701.rds", "1s2VAH4Z1BQxLtVC6O__SKyicBwK3ZsQJ"
),
cue = tar_cue("always")
),
tar_target(
name = p2_doc_drive_ids,
command = tribble(
~name, ~id,
"p1_wqp_params_doc_20240701.rds", "1Zg4I4UVovzAoZlldX2PVYgrl-Jp8WDtU",
"p2_site_counts_doc_20240701.rds","1SOvg5D4-vNB8B_U95kbwq9I7jmk2iLhH",
"p3_documented_drops_doc_20240701.rds", "1qP5hvr3vu4BbRu1SAhiCdW-fvgHjlLzT"
),
cue = tar_cue("always")
),
tar_target(
name = p2_sdd_drive_ids,
command = tribble(
~name, ~id,
"p1_wqp_params_sdd_20240701.rds", "1ha9C8_LJlOzCottstGaZCrjSmrswL-JJ",
"p2_site_counts_sdd_20240701.rds","1uu60NG_L2a5sUKCzCA8N64KzgxXHGwWJ",
"p3_documented_drops_sdd_20240701.rds", "1PvtQC-ehT-2s3iXH_GPQA3Y32k6oLKDS"
),
cue = tar_cue("always")
),
tar_target(
name = p2_tss_drive_ids,
command = tribble(
~name, ~id,
"p1_wqp_params_tss_20250430.rds", "1tI5lF80-dTvUgaOWD7SVubI9yV1f4nB2",
"p2_site_counts_tss_20250430.rds","1oRZzRHhaTk09lExlk4q63EF7viiya2uv",
"p3_documented_drops_tss_20250430.rds", "1S6tse63RUetc8Y_ipXkpcNGi9kQxZHge"
),
cue = tar_cue("always")
),
# AOI grid
tar_target(
name = p1_global_grid,
command = retrieve_data(target = "p1_global_grid",
id_df = p2_general_drive_ids,
local_folder = "in/general",
stable = p0_harmonization_config$general_use_stable,
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$general_stable_date),
packages = c("tidyverse", "googledrive")
),
# CharacteristicNames by param
# Chl
tar_target(
name = p1_wqp_params_chl,
command = retrieve_data(target = "p1_wqp_params_chl",
id_df = p2_chl_drive_ids,
local_folder = "in/chla",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$chl_stable_date),
packages = c("tidyverse", "googledrive")
),
# DOC
tar_target(
name = p1_wqp_params_doc,
command = retrieve_data(target = "p1_wqp_params_doc",
id_df = p2_doc_drive_ids,
local_folder = "in/doc",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$doc_stable_date),
packages = c("tidyverse", "googledrive")
),
# SDD
tar_target(
name = p1_wqp_params_sdd,
command = retrieve_data(target = "p1_wqp_params_sdd",
id_df = p2_sdd_drive_ids,
local_folder = "in/sdd",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$sdd_stable_date),
packages = c("tidyverse", "googledrive")
),
# TSS
tar_target(
name = p1_wqp_params_tss,
command = retrieve_data(target = "p1_wqp_params_tss",
id_df = p2_tss_drive_ids,
local_folder = "in/tss",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$tss_stable_date),
packages = c("tidyverse", "googledrive")
),
# Site counts
# Chl
tar_target(
name = p2_site_counts_chl,
command = retrieve_data(target = "p2_site_counts_chl",
id_df = p2_chl_drive_ids,
local_folder = "in/chla",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$chl_stable_date),
packages = c("tidyverse", "googledrive")
),
# DOC
tar_target(
name = p2_site_counts_doc,
command = retrieve_data(target = "p2_site_counts_doc",
id_df = p2_doc_drive_ids,
local_folder = "in/doc",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$doc_stable_date),
packages = c("tidyverse", "googledrive")
),
# SDD
tar_target(
name = p2_site_counts_sdd,
command = retrieve_data(target = "p2_site_counts_sdd",
id_df = p2_sdd_drive_ids,
local_folder = "in/sdd",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$sdd_stable_date),
packages = c("tidyverse", "googledrive")
),
# TSS
tar_target(
name = p2_site_counts_tss,
command = retrieve_data(target = "p2_site_counts_tss",
id_df = p2_tss_drive_ids,
local_folder = "in/tss",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$tss_stable_date),
packages = c("tidyverse", "googledrive")
),
# Documentation of dropped rows
# Chl
tar_target(
name = p3_documented_drops_chla,
command = retrieve_data(target = "p3_documented_drops_chla",
id_df = p2_chl_drive_ids,
local_folder = "in/chla",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$chl_stable_date),
packages = c("tidyverse", "googledrive")
),
# DOC
tar_target(
name = p3_documented_drops_doc,
command = retrieve_data(target = "p3_documented_drops_doc",
id_df = p2_doc_drive_ids,
local_folder = "in/doc",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$doc_stable_date),
packages = c("tidyverse", "googledrive")
),
# SDD
tar_target(
name = p3_documented_drops_sdd,
command = retrieve_data(target = "p3_documented_drops_sdd",
id_df = p2_sdd_drive_ids,
local_folder = "in/sdd",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$sdd_stable_date),
packages = c("tidyverse", "googledrive")
),
# TSS
tar_target(
name = p3_documented_drops_tss,
command = retrieve_data(target = "p3_documented_drops_tss",
id_df = p2_tss_drive_ids,
local_folder = "in/tss",
google_email = p0_harmonization_config$google_email,
stable_date = p0_harmonization_config$tss_stable_date),
packages = c("tidyverse", "googledrive")
),
# Unit tables
# Chla
tar_file_read(
name = chla_unit_table,
command = "in/chla/chla_unit_table.csv",
cue = tar_cue("always"),
read = read_csv(file = !!.x)
),
# DOC
tar_file_read(
name = doc_unit_table,
command = "in/doc/doc_unit_table.csv",
cue = tar_cue("always"),
read = read_csv(file = !!.x)
),
# SDD
tar_file_read(
name = sdd_unit_table,
command = "in/sdd/sdd_unit_table.csv",
cue = tar_cue("always"),
read = read_csv(file = !!.x)
),
# TSS
tar_file_read(
name = tss_unit_table,
command = "in/tss/tss_unit_table.csv",
cue = tar_cue("always"),
read = read_csv(file = !!.x)
)
)
# Full targets list
c(config_targets,
bookdown_targets_list)