Skip to content

Commit

Permalink
remove test_hz_logic; has been deprecated for some time
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jan 20, 2021
1 parent eebbbc6 commit 678d4ba
Showing 1 changed file with 40 additions and 42 deletions.
82 changes: 40 additions & 42 deletions R/test_hz_logic.R
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
## https://github.com/ncss-tech/aqp/issues/65

# depricated
test_hz_logic <- function(i, topcol, bottomcol, strict=FALSE) {

## not using this function any longer, will remove by aqp 2.0
.Deprecated('checkHzDepthLogic')


# test for NA
if(any(c(is.na(i[[topcol]])), is.na(i[[bottomcol]]))) {
res <- FALSE
names(res) <- 'hz_logic_pass'
return(res)
}

# test for overlapping OR non-contiguous horizon boundaries
if(strict) {
n <- nrow(i)
res <- all.equal(i[[topcol]][-1], i[[bottomcol]][-n])
if(res != TRUE)
res <- FALSE
names(res) <- 'hz_logic_pass'
return(res)
}



# test for overlapping horizons
# note: this will fail if an O horizon is described using the old style O 3--0cm
m <- cbind(i[[topcol]], i[[bottomcol]])
unzipped.depths <- unlist(apply(m, 1, function(i) seq(from=i[1], to=i[2], by=1)))
len.overlapping <- length(which(table(unzipped.depths) > 1))
n.hz <- nrow(i)

# there should be 1 fewer segments of overlap than there are horizons
if(len.overlapping > (n.hz - 1))
res <- FALSE
else
res <- TRUE
names(res) <- 'hz_logic_pass'
return(res)

}
# DEPRECATED: 2021/01/20
#
# test_hz_logic <- function(i, topcol, bottomcol, strict=FALSE) {
#
# ## not using this function any longer, will remove by aqp 2.0
# .Deprecated('checkHzDepthLogic')
#
#
# # test for NA
# if(any(c(is.na(i[[topcol]])), is.na(i[[bottomcol]]))) {
# res <- FALSE
# names(res) <- 'hz_logic_pass'
# return(res)
# }
#
# # test for overlapping OR non-contiguous horizon boundaries
# if(strict) {
# n <- nrow(i)
# res <- all.equal(i[[topcol]][-1], i[[bottomcol]][-n])
# if(res != TRUE)
# res <- FALSE
# names(res) <- 'hz_logic_pass'
# return(res)
# }
# # test for overlapping horizons
# # note: this will fail if an O horizon is described using the old style O 3--0cm
# m <- cbind(i[[topcol]], i[[bottomcol]])
# unzipped.depths <- unlist(apply(m, 1, function(i) seq(from=i[1], to=i[2], by=1)))
# len.overlapping <- length(which(table(unzipped.depths) > 1))
# n.hz <- nrow(i)
#
# # there should be 1 fewer segments of overlap than there are horizons
# if(len.overlapping > (n.hz - 1))
# res <- FALSE
# else
# res <- TRUE
# names(res) <- 'hz_logic_pass'
# return(res)
#
# }

0 comments on commit 678d4ba

Please sign in to comment.