Read geometry and full topology from BGM files.

bgmfile(x, ...)

read_bgm(x, ...)

Arguments

x

path to a bgm file

...

ignored for now

Details

BGM is a file format used for the 'Box Geometry Model' in the Atlantis Ecosystem Model. This function reads everything from the .bgm file and returns it as linked tables.

See also

See helper functions to convert the bgm tables to `Spatial` objects, boxSpatial, faceSpatial, nodeSpatial, boundarySpatial, pointSpatial

Examples

library(bgmfiles) bfile <- sample(bgmfiles(), 1L) bgm <- bgmfile(bfile) str(bgm)
#> List of 8 #> $ vertices : tibble [65 × 3] (S3: tbl_df/tbl/data.frame) #> ..$ x : num [1:65] 3998613 4005592 4065533 4076346 4095091 ... #> ..$ y : num [1:65] 1174049 1198429 1102640 1180625 1128446 ... #> ..$ .vx0: int [1:65] 1 2 3 4 5 6 7 8 9 10 ... #> $ facesXverts : tibble [44 × 3] (S3: tbl_df/tbl/data.frame) #> ..$ .fx0: num [1:44] 0 0 1 1 2 2 3 3 4 4 ... #> ..$ .p0 : int [1:44] 1 2 1 2 1 2 1 2 1 2 ... #> ..$ .vx0: int [1:44] 2 6 57 50 57 56 56 54 54 55 ... #> $ faces : tibble [22 × 7] (S3: tbl_df/tbl/data.frame) #> ..$ cosine: num [1:22] -0.789 0.999 0.387 0.145 -0.762 ... #> ..$ sine : num [1:22] 0.615 0.0345 0.9223 0.9894 0.6471 ... #> ..$ left : int [1:22] 1 3 3 3 3 7 4 3 2 3 ... #> ..$ right : int [1:22] 0 6 4 4 4 4 3 5 3 2 ... #> ..$ length: num [1:22] 113698 51183 22794 50806 7626 ... #> ..$ .fx0 : num [1:22] 0 1 2 3 4 5 6 7 8 9 ... #> ..$ label : chr [1:22] "face0" "face1" "face2" "face3" ... #> $ facesXboxes : tibble [43 × 3] (S3: tbl_df/tbl/data.frame) #> ..$ .bx0 : num [1:43] 0 1 1 1 1 1 2 2 2 2 ... #> ..$ iface: num [1:43] 0 1 10 11 13 17 8 9 10 11 ... #> ..$ ibox : num [1:43] 0 0 2 2 2 2 3 3 1 1 ... #> $ boxesXverts : tibble [114 × 2] (S3: tbl_df/tbl/data.frame) #> ..$ .bx0: num [1:114] 0 0 0 0 0 0 1 1 1 1 ... #> ..$ .vx0: int [1:114] 2 1 3 5 6 2 23 18 19 17 ... #> $ boxes : tibble [11 × 9] (S3: tbl_df/tbl/data.frame) #> ..$ label : chr [1:11] "Box0" "Box1" "Box2" "Box3" ... #> ..$ nconn : int [1:11] 1 5 9 8 7 7 1 1 1 1 ... #> ..$ botz : int [1:11] -370 -110 -466 -444 -4255 -3405 -511 -4531 -4650 -4551 ... #> ..$ area : num [1:11] 3.26e+09 7.92e+09 6.67e+09 6.87e+09 7.57e+10 ... #> ..$ vertmix : num [1:11] 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 ... #> ..$ horizmix: int [1:11] 1 1 1 1 1 1 1 1 1 1 ... #> ..$ insideX : num [1:11] 4043668 4100100 4191669 4240609 4445261 ... #> ..$ insideY : num [1:11] 1150676 1176682 1228857 1380660 1315656 ... #> ..$ .bx0 : num [1:11] 0 1 2 3 4 5 6 7 8 9 ... #> $ boundaryvertices: tibble [46 × 3] (S3: tbl_df/tbl/data.frame) #> ..$ x : num [1:46] 4227984 4279136 4684173 4491403 4338741 ... #> ..$ y : num [1:46] 1449271 1451038 1362498 1129921 857210 ... #> ..$ bndvert: int [1:46] 1 2 3 4 5 6 7 8 9 10 ... #> $ extra :List of 4 #> ..$ maxwcbotz : chr "-5000" #> ..$ nbox : chr "11" #> ..$ nface : chr "22" #> ..$ projection: chr "+proj=aea +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=134 +x_0=3000000 +y_0=6000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0"| __truncated__