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

Support barrier in spherical and global meshes #168

Open
samroyston opened this issue Nov 1, 2022 · 4 comments
Open

Support barrier in spherical and global meshes #168

samroyston opened this issue Nov 1, 2022 · 4 comments

Comments

@samroyston
Copy link

Related to issues #42 and #166

In inla.mesh.2d, the spherical or global models are (currently) supported by supplying 3D coordinates (inla.mesh.2d(loc = ...)), resulting in a S2 mesh. My understanding is the barrier model currently requires inla.mesh.2d(boundary = ...) to be provided as sp:: Spatial* object type with CRS. Ideally a 2S mesh would be supported to which a boundary can be added.

@finnlindgren
Copy link
Collaborator

finnlindgren commented Nov 1, 2022

Thanks, good point. There are several aspects of the barrier model interface that needs to be updated. But the current code is supposed to handle Spatial* object bundaries with CRS info if the mesh itself also has a CRS (fm_CRS("sphere") I think is the appropriate one, and then fm_spTransform() should be used; recent gdal/proj by itself doesn't want to transform between planets of different radii...). However, there may be special handling inside the barrier code (that I didn't write) that doesn't use the information fully, or a bug elsewhere (in code I did write)
A reprex would be really helpful for this!

@finnlindgren
Copy link
Collaborator

One may need to convert the Spatial* polygon to inla.mesh.segment first, but if the code that uses the information is in the barrier code itself that probably won't help, if it uses it for inside/outside information. I identified that part of the barrier code as being in the need of a conceptual overhaul a while back.

@finnlindgren
Copy link
Collaborator

inlabru now supports spherical meshes and also sf objects, see fm_transform and fm_crs, for example, including for integration. The INLA barrier code still needs fixing.

@finnlindgren
Copy link
Collaborator

The INLAspacetime package, https://github.com/eliaskrainski/INLAspacetime, has a new implementation of the barrier models, but I think it doen't fully support spherical meshes yet. Once we sort out the transition to the new fmesher (https://github.com/inlabru-org/fmesher) package that should become easier to fix.

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

No branches or pull requests

2 participants