Skip to content

Commit

Permalink
Merge pull request #36 from dblodgett-usgs/main
Browse files Browse the repository at this point in the history
issue with cluster unpacking in output
  • Loading branch information
dblodgett-usgs authored Apr 2, 2024
2 parents 72c1594 + 412576f commit a9be0ab
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions R/write_out.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
write_reference <- function(gage_hydrologic_locations, registry, providers, reference_file, nldi_file,
duplicate_locations) {

dup <- select(sf::st_drop_geometry(duplicate_locations), id, cluster_id) |>
filter(lengths(duplicate_locations$cluster_id) > 0) |>
mutate(uri = paste0("https://geoconnex.us/ref/gages/", id),
cluster = paste(paste0("https://geoconnex.us/ref/gages/", cluster_id), collapse = ",")) |>
select(uri, cluster) |>
duplicate_locations$cluster_string <- unlist(lapply(duplicate_locations$cluster_id, \(x) {
if(is.null(x)) return("")
paste(paste0("https://geoconnex.us/ref/gages/", x), collapse = ",")
}))

dup <- select(sf::st_drop_geometry(duplicate_locations), id, cluster_string) |>
filter(cluster_string != "") |>
mutate(uri = paste0("https://geoconnex.us/ref/gages/", id)) |>
select(uri, cluster = cluster_string) |>
distinct()

out <- gage_hydrologic_locations %>%
Expand Down

0 comments on commit a9be0ab

Please sign in to comment.