rmf_as_stars | R Documentation |
Functions to convert rmf_array and rmf_list objects to stars objects
rmf_as_stars(...) ## S3 method for class 'rmf_2d_array' rmf_as_stars( array, dis, mask = array * 0 + 1, prj = rmf_get_prj(dis), name = "value", id = "r", ... ) ## S3 method for class 'rmf_3d_array' rmf_as_stars( array, dis, mask = array * 0 + 1, prj = rmf_get_prj(dis), name = "value", id = "r", ... ) ## S3 method for class 'rmf_4d_array' rmf_as_stars( array, dis, mask = array(1, dim = dim(array)[1:3]), prj = rmf_get_prj(dis), name = "value", id = "r", ... ) ## S3 method for class 'rmf_list' rmf_as_stars( obj, dis, select, prj = rmf_get_prj(dis), name = "value", id = "r", ... )
... |
additional arguments passed to |
array |
|
dis |
|
mask |
a 2d array when |
prj |
|
name |
character specifying the name of the resulting variable in the stars object. Defaults to |
id |
either |
obj |
|
select |
integer or character specifying which column of the |
The crs is taken from the prj
argument.
Note that in MODFLOW, row indices (i) increase with decreasing Y coordinates, i.e. row 1 - column 1 corresponds to the upperleft cell.
a stars
object with x and y dimensions when array
is 2d, x, y and layer (integer representing MODFLOW layer; similar to bands) when array
is 3d,
x, y, layer and time dimensions when array
is 4d. When converting a rmf_list
object, it is first converted to a rmf_array
using rmf_as_array
.
Two variables are present in the returned stars
object, one with the array values and on with the cell id (when id
is 'r'
or 'modflow'
).
dis <- rmf_create_dis() # 2d array r <- rmf_create_array(1:prod(dis$nrow, dis$ncol), dim = c(dis$nrow, dis$ncol)) rmf_as_stars(r, dis = dis) # 3d array r <- rmf_create_array(1:prod(dis$nrow, dis$ncol, dis$nlay), dim = c(dis$nrow, dis$ncol, dis$nlay)) rmf_as_stars(r, dis = dis, id = 'modflow') # 4d array r <- rmf_create_array(1:prod(dis$nrow, dis$ncol, dis$nlay, 2), dim = c(dis$nrow, dis$ncol, dis$nlay, 2)) rmf_as_stars(r, dis = dis, id = FALSE) # rmf_list l <- rmf_create_list(data.frame(i = 1, j = 1:2, k = c(3, 2), q = c(-500, -400), d = 35)) rmf_as_stars(l, dis = dis, select = 'q')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.