@@ -101,6 +101,16 @@ ms_init <- function(use_gpu = FALSE,
101101 successes <- 0
102102 which_machine <- ' unknown'
103103
104+ # example dev computer 'registration' code block
105+ # # res <- try(setwd('~/your/file/path/to/macrosheds/data_processing'), silent=TRUE) # example
106+ # # if(! 'try-error' %in% class(res)){
107+ # # successes <- successes + 1
108+ # # which_machine <- 'your_machine') # machine name is completely up to you, does not matter
109+ # # instance_type <- 'dev' # instance type is 'dev' for all personal computers
110+ # # machine_status <- 'n00b' # unless you have > 32GB of RAM and > 8 CPUS, your 'n00b'
111+ # # op_system <- 'mac' # whats your OS?
112+ # # }
113+
104114 res <- try(setwd(' ~/macrosheds_data_processing' ), silent = TRUE ) # DCC
105115 if (! ' try-error' %in% class(res )){
106116 successes <- successes + 1
@@ -127,6 +137,15 @@ ms_init <- function(use_gpu = FALSE,
127137 machine_status <- ' 1337'
128138 op_system <- ' windows'
129139 }
140+
141+ res <- try(setwd(' /Users/hectorontiveros/Applications/data_processing' ), silent = FALSE ) # Hector
142+ if (! ' try-error' %in% class(res )){
143+ successes <- successes + 1
144+ which_machine <- ' hec'
145+ instance_type <- ' dev'
146+ machine_status <- ' n00b'
147+ op_system <- ' macOS'
148+ }
130149
131150 res <- try(setwd(' ~/desktop/macrosheds/data_acquisition' ), silent = TRUE ) # spencer
132151 if (! ' try-error' %in% class(res )){
@@ -137,6 +156,15 @@ ms_init <- function(use_gpu = FALSE,
137156 op_system <- ' mac'
138157 }
139158
159+ res <- try(setwd(' ~/Desktop/MacroSheds/data_processing/src/data_acquisition' ), silent = TRUE ) # pranavi
160+ if (! ' try-error' %in% class(res )){
161+ successes <- successes + 1
162+ which_machine <- ' Pranavi'
163+ instance_type <- ' dev'
164+ machine_status <- ' n00b'
165+ op_system <- ' mac'
166+ }
167+
140168 res <- try(setwd(' C:/Users/gubbi/Documents/macrosheds/data_processing' ), silent = TRUE ) # Nick
141169 if (! ' try-error' %in% class(res )){
142170 successes <- successes + 1
@@ -172,6 +200,15 @@ ms_init <- function(use_gpu = FALSE,
172200 # machine_status <- '1337'
173201 # }
174202
203+ res <- try(setwd(' /home/weston/science/macrosheds/data_processing' ), silent = TRUE ) # wes
204+ if (! ' try-error' %in% class(res )){
205+ successes <- successes + 1
206+ which_machine <- ' wes'
207+ instance_type <- ' dev'
208+ machine_status <- ' 1337'
209+ op_system <- ' linux'
210+ }
211+
175212 res <- try(setwd(' /home/macrosheds/data_acquisition' ), silent = TRUE ) # server
176213 if (! ' try-error' %in% class(res )){
177214 successes <- successes + 1
@@ -218,24 +255,29 @@ ms_instance <- ms_init(use_ms_error_handling = FALSE,
218255 config_storage_location = ' remote' )
219256
220257# load authorization file for macrosheds google sheets
221- googlesheets4 :: gs4_auth(path = ' googlesheet_service_accnt.json' )
258+ # # googlesheets4::gs4_auth(path = 'googlesheet_service_accnt.json')
222259
223260# read in secrets
224261conf <- jsonlite :: fromJSON(' config.json' ,
225262 simplifyDataFrame = FALSE )
226263
264+
227265# connect rgee to earth engine and python
228266gee_login <- case_when(
229267 ms_instance $ which_machine %in% c(' Mike' , ' BM1' ) ~ conf $ gee_login_mike ,
230- ms_instance $ which_machine %in% c(' Spencer' , ' BM0' , ' BM2' ) ~ conf $ gee_login_spencer ,
231- ms_instance $ which_machine %in% c(' Nick ' ) ~ conf $ gee_login_spencer ,
268+ ms_instance $ which_machine %in% c(' Spencer' , ' BM0' , ' BM2' , ' Nick ' ) ~ conf $ gee_login_spencer ,
269+ ms_instance $ which_machine %in% c(' Hector ' , ' Biniam ' , ' Pranavi ' , ' Wes ' ) ~ conf $ gee_login_ms ,
232270 TRUE ~ ' UNKNOWN' )
233271
234- # try(rgee::ee_Initialize(user = gee_login,
235- # drive = TRUE))
236-
272+ # load authorization file for macrosheds google sheets and drive
273+ # same account must have GEE and GDrive access
274+ googlesheets4 :: gs4_auth( email = gee_login )
237275googledrive :: drive_auth(email = gee_login )
238276
277+ # initialize and authorize GEE account
278+ try(rgee :: ee_Initialize(user = gee_login ,
279+ drive = TRUE ))
280+
239281# set up global logger. network-domain loggers are set up later
240282logging :: basicConfig()
241283logging :: addHandler(logging :: writeToFile ,
@@ -249,7 +291,7 @@ if(ms_instance$use_ms_error_handling){
249291 source_decoratees(' src/global/global_helpers.R' ) # parse decorators
250292}
251293
252- # puts ms_vars, site_data, ws_delin_specs, univ_products into the global environment
294+ # puts (google sheets) ms_vars, site_data, ws_delin_specs, univ_products into the global environment
253295load_config_datasets(from_where = ms_instance $ config_data_storage )
254296
255297
@@ -274,8 +316,6 @@ ms_globals <- c(ls(all.names = TRUE), 'ms_globals')
274316
275317dir.create(' logs' , showWarnings = FALSE )
276318
277- dmnrow = 29
278- # print(network_domain, n=50)
279319for (dmnrow in 1 : nrow(network_domain )){
280320
281321 # drop_automated_entries('.') #use with caution!
@@ -284,17 +324,19 @@ for(dmnrow in 1:nrow(network_domain)){
284324 network <- network_domain $ network [dmnrow ]
285325 domain <- network_domain $ domain [dmnrow ]
286326
287- # held_data = get_data_tracker(network, domain)
327+ held_data = get_data_tracker(network , domain )
288328
289- # held_data = invalidate_tracked_data(network, domain, 'munge')
290- # owrite_tracker(network, domain)
291- # held_data = invalidate_tracked_data(network, domain, 'derive')
292- # owrite_tracker(network, domain)
329+ # # dangerous lines - use at your own risk! :0
330+ # # held_data = invalidate_tracked_data(network, domain, 'munge')
331+ # # owrite_tracker(network, domain)
332+ # # held_data = invalidate_tracked_data(network, domain, 'derive')
333+ # # owrite_tracker(network, domain)
293334
294- # held_data = invalidate_tracked_data(network, domain, 'munge', 'precipitation')
295- # owrite_tracker(network, domain)
296- # held_data = invalidate_tracked_data(network, domain, 'derive', 'stream_flux_inst')
297- # owrite_tracker(network, domain)
335+ # # less dangerous version below, clears tracker for just a specified product
336+ # # held_data = invalidate_tracked_data(network, domain, 'munge', 'stream_chemistry')
337+ # # owrite_tracker(network, domain)
338+ # # held_data = invalidate_tracked_data(network, domain, 'derive', 'stream_flux_inst')
339+ # # owrite_tracker(network, domain)
298340
299341 logger_module <- set_up_logger(network = network ,
300342 domain = domain )
@@ -306,23 +348,27 @@ for(dmnrow in 1:nrow(network_domain)){
306348
307349 update_product_statuses(network = network ,
308350 domain = domain )
351+
309352 get_all_local_helpers(network = network ,
310- domain = domain )
353+ domain = domain )
311354
312355 ms_retrieve(network = network ,
313356 # prodname_filter = c('stream_chemistry'),
314357 domain = domain )
358+
315359 ms_munge(network = network ,
316360 prodname_filter = c(' stream_chemistry' ),
317361 domain = domain )
362+
318363 if (domain != ' mcmurdo' ){
319364 sw(ms_delineate(network = network ,
320365 domain = domain ,
321366 dev_machine_status = ms_instance $ machine_status ,
322367 verbose = TRUE ))
323368 }
369+
324370 ms_derive(network = network ,
325- prodname_filter = c(' discharge ' ),
371+ prodname_filter = c(' precip_pchem_pflux ' ),
326372 domain = domain )
327373
328374 if (domain != ' mcmurdo' ){
@@ -356,3 +402,4 @@ if(length(email_err_msgs)){
356402
357403loginfo(msg = ' Run complete' ,
358404 logger = logger_module )
405+
0 commit comments