Add rmt3dms array class to object based on object dimensions

rmt_create_array(
  obj = NA,
  dim = NULL,
  solute = attr(obj, "solute"),
  kper = attr(obj, "kper"),
  dimlabels = attr(obj, "dimlabels")
)

Arguments

obj

object to add class to

dim

the dim attribute for the array to be created; by default, dim(obj) is used

solute

integer vector specifying the solute species this array represents. Defaults to NULL

kper

integer vector specifying the stress periods in which the array is active. Used for defining boundary conditions. Defaults to NULL

dimlabels

character vector specifying the labels of the dimensions; defaults to i, j, k, l for the first, second, third and fourth dimension, respectively.

Value

either a rmt_2d_array, a rmt_3d_array or rmt_4d_array object

Details

subsetting a rmt_array will return a rmt_array as long as the object has a dim argument (i.e. has 2 or more free dimensions). Atomic vectors are therefore never rmt_arrays. When l is not specified when subsetting a rmt_4d_array, a rmt_4d_array will always be returned. Furthermore, unlike subsetting arrays, dimensions with length 1 will not be dropped unless the drop argument is set to TRUE