Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
reference-hydrofabric
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
nhgf
reference-hydrofabric
Commits
bfad51db
Commit
bfad51db
authored
3 months ago
by
Blodgett, David L.
Browse files
Options
Downloads
Patches
Plain Diff
reconcile divides
parent
423fe9e8
No related branches found
No related tags found
1 merge request
!183
Refactor - progress
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
workspace/R/03_refactor_functions.R
+23
-0
23 additions, 0 deletions
workspace/R/03_refactor_functions.R
workspace/_targets/03_refactor_targets.R
+23
-2
23 additions, 2 deletions
workspace/_targets/03_refactor_targets.R
workspace/_targets_runner.R
+0
-0
0 additions, 0 deletions
workspace/_targets_runner.R
with
46 additions
and
2 deletions
workspace/R/03_refactor_functions.R
+
23
−
0
View file @
bfad51db
...
...
@@ -165,4 +165,27 @@ create_refactor_lookup <- function(refactored_network, flowline, events_refactor
# }
out
<-
list
(
lookup
=
lookup_table
,
outlets
=
outlets_ref_COMID
,
dups
=
check_dups_poi
)
}
reconcile_divides
<-
function
(
cats
,
refactored_network
,
fdr_fac
,
para_reconcile
,
cache_split
)
{
divides
<-
reconcile_catchment_divides
(
catchment
=
cats
,
fline_ref
=
refactored_network
$
refactored
,
fline_rec
=
refactored_network
$
reconciled
,
fdr
=
fdr_fac
$
fdr
,
fac
=
fdr_fac
$
fac
,
para
=
para_reconcile
,
cache
=
cache_split
,
keep
=
NULL
)
load
(
cache_split
)
split_cats
<-
bind_rows
(
split_cats
[
lengths
(
split_cats
)
>
0
])
split_cats
$
areasqkm
<-
as.numeric
(
units
::
set_units
(
sf
::
st_area
(
split_cats
),
"km^2"
))
split_cats
<-
sf
::
st_transform
(
split_cats
,
proj_crs
)
list
(
divides
=
divides
,
split_cats
=
split_cats
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
workspace/_targets/03_refactor_targets.R
+
23
−
2
View file @
bfad51db
...
...
@@ -29,6 +29,7 @@ list(tar_target(data_paths_file, "cache/data_paths.json", format = "file"),
tar_target
(
flowline
,
sf
::
st_zm
(
sf
::
read_sf
(
rpu_gpkg
,
nhd_flowline
)),
pattern
=
map
(
rpu_gpkg
),
deployment
=
"worker"
),
tar_target
(
pois
,
sf
::
read_sf
(
vpu_gpkg
,
poi_geometry_table
),
pattern
=
map
(
vpu_gpkg
),
deployment
=
"worker"
),
tar_target
(
pois_data
,
sf
::
read_sf
(
vpu_gpkg
,
poi_data_table
),
...
...
@@ -48,6 +49,26 @@ list(tar_target(data_paths_file, "cache/data_paths.json", format = "file"),
tar_target
(
refactor_lookup
,
create_refactor_lookup
(
refactored_network
,
flowline
,
refactor_input
$
events_refactor
,
refactor_input
$
outlets
),
pattern
=
map
(
refactored_network
,
flowline
,
refactor_input
),
deployment
=
"worker"
)
pattern
=
map
(
refactored_network
,
flowline
,
refactor_input
),
deployment
=
"worker"
),
tar_target
(
fdr_fac
,
list
(
fdr
=
data_paths
$
fdr
[[
paste0
(
"rpu_"
,
rpu_codes
)]],
fac
=
data_paths
$
fac
[[
paste0
(
"rpu_"
,
rpu_codes
)]]),
pattern
=
rpu_codes
,
iteration
=
"list"
),
tar_target
(
raster_crs
,
terra
::
crs
(
terra
::
rast
(
fdr_fac
[[
1
]]
$
fdr
))),
tar_target
(
cats
,
sf
::
st_transform
(
sf
::
read_sf
(
rpu_gpkg
,
nhd_catchment
),
raster_crs
),
pattern
=
map
(
rpu_gpkg
),
deployment
=
"worker"
),
tar_target
(
cache_split
,
file.path
(
"cache"
,
paste0
(
rpu_codes
,
".rda"
)),
pattern
=
map
(
rpu_codes
)),
tar_target
(
divides
,
reconcile_divides
(
cats
,
refactored_network
,
fdr_fac
,
para_reconcile
,
cache_split
),
pattern
=
map
(
cats
,
refactored_network
,
fdr_fac
,
cache_split
),
deployment
=
"worker"
)
)
\ No newline at end of file
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
workspace/
workflow
_runner.R
→
workspace/
_targets
_runner.R
+
0
−
0
View file @
bfad51db
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment