Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function to build long form box by face table #5

Open
mdsumner opened this issue Jul 19, 2017 · 4 comments
Open

function to build long form box by face table #5

mdsumner opened this issue Jul 19, 2017 · 4 comments

Comments

@mdsumner
Copy link
Member

https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/atlantis-ecosystem-model/j5pVXqY7TKQ

noba_file  <- bgmfiles::bgmfiles("Nordic")


library(rbgm)

## BGM is a doubly-connected-edge-list
## here in 'related tables' form
noba_edge_list <- bgmfile(noba_file)

library(dplyr)
noba_edge_list$boxes %>% dplyr::select(.bx0, botz, area) %>% 
  inner_join(noba_edge_list$facesXboxes, ".bx0") %>% 
  inner_join(noba_edge_list$faces, c("iface" = ".fx0"))
##etc.
@RMORSEcode
Copy link

Hi Mike,

I thought I had it, but then realized the lengths of the files were wrong -
using your approach above results in a length of 506, whereas the file I am trying to recreate is 568 lines long. Using atlantistools, the BGM is read in and converted to long/loat for all of boxN.vert which resulted in 632 lines. Your solution (above) does not appear to include the vertices where the boxN.ibox is a NaN, which in Cecilie's file is 60 lines, so your solution plus those NaNs gets to 566 lines, still 2 lines short. I'm scratching my head as to what they could be... does not seem to be a repeat to connect points as far as I can tell.

cecilie=read.table('file:////GitHub/NoBA/corners_neighbours_nordic.txt', sep='\t', header = T)
sum(is.nan(cecilie$neighbour))

@mdsumner
Copy link
Member Author

Thanks for checking! Work in progress, needs a rethink. I'll have another go soon. If you have thoughts on other conversions feel free to post them as issues too.

@RMORSEcode
Copy link

It looks like the NOBA bgm file that the this long format table was created from may be different from what is in this repository (or there wan an error creating the file). There are 7 faces (rows) listed for box zero in the long format table, but in the 'Nordic' bgmfile there are 8 faces, and one of the 7 in the table lists NaN as a neighbor but it should be box 15.

@mdsumner
Copy link
Member Author

Thanks again, that's helpful detail I will fix! Do you know a master source of the Nordic bgm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants