From adc0d382ea6b22ec33d47e53063edbd2219d0561 Mon Sep 17 00:00:00 2001 From: Eduardo Garces Quintanilla Date: Tue, 19 Jun 2018 20:29:13 -0500 Subject: [PATCH] Fixing problem with depth in plot and results table. --- R/ves.R | 2 +- inst/Shiny/uptsev/server.R | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/R/ves.R b/R/ves.R index e838b73..3538e0d 100644 --- a/R/ves.R +++ b/R/ves.R @@ -246,7 +246,7 @@ plot_ves <- function(x, main = NULL, ...){ spacing <- ves$ab2 max.depth <- max(spacing/2.3) nlayers <- length(rho) - thick[nlayers] <- max.depth - thick[nlayers] + thick[nlayers] <- max.depth - thick[nlayers-1] depth <- 1.0 + cumsum(thick) sp <- pracma::logseq(min(spacing), max(spacing), 2*length(ves$ab2)) res.model <- apparent_resistivities(rho, thick, rves::filt$V1, sp) diff --git a/inst/Shiny/uptsev/server.R b/inst/Shiny/uptsev/server.R index f2f519d..1d73063 100644 --- a/inst/Shiny/uptsev/server.R +++ b/inst/Shiny/uptsev/server.R @@ -735,7 +735,9 @@ shinyServer(function(input, output, session) { ) rho <- current.ves$rhopar thick <- current.ves$thickpar - res.df <- data.frame('Real_Resistivity(Ohm_m)' = rho, 'Thickness(m)' = thick) + depth <- cumsum(current.ves$thickpar) + res.df <- data.frame('Real_Resistivity(Ohm_m)' = rho, 'Thickness(m)' = thick, + 'Depth(m)' = depth) nlay <- length(rho) layers <- vector('character', nlay) for(i in 1:nlay){ @@ -902,9 +904,14 @@ shinyServer(function(input, output, session) { need(current.ves$interpreted, "The VES object is not interpreted") ) rho <- current.ves$rhopar - thick <- current.ves$thickpar - res.df <- data.frame('Real_Resistivity(Ohm_m)' = rho, 'Thickness(m)' = thick) nlay <- length(rho) + thick <- current.ves$thickpar + max.depth <- max(current.ves$ab2)/2.3 + thick[nlay] <- max.depth-thick[nlay-1] + depth <- cumsum(thick) + res.df <- data.frame('Real_Resistivity(Ohm_m)' = rho, + 'Thickness(m)' = thick, + 'Depth(m)' = depth) layers <- vector('character', nlay) for(i in 1:nlay){ layers[i] <- paste0("Layer", as.character(i))