Convert a raster object to rmf_array

# S3 method for Raster
rmf_as_array(obj, dis, ...)

Arguments

obj

object of class RasterLayer, RasterStack or RasterBrick

dis

RMODFLOW object

...

additional arguments passed to rmf_as_array.stars

Value

a rmf_2d_array or rmf_3d_array depending on the dimensions of obj

Details

obj is first converted to stars using stars::st_as_stars. rmf_as_array.stars is called on the resulting stars object.

Examples

dis <- rmf_create_dis() r <- raster::raster(matrix(1:prod(dis$nrow, dis$ncol), 10, 10), xmx = sum(dis$delr), ymx = sum(dis$delc)) rmf_as_array(r, dis, resample = FALSE)
#> RMODFLOW 2d array with 10 rows and 10 columns, representing the i & j dimensions. #> Not representing stress period data #> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] #> [1,] 10 20 30 40 50 60 70 80 90 100 #> [2,] 9 19 29 39 49 59 69 79 89 99 #> [3,] 8 18 28 38 48 58 68 78 88 98 #> [4,] 7 17 27 37 47 57 67 77 87 97 #> [5,] 6 16 26 36 46 56 66 76 86 96 #> [6,] 5 15 25 35 45 55 65 75 85 95 #> [7,] 4 14 24 34 44 54 64 74 84 94 #> [8,] 3 13 23 33 43 53 63 73 83 93 #> [9,] 2 12 22 32 42 52 62 72 82 92 #> [10,] 1 11 21 31 41 51 61 71 81 91