Convert a stars object to rmf_list

# S3 method for stars
rmf_as_list(
  obj,
  dis,
  select = names(obj),
  k = NULL,
  prj = rmf_get_prj(dis),
  kper = attr(obj, "kper"),
  op = sf::st_intersects,
  ...
)

Arguments

obj

stars object

dis

RMODFLOW list object

select

integer or character vector denoting the variables to select from obj. Defaults to all variables.

k

optional integer specifying the layer index for each feature. If not present, all features are assumed to be in layer 1.

prj

RMODFLOW prj object

kper

optional integers specifying the stress-periods during which this rmf_list is active

op

geometric operator to use in the spatial join. Defaults to sf::st_intersects. See details.

...

additional arguments passed to rmf_as_list.sf

Value

a rmf_list object

Details

obj is converted to sf using sf::st_as_sf. rmf_as_list is then called on the resulting sf object. This function is intended for stars objects with geometry dimensions (e.g. sf objects).

Examples

sfc <- sf::st_sfc(list(sf::st_point(c(100,200)), sf::st_point(c(750, 800)), sf::st_point(c(700, 850)))) obj <- sf::st_sf(q = c(-500, -400, -300), m = 2, geom = sfc) s <- stars::st_as_stars(obj) dis <- rmf_create_dis() rmf_as_list(s, dis)
#> RMODFLOW list with 8 features and 2 variables #> Not representing stress period data #> i j k q m #> 1 9 1 1 -500 2 #> 2 9 2 1 -500 2 #> 3 8 1 1 -500 2 #> 4 8 2 1 -500 2 #> 5 3 8 1 -400 2 #> 6 2 8 1 -400 2 #> 7 2 7 1 -300 2 #> 8 2 8 1 -300 2