diff --git a/workspace/_targets/01_prep_targets.R b/workspace/_targets/01_prep_targets.R index ec98d9ad90e489d7c71ed7fca1e145adab84fa92..7d1eab4c4dcf1195f507c1f3b88e15288e3b94c5 100644 --- a/workspace/_targets/01_prep_targets.R +++ b/workspace/_targets/01_prep_targets.R @@ -72,7 +72,9 @@ list( 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(rpu_codes, if(length(domain) == 1 && grepl("^[0-1]", domain)) + unique(rpu_vpu$rpuid[grepl(domain, rpu_vpu$rpuid)]) else + 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/03_refactor_targets.R b/workspace/_targets/03_refactor_targets.R index 6c459e4f900b601693a2d8cb6f4ff5c67bb23288..8c334f54614a81c74f1fde5061d9d652e588206b 100644 --- a/workspace/_targets/03_refactor_targets.R +++ b/workspace/_targets/03_refactor_targets.R @@ -16,7 +16,7 @@ prep_path <- ".targets_stores/01_prep/objects/" list(tar_target(data_paths_file, "cache/data_paths.json", format = "file"), tar_target(data_paths, jsonlite::read_json(data_paths_file)), - tar_target(rpu_codes_file, file.path(prep_path, "all_rpu_codes"), format = "file"), + tar_target(rpu_codes_file, file.path(prep_path, "rpu_codes"), format = "file"), tar_target(rpu_codes, readRDS(rpu_codes_file)), tar_target(rpu_vpu_file, file.path(prep_path, "rpu_vpu"), format = "file"), tar_target(rpu_vpu, readRDS(rpu_vpu_file)), diff --git a/workspace/_targets/04_aggregate_targets.R b/workspace/_targets/04_aggregate_targets.R index 6374f23689cea8003a014d24c46acacc3ea8146f..f20b4399ad0ac7972384f2b47a0db59ba3019d1d 100644 --- a/workspace/_targets/04_aggregate_targets.R +++ b/workspace/_targets/04_aggregate_targets.R @@ -15,7 +15,7 @@ source("R/04_aggregate_functions.R") prep_path <- ".targets_stores/01_prep/objects/" -list(tar_target(rpu_codes_file, file.path(prep_path, "all_rpu_codes"), format = "file"), +list(tar_target(rpu_codes_file, file.path(prep_path, "rpu_codes"), format = "file"), tar_target(rpu_codes, readRDS(rpu_codes_file)), tar_target(rpu_gpkg, file.path("cache", paste0(rpu_codes, "_refactor.gpkg")), pattern = map(rpu_codes), deployment = "worker"), diff --git a/workspace/_targets_runner.R b/workspace/_targets_runner.R index b5e17ad6c73a2abdf029975537e8ace52bb24792..594af6a03d708c86bb029045ba5065efebe364d2 100644 --- a/workspace/_targets_runner.R +++ b/workspace/_targets_runner.R @@ -21,6 +21,8 @@ tar_make(gage_selection_map_report) tar_make(vpu_codes) tar_load(vpu_codes) +tar_make(rpu_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: @@ -67,6 +69,7 @@ tar_make(vpu_gpkg) # the POI creation workflow loops over these tar_read(vpu_gpkg) +# if running many, each can be run independently. tar_make_future(huc12_poi, workers = workers) tar_make_future(gage_pois, workers = workers) tar_make_future(te_pois, workers = workers) @@ -89,20 +92,50 @@ tar_make_future(poi_lookup, workers = workers) tar_make_future(draft_segments, workers = workers) tar_make_future(write_poi_, workers = workers) +# Otherwise, just run all with +tar_make() + Sys.setenv(TAR_PROJECT = "03_refactor") +# iterate of "raster processing units" +tar_make(rpu_gpkg) +tar_make(vpu_gpkg) # need to track the vpu for each + +tar_read(rpu_gpkg) +tar_read(vpu_gpkg) + workers = 6 +# now make all the rpus that we need tar_make_future(workers = workers) Sys.setenv(TAR_PROJECT = "04_aggregate") +# iterate of "raster processing units" +tar_make(rpu_gpkg) +tar_make(agg_gpkg) # need to track the vpu for each + +tar_read(rpu_gpkg) +tar_read(agg_gpkg) # output to "aggregate" rpu gpkgs + workers = 6 tar_make_future(workers = workers) Sys.setenv(TAR_PROJECT = "05_non_dendritic") +# now we combine raster units back to vector processing units +tar_make(vpu_gpkg) +tar_read(vpu_gpkg) + +# outputs will be written to a refactor and final "GF" gpkg +tar_make(rfc_gpkg) +tar_read(rfc_gpkg) +tar_make(gf_gpkg) +tar_read(gf_gpkg) + +tar_make() + workers = 6 tar_make_future(workers = workers)