From a938439a07e0e0ee36b585b5c0ab4b75e99c26b4 Mon Sep 17 00:00:00 2001 From: David Blodgett <dblodgett@usgs.gov> Date: Tue, 7 Jan 2025 08:21:07 -0600 Subject: [PATCH] support limited vpu list in prep --- workspace/_targets/01_prep_targets.R | 4 +++- workspace/_targets_runner.R | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/workspace/_targets/01_prep_targets.R b/workspace/_targets/01_prep_targets.R index 5c93112..ec98d9a 100644 --- a/workspace/_targets/01_prep_targets.R +++ b/workspace/_targets/01_prep_targets.R @@ -69,7 +69,9 @@ list( tar_target(rpu_vpu, read.csv(system.file("extdata/rpu_vpu.csv", package = "hyfabric"), colClasses = "character")), - tar_target(vpu_codes, unique(rpu_vpu$vpuid)), + tar_target(vpu_codes, if(length(domain) == 1 && grepl("^[0-1]", domain)) + unique(rpu_vpu$vpuid[grepl(domain, rpu_vpu$vpuid)]) else + unique(rpu_vpu$vpuid)), tar_target(all_rpu_codes, unique(rpu_vpu$rpuid)), tar_target(full_cat_file, data_paths$fullcats_table, format = "file"), tar_target(full_cat_table, readRDS(full_cat_file)), diff --git a/workspace/_targets_runner.R b/workspace/_targets_runner.R index f0786c2..b5e17ad 100644 --- a/workspace/_targets_runner.R +++ b/workspace/_targets_runner.R @@ -12,12 +12,16 @@ file.remove("temp/GagestoCheck_GageLoc.csv") Sys.setenv(TAR_PROJECT = "01_prep") # step 1: gage selection +# do not run if gages aren't of interest tar_make(gage_selection_map_report) # step 2: vpu prep -# iterates over vpus +# the vpu_codes target controls how many VPUs worth of data are prepared +# set the "domain" variable to an HU02 in "R/user_vars.R" to restrict +tar_make(vpu_codes) tar_load(vpu_codes) +########## Debug help ################ if(FALSE) { # this won't run if you just bang through this file # To debug a given vpu, first run all to get the dynamic branches established: tar_make(vpu_base) @@ -37,7 +41,9 @@ if(FALSE) { # this won't run if you just bang through this file tar_make(callr_function = NULL) } +########## Debug help ################ +# if running many processing units, parallelization is possible workers <- 12 # run branches for a given target in parallel if you have enough memory @@ -48,8 +54,19 @@ tar_make(rpu_vpu_out) # make sure to run all too! tar_make() +# see what you've done with: +tar_visnetwork(targets_only = TRUE) +# and +View(tar_meta()) + Sys.setenv(TAR_PROJECT = "02_POI_creation") +tar_make(vpu_gpkg) + +# can see what we are going to run through +# the POI creation workflow loops over these +tar_read(vpu_gpkg) + tar_make_future(huc12_poi, workers = workers) tar_make_future(gage_pois, workers = workers) tar_make_future(te_pois, workers = workers) -- GitLab