Render GPlates coastlines as filled spherical surfaces#33
Merged
Conversation
Refactors CoastlineVTKFile so each reconstructed coastline becomes a proper triangulated surface on the sphere instead of a flat polygon cell. Each sub-polygon from DateLineWrapper is now triangulated independently in (lon, lat) with mapbox_earcut, adaptively refined on the sphere so long ear triangles break into uniform patches, and has its normals flipped outward regardless of source winding. Output is per-age .vtp files collected in a .pvd for ParaView time series. Adds examples/coastlines_vtp/ with a jupytext demo, regression tests, and expected.pkl. Test data (Muller et al. 2019 rotations + coastlines) is hosted on the gadopt DO Spaces CDN and auto-downloads into gdrift/data-gplates/ on first test run; the demo uses the same resolver so it works on a fresh clone without env setup. Adds a gplates extras group (pyvista, mapbox_earcut) to pyproject.toml. pygplates stays out since it is distributed by the GPlates team rather than via PyPI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Reworks
CoastlineVTKFileso GPlates coastlines render as proper triangulated surfaces on the sphere. The previous pipeline wrote each coastline as a single polygon cell, which VTK fan-triangulated in a best-fit plane — producing crumpled continents with empty interiors and spurious triangles bridging date-line-split pieces.The new pipeline:
DateLineWrapperand triangulates each sub-polygon independently, so continents no longer bridge across disjoint pieces.(lon, lat)withmapbox_earcutrather than in VTK's best-fit plane — no more fan wedges for concave or large continents.subdivide_adaptive, re-projecting new vertices onto the sphere after each pass, so long thin earcut ears become uniform patches that hug a great-circle arc.Demo and tests
Adds
examples/coastlines_vtp/with a jupytext demo, four regression tests, and a baselineexpected.pkl. The test data (Muller et al. 2019 rotations + coastlines, ~4 MB) is hosted on the gadopt DO Spaces CDN atg-drift/test_data/coastlines_vtp/and auto-downloads intogdrift/data-gplates/on first test run. The demo uses the same three-step resolver (env var → localgtrack/copy → CDN) so it works on a fresh clone without any setup.Packaging
Adds a
gplatesextras group (pyvista,mapbox_earcut) topyproject.toml.pygplatesis noted in a comment rather than listed, since it is distributed by the GPlates team rather than via PyPI.Known limitation
Polygons that enclose a geographic pole (notably Antarctica) are not rendered correctly: earcut in
(lon, lat)does not close the ring across the pole, so Antarctica appears as a strip with a polar hole. Documented in the module docstring; fixing it would require injecting the pole as an extra vertex or meshing in a polar projection and is out of scope.Test plan
make lintclean on changed filespytest examples/coastlines_vtp/test_demo.py— 4/4 pass locally against auto-downloaded CDN data.pvd+ 6.vtpfiles that render correctly in ParaView