ksConc: Weighted Kernel Density Estimate of Concentration

Description Usage Arguments Value Examples

Description

A post-processing tool for DRW. This function gives a distributed concentration estimate for a DRW result, using a weighted kernel density estimate from the particles, using kde.

Usage

1
2
3
ksConc(DRWmodel, mfdata, wtop, dkcell, ts = NULL, L = NULL, smd, H,
  binned = NA, Kxlim = c("auto", "mf")[1L], Kylim = NULL, ...,
  ptype = "plume")

Arguments

DRWmodel

DRWmodel S4 object or a character string giving the file path to one

mfdata, wtop

open NetCDF, character string file path(s) or list of open NetCDFs; MODFLOW data set(s) and saruated water tops

dkcell

numeric [1] or [2]; cell spacing for the kernel smooth in x and y directions

ts, L

NULL or integer[]; time steps/ layers to process (NULL implies all)

smd

numeric [1]; smoothing distance for kernel smooth: too small and the result will be patchy, too large and the result will be too spread

H

matrix [2, 2]; alternative, lower level way of specifying smoothing (see kde)

binned

logical [1]; see kde; NA uses binning for particle sets numbering more than 500 and not otherwise

Kxlim

"auto", "mf", numeric [2] or something that, with Kylim, can be read by xy.coords; Kxlim and Kylim give the x and y limits for the region in which to determine the concentration; "auto" uses the particle distribution and "mf" uses the MODFLOW model edges

Kylim

NULL or numeric [2]

...

additional arguments for kde

ptype

"plume" (the default) or "sorbed"

Value

List object of class kDRW with elements:
$conc numeric [x, y, L, ts]; concentration estimate
$coords list:
..$x,y numeric []; x and y grid divide co-ordinates (note not the cell centres)
..$L,ts integer []; layers and time steps that are present
$H numeric [2, 2]; the H matrix used for smoothing (see kde)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
setwd(mfdir <- system.file(package = "DRW"))
drmod <- readRDS("DRW_EXAMPLE.rds")

kdr <- ksConc(drmod, "drw_mf_demo.nc", "drw_mf_demo_wtop.nc", 10,
              smd = 20, Kxlim = "mf")

# Note here that the result is indexed using strings for the 3rd and 4th
#  dimensions.  This is much less likely to cause confusion because the
#  layers and time steps included are likely not to be a simple sequence
#  starting from 1.
with(kdr, image(z = conc[,, "L1", "ts10"], coords$x, coords$y,
                col = grDevices::rainbow(51L)))

CJBarry/DRW documentation built on May 6, 2019, 9:25 a.m.