rmf_as_array.stars | R Documentation |
Convert a stars object to rmf_array
## S3 method for class 'stars' rmf_as_array( obj, dis, prj = rmf_get_prj(dis), select = 1, resample = TRUE, method = "bilinear", kper = attr(obj, "kper"), ... )
obj |
|
dis |
|
prj |
|
select |
integer or character specifying which variable from |
resample |
logical specifying if |
method |
character specifying the resampling method when |
kper |
optional integers specifying the stress-periods during which this array is active |
... |
ignored |
If resample = TRUE
, stars::st_warp
is called with the specified method. For possible method
values, see ?stars::st_warp
.
If resample = FALSE
, the array is pulled directly from obj
. The latter will fail when the dimensions and crs of obj
and the MODFLOW grid are
not exactly the same. In that case, the user should consider setting resample = TRUE
.
rmf_as_array
currently can not handle obj
or prj
without defined crs.
This function is intended for use with 2D stars
objects with dimensions X & Y, 3D stars
objects with dimensions
X, Y and dis$nlay
or 4D stars
objects with dimensions X, Y, dis$nlay
and sum(dis$nstp)
.
a rmf_2d_array
, rmf_3d_array
or rmf_4d_array
depending on the number of dimensions in obj
dis <- rmf_create_dis() r <- rmf_create_array(1:prod(dis$nrow, dis$ncol), dim = c(dis$nrow, dis$ncol)) s <- rmf_as_stars(r, dis = dis) rmf_as_array(s, dis = dis, resample = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.