bgmfile: Read BGM

Description Usage Arguments Details See Also Examples

View source: R/bgmfile.R

Description

Read geometry and full topology from BGM files.

Usage

1
2
3

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

1
2
3
4
library(bgmfiles)
bfile <- sample(bgmfiles(), 1L)
bgm <- bgmfile(bfile)
str(bgm)

Example output

Loading required package: raster
Loading required package: sp
List of 8
 $ vertices        : tibble [168 × 3] (S3: tbl_df/tbl/data.frame)
  ..$ x   : num [1:168] -658931 -645483 -642728 -639239 -635826 ...
  ..$ y   : num [1:168] 6255481 6257980 6240329 6132513 6195681 ...
  ..$ .vx0: int [1:168] 1 2 3 4 5 6 7 8 9 10 ...
 $ facesXverts     : tibble [408 × 3] (S3: tbl_df/tbl/data.frame)
  ..$ .fx0: num [1:408] 0 0 1 1 2 2 3 3 4 4 ...
  ..$ .p0 : int [1:408] 1 2 1 2 1 2 1 2 1 2 ...
  ..$ .vx0: int [1:408] 133 123 128 133 128 126 130 128 130 131 ...
 $ faces           : tibble [204 × 7] (S3: tbl_df/tbl/data.frame)
  ..$ cosine: num [1:204] 0.976 0.972 0.886 0.68 -0.681 ...
  ..$ sine  : num [1:204] 0.218 0.233 0.463 0.733 -0.733 ...
  ..$ left  : int [1:204] 2 16 17 16 29 16 16 9 16 28 ...
  ..$ right : int [1:204] 17 17 29 29 9 9 9 28 28 15 ...
  ..$ length: num [1:204] 28027 64602 6009 4461 2606 ...
  ..$ .fx0  : num [1:204] 0 1 2 3 4 5 6 7 8 9 ...
  ..$ label : chr [1:204] "face0" "face1" "face2" "face3" ...
 $ facesXboxes     : tibble [408 × 3] (S3: tbl_df/tbl/data.frame)
  ..$ .bx0 : num [1:408] 0 0 0 0 0 0 0 0 0 1 ...
  ..$ iface: num [1:408] 15 16 55 45 65 76 74 72 14 66 ...
  ..$ ibox : num [1:408] 9 10 11 12 1 5 6 7 8 3 ...
 $ boxesXverts     : tibble [477 × 2] (S3: tbl_df/tbl/data.frame)
  ..$ .bx0: num [1:477] 0 0 0 0 0 0 0 0 0 0 ...
  ..$ .vx0: int [1:477] 125 135 143 149 163 162 122 2 3 38 ...
 $ boxes           : tibble [51 × 9] (S3: tbl_df/tbl/data.frame)
  ..$ label   : chr [1:51] "Box0" "Box1" "Box2" "Box3" ...
  ..$ nconn   : int [1:51] 9 7 9 2 2 4 8 8 6 9 ...
  ..$ botz    : num [1:51] -4500 -3600 -4500 -4500 -4500 -3600 -3600 -3600 -3600 -3600 ...
  ..$ area    : num [1:51] 1.25e+10 2.30e+09 1.21e+10 1.67e+09 1.68e+09 ...
  ..$ vertmix : num [1:51] 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 1e-06 ...
  ..$ horizmix: num [1:51] 1 1 1 1 1 1 1 1 1 1 ...
  ..$ insideX : num [1:51] -284274 -600585 -269425 -642541 88226 ...
  ..$ insideY : num [1:51] 6314779 6238439 6198841 6196126 6359817 ...
  ..$ .bx0    : num [1:51] 0 1 2 3 4 5 6 7 8 9 ...
 $ boundaryvertices: tibble [23 × 3] (S3: tbl_df/tbl/data.frame)
  ..$ x      : num [1:23] -561116 -642728 -635826 -628164 -547787 ...
  ..$ y      : num [1:23] 6257470 6240329 6195681 6146584 6160783 ...
  ..$ bndvert: int [1:23] 1 2 3 4 5 6 7 8 9 10 ...
 $ extra           :List of 4
  ..$ maxwcbotz : chr "-4500.0"
  ..$ nbox      : chr "51"
  ..$ nface     : chr "204"
  ..$ projection: chr "+proj=utm +zone=19 +south +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"

rbgm documentation built on April 14, 2020, 5:13 p.m.