Skip to content

Commit

Permalink
update runners and version
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejohnson51 committed Mar 5, 2024
1 parent 1d4838e commit e96f2f6
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Package: hydrofab
Type: Package
Title: Hydrologic Network Refactoring and Aggregation Tools
Version: 0.5.0
Version: 0.5.1
Authors@R: c(person(given = "Mike", family = "Johnson",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-5288-8350"),
email = "[email protected]"),
person("David", "Blodgett",
role = c("ctb"),
email = "[email protected]"))
Description: A collection of tools for maniputatling hydrologic and hydraulic networks
Description: A collection of tools for manipulating hydrologic and hydraulic networks
URL: https://github.com/mikejohnson51/hydrofab
BugReports: https://github.com/mikejohnson51/hydrofab/issues
Depends:
Expand Down
22 changes: 1 addition & 21 deletions runners/03_aggregate.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pacman::p_load(hydrofabric, arrow)
pacman::p_load(hydrofabric)
devtools::load_all()

vpus = vpu_boundaries$VPUID[1:21]
Expand All @@ -22,8 +22,6 @@ for (i in 1:nrow(process)) {

VPU = process$vpus[i]



refactored_gpkg = get_hydrofabric(VPU = VPU,
type = "refactor",
dir = glue("{base}/refactored"))
Expand All @@ -50,22 +48,4 @@ for (i in 1:nrow(process)) {
}


## TASK 2: Assign Globally Unique Identifiers ----

unlink(process$global)

gs_file = 'https://code.usgs.gov/wma/nhgf/reference-hydrofabric/-/raw/04cd22f6b5f3f53d10c0b83b85a21d2387dfb6aa/workspace/cache/rpu_vpu_out.csv'

modifications = read.csv(gs_file) %>%
filter(VPUID != toVPUID) %>%
rename(from = COMID, to = toCOMID)

meta = assign_global_identifiers(gpkgs = process$outfiles,
outfiles = process$global,
modifications = modifications)

## TASK 3: Assign Globally Unique Identifiers
##
for(i in 1:nrow(process)){
try(append_style(process$global[i], layer_names = c("flowpaths", "divides", "hydrolocations")), silent = TRUE)
}
35 changes: 35 additions & 0 deletions runners/04_global_id.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## TASK 2: Assign Globally Unique Identifiers ----

pacman::p_load(hydrofabric)
devtools::load_all()

vpus = vpu_boundaries$VPUID[1:21]

base = '/Volumes/MyBook/nextgen'

## TASK 1: build out uniform catchment distribution ----
process = data.frame(
vpus = vpus,
outfiles = glue("{base}/uniform/uniform_{vpus}.gpkg"),
global = glue("{base}/global_uniform/uniform_{vpus}.gpkg")
)

unlink(process$global)

gs_file = 'https://code.usgs.gov/wma/nhgf/reference-hydrofabric/-/raw/04cd22f6b5f3f53d10c0b83b85a21d2387dfb6aa/workspace/cache/rpu_vpu_out.csv'

modifications = read.csv(gs_file) %>%
filter(VPUID != toVPUID) %>%
rename(from = COMID, to = toCOMID)

meta = assign_global_identifiers(gpkgs = process$outfiles,
outfiles = process$global,
modifications = modifications)

for(i in 1:nrow(process)){
try(append_style(process$global[i], layer_names = c("flowpaths", "divides", "hydrolocations")), silent = TRUE)
}

arrow::read_parquet('/Users/mjohnson/Downloads/ml_exports.parquet')


0 comments on commit e96f2f6

Please sign in to comment.