-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove test_hz_logic; has been deprecated for some time
- Loading branch information
Showing
1 changed file
with
40 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
# | ||
# } |