Skip to content

Commit

Permalink
fix up nldi output
Browse files Browse the repository at this point in the history
  • Loading branch information
dblodgett-usgs committed Apr 23, 2024
1 parent e0df9c0 commit f9c28e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/write_out.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ write_reference <- function(dam_locations, registry, providers, reference_file,
if(is.na(x)) NA_character_ else paste0("https://geoconnex.us/nhdplusv2/comid/", x)
}, FUN.VALUE = c(""))

if(all(!grepl("https", dam_locations$nhdpv2_REACHCODE))) {
dam_locations$nhdpv2_REACHCODE <-
if(all(is.na(dam_locations$nhdpv2_REACHCODE) | !grepl("https", dam_locations$nhdpv2_REACHCODE))) {
dam_locations$nhdpv2_REACHCODE_uri <-
vapply(dam_locations$nhdpv2_REACHCODE, \(x) {
if(is.na(x)) NA_character_ else paste0("https://geoconnex.us/nhdplusv2/reachcode/", x)
}, FUN.VALUE = c(""))
Expand All @@ -18,7 +18,7 @@ write_reference <- function(dam_locations, registry, providers, reference_file,
uri, identifier, id), by = "identifier") %>%
select(id, uri, name, description, subjectOf,
provider, provider_id,
nhdpv2_COMID, nhdpv2_REACHCODE, nhdpv2_REACH_measure,
nhdpv2_COMID, nhdpv2_REACHCODE_uri, nhdpv2_REACHCODE, nhdpv2_REACH_measure,
drainage_area_sqkm, drainage_area_sqkm_nhdpv2, index_type,
mainstem_uri, feature_data_source) %>%
mutate(id = as.integer(id))
Expand Down

0 comments on commit f9c28e3

Please sign in to comment.