Read geometry and full topology from BGM files.
Value
A list of linked tables: `vertices`, `facesXverts`, `faces`, `facesXboxes`, `boxesXverts`, `boxes` and `boundaryvertices`, which preserve the topology of the file, plus `extra`, which holds the remaining file information (such as the projection).
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
bfile <- bgmfiles::bgmfiles(pattern = "antarctica_28")
bgm <- bgmfile(bfile)
str(bgm)
#> List of 8
#> $ vertices : tibble [112 × 3] (S3: tbl_df/tbl/data.frame)
#> ..$ x : num [1:112] -1991376 -1792396 -1542253 -1439199 -1434743 ...
#> ..$ y : num [1:112] 185436 -171714 -15861 -778493 -244912 ...
#> ..$ .vx0: int [1:112] 1 2 3 4 5 6 7 8 9 10 ...
#> $ facesXverts : tibble [180 × 3] (S3: tbl_df/tbl/data.frame)
#> ..$ .fx0: num [1:180] 0 0 1 1 2 2 3 3 4 4 ...
#> ..$ .p0 : int [1:180] 1 2 1 2 1 2 1 2 1 2 ...
#> ..$ .vx0: int [1:180] 103 98 104 103 104 99 106 104 106 101 ...
#> $ faces : tibble [90 × 7] (S3: tbl_df/tbl/data.frame)
#> ..$ cosine: num [1:90] 0.538 0.394 0.502 0.524 0.969 ...
#> ..$ sine : num [1:90] 0.843 0.919 0.865 0.852 0.246 ...
#> ..$ left : int [1:90] 27 27 12 27 18 27 24 26 19 26 ...
#> ..$ right : int [1:90] 6 12 18 18 24 24 0 19 13 13 ...
#> ..$ length: num [1:90] 165118 33689 174153 157797 120257 ...
#> ..$ .fx0 : num [1:90] 0 1 2 3 4 5 6 7 8 9 ...
#> ..$ label : chr [1:90] "face0" "face1" "face2" "face3" ...
#> $ facesXboxes : tibble [180 × 3] (S3: tbl_df/tbl/data.frame)
#> ..$ .bx0 : num [1:180] 0 0 0 0 0 0 0 0 1 1 ...
#> ..$ iface: num [1:180] 14 29 28 26 25 23 22 6 13 75 ...
#> ..$ ibox : num [1:180] 21 21 22 23 23 24 24 24 26 2 ...
#> $ boxesXverts : tibble [260 × 2] (S3: tbl_df/tbl/data.frame)
#> ..$ .bx0: num [1:260] 0 0 0 0 0 0 0 0 0 0 ...
#> ..$ .vx0: int [1:260] 109 111 50 51 57 60 66 71 83 95 ...
#> $ boxes : tibble [28 × 9] (S3: tbl_df/tbl/data.frame)
#> ..$ label : chr [1:28] "Box0" "Box1" "Box2" "Box3" ...
#> ..$ nconn : int [1:28] 8 6 3 5 4 6 7 7 5 8 ...
#> ..$ botz : num [1:28] -4375 -444 -423 -498 -480 ...
#> ..$ area : num [1:28] 7.92e+11 1.69e+10 4.10e+10 1.65e+11 3.23e+10 ...
#> ..$ vertmix : num [1:28] 0e+00 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 1e-05 ...
#> ..$ horizmix: num [1:28] 0 1 1 1 1 1 1 1 1 1 ...
#> ..$ insideX : num [1:28] 815566 -1128927 -736923 -248554 139842 ...
#> ..$ insideY : num [1:28] 323244 -566142 -571553 -601063 -380035 ...
#> ..$ .bx0 : num [1:28] 0 1 2 3 4 5 6 7 8 9 ...
#> $ boundaryvertices: tibble [54 × 3] (S3: tbl_df/tbl/data.frame)
#> ..$ x : num [1:54] -964559 -896175 -541585 -493582 -468300 ...
#> ..$ y : num [1:54] -636851 -635917 -595871 -601024 -817232 ...
#> ..$ bndvert: int [1:54] 1 2 3 4 5 6 7 8 9 10 ...
#> $ extra :List of 4
#> ..$ maxwcbotz : chr "-4981.0"
#> ..$ nbox : chr "28"
#> ..$ nface : chr "90"
#> ..$ projection: chr "+proj=laea +lat_0=-63 +lon_0=82 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84"