Skip to content

Commit

Permalink
bug correction modify soil definition
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcaceres committed Sep 10, 2024
1 parent 0f1770e commit c60b5c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/add_soilgrids.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ add_soilgrids <- function(x, soilgrids_path = NULL,
orimaxdepth = sum(soildf$widths)
# print(cbind(soildf$widths, oridepths, findepths))
# Modify total soil depth according to bedrock
if(!is.na(depth_to_bedrock)) {
if(!is.na(depth_to_bedrock) && (depth_to_bedrock>0)) {
if(depth_to_bedrock < orimaxdepth) {
to_remove <- (oridepths >= depth_to_bedrock)
soildf <- soildf[!to_remove,,drop = FALSE]
Expand All @@ -198,7 +198,7 @@ add_soilgrids <- function(x, soilgrids_path = NULL,
}
}
# Modify soil depth
if(!is.na(soil_depth)) {
if(!is.na(soil_depth) && (soil_depth > 0)) {
if(full_rock_filling) {
for(l in 1:nl) {
mid_point <- oridepths[l] + soildf$widths[l]/2
Expand Down

0 comments on commit c60b5c4

Please sign in to comment.