Skip to content

Commit

Permalink
Merge pull request #385 from DOI-USGS/380
Browse files Browse the repository at this point in the history
support Permanent_Identifier and case insensitive collumn culling
  • Loading branch information
dblodgett-usgs authored May 10, 2024
2 parents b0cd256 + 2f674fa commit a69653a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions R/A_nhdplusTools.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ nhdplusTools_env <- new.env()
# NHDPlus Attributes
COMID <- "COMID"
FEATUREID <- "FEATUREID"
Permanent_Identifier <- "Permanent_Identifier"
Hydroseq <- "Hydroseq"
UpHydroseq <- "UpHydroseq"
DnHydroseq <- "DnHydroseq"
Expand Down Expand Up @@ -50,6 +51,7 @@ WBAREACOMI <- "WBAREACOMI"
# List of input names that should be changed to replacement names
nhdplus_attributes <- list(
COMID = COMID, NHDPlusID = COMID,
Permanent_Identifier = Permanent_Identifier,
RPUID = RPUID,
VPUID = VPUID,
FEATUREID = FEATUREID,
Expand Down
2 changes: 1 addition & 1 deletion R/get_nhdplushr.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ cull_cols <- function(x, keep_cols) {

if(is.null(keep_cols)) return(x)

keep_cols <- keep_cols[keep_cols %in% names(x)]
keep_cols <- names(x)[sapply(names(x), \(x) any(grepl(x, keep_cols, ignore.case = TRUE)))]

geom_name <- attr(x, "sf_column")
if(!geom_name %in% keep_cols) keep_cols <- c(keep_cols, geom_name)
Expand Down

0 comments on commit a69653a

Please sign in to comment.