Skip to content
Snippets Groups Projects
Select Git revision
  • f587c5e47c7cf11b692b6826c4915758e0e11783
  • main default protected
  • enhancement/envi_output_format
  • bugfix/fix_geolayer_computation
  • feature/add_vnir_swir_coreg
  • feature/add_netcdf_output_format
  • dev
  • v1.0.5
  • v1.0.4
  • v1.0.3
  • v1.0.2
  • v1.0.1
  • v1.0.0
  • v0.21.1
  • v0.21.0
  • v0.20.2
  • v0.20.1
  • v0.20.0
  • v0.19.7
  • v0.19.6
  • v0.19.5
  • v0.19.4
  • v0.19.3
  • v0.19.2
  • v0.19.1
  • v0.19.0
  • v0.18.15
27 results

options_schema.py

Blame
  • Rphree_Viz.R 3.28 KiB
    ### RedModRphree, functions to perform basic visualization
    ### Licence: LGPL version 2.1
    ### Time-stamp: "Last modified 2018-05-06 19:30:10 delucia"
    
    ##' @title Display the profiles of some variables along a 1D reactive
    ##'     transport simulation
    ##' @param sim The simulation to display
    ##' @param sample optional, time frame position to be desplayed. If
    ##'     omitted, the last is showed
    ##' @param vars optional, character vector containing the names of
    ##'     variables to display (up to 7)
    ##' @param ... further parameters passed to \code{matplot}, such as
    ##'     main, xlab, ylab...
    ##' @return NULL
    ##' @author MDL
    ##' @export
    MatplotSingle <- function(sim, sample=1L, vars=c("Ca","Mg","Calcite","Dolomite"), ...) {
        if(missing(sample))
            sample <- length(sim)
        if (length(vars)>7)
            stopmsg("Please specify up to seven variables")
        
        cols <- c("red", "black","blue","olivedrab3", "orange", "light blue", "grey")[1:length(vars)]
        
        frame <- sim[[sample]]$C
        matplot(frame[,vars], type="l", lwd=2, lty="solid", col=cols, ...)
        legend("topright", vars, text.col=cols, bty="n")
    }
    
    
    
    ##' @title Display the profiles of some variables for 2 reactive
    ##'     transport simulation (one using surrogates)
    ##' @param sur The simulation with surrogate
    ##' @param sim The simulation using only phreeqc
    ##' @param sample optional, time frame position to be desplayed. If
    ##'     omitted, the last is showed
    ##' @param vars optional, character vector containing the names of
    ##'     variables to display (up to 7)
    ##' @param ... further parameters passed to \code{matplot}, such as
    ##'     main, xlab, ylab...
    ##' @return NULL
    ##' @author MDL
    ##' @export
    Matplot <- function(sur, sim, sample=1L, vars=c("Ca","Mg","Calcite","Dolomite"), ...) {
        if(missing(sample))
            sample <- length(sim)
        if (length(vars)>7)
            stopmsg("Please specify up to seven variables")
        
        cols <- c("red", "black","blue","olivedrab3", "orange", "light blue", "grey")[1:length(vars)]
        
        rs <- sur[[sample]]$C
        rn <- sim[[sample]]$C
        matplot(rn[,vars], type="l", lwd=2, lty="solid", col=cols, ...)
        matplot(rs[,vars], type="l", lwd=2, lty="dashed",col=cols, add=TRUE)
        legend("topright", vars, text.col=cols, bty="n")
    }
    
    ##' @title Scatter plots of phreeqc simulations vs surrogate response
    ##' @param mod list of regression models, one per variable
    ##' @param res the matrix or data.frame of the results
    ##' @param des the matrix or data.frame of the design (upon which the surrogates are called)
    ##' @param sample optional, indeces of the rows to include in the plot
    ##' @param column logical, if TRUE there are 2 columns, if FALSE 2 rows of the plot
    ##' @param ... further parameters passed internally to \code{plot}
    ##' @return NULL
    ##' @author MDL
    ##' @export
    PlotModsInSample <- function(mod, res, des, sample=seq(1,nrow(res)), column=TRUE, ...) {
        nres <- ncol(res)
        ## how many rows in the mfrow plot?
        nr <- floor(nres/2)+nres%%2
        design <- des[sample,]
        result <- res[sample,]
        
        if (column)
            par(mfrow=c(nr,2))
        else
            par(mfrow=c(2,nr))
        for (i in seq_along(mod)) {
            plot(result[,i], predict(mod[[i]], design),"p",pch=3, main=names(mod)[i],
                 xlab="Full physics", ylab="Surrogate", ...)
            abline(0,1,lty="dashed",col="grey")
        }
    }