Skip to content

Commit

Permalink
get_SDA_hydric: fix dominant condition
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Oct 5, 2024
1 parent 9b062d4 commit bd675ee
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions R/get_SDA_hydric.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ get_SDA_hydric <- function(areasymbols = NULL,
}

if (method == "DOMINANT CONDITION") {
hyd_selection <- sprintf("AND hydricrating = (%s)", .LIMIT_N(sprintf("SELECT hydricrating FROM mapunit AS mu
GROUP BY hydricrating, comppct_r
ORDER BY SUM(comppct_r) OVER (PARTITION BY hydricrating) DESC",
ifelse(miscellaneous_areas, "", " AND NOT c.compkind = 'Miscellaneous area'"),
ifelse(include_minors, "", " AND c.majcompflag = 'Yes'")),
n = 1, sqlite = !is.null(dsn)))
hyd_selection <- sprintf("AND hydricrating = (%s)",
.LIMIT_N(sprintf("SELECT hydricrating FROM mapunit AS mu
INNER JOIN component ON component.mukey = mapunit.mukey %s %s
GROUP BY hydricrating, comppct_r
ORDER BY SUM(comppct_r) OVER (PARTITION BY hydricrating) DESC",
ifelse(miscellaneous_areas, "", " AND NOT component.compkind = 'Miscellaneous area'"),
ifelse(include_minors, "", " AND component.majcompflag = 'Yes'")),
n = 1, sqlite = !is.null(dsn)))
}

q <- sprintf(paste0("SELECT areasymbol, musym, muname, mapunit.mukey, ",
Expand Down

0 comments on commit bd675ee

Please sign in to comment.