Skip to content

Improve seed point reconstruction in seafloor gridding#413

Draft
jcannon-gplates wants to merge 17 commits into
masterfrom
improve-seed-point-reconstruction
Draft

Improve seed point reconstruction in seafloor gridding#413
jcannon-gplates wants to merge 17 commits into
masterfrom
improve-seed-point-reconstruction

Conversation

@jcannon-gplates

Copy link
Copy Markdown
Contributor

Improve seed point reconstruction in seafloor gridding

This new algorithm naturally deactivates seed points at convergent plate boundaries
without having to compare velocity deltas and distances to boundaries
with empirical thresholds (like the subduction collision parameters).

This comment was written with Claude's help. However, the code is all-human (that'll soon change though).

Summary

  • Rewrite collision detection for seafloor seed points — the previous approach
    deactivated a seed point when it transitioned between plates and the velocity delta
    exceeded a threshold (and the point was close enough to the boundary). The new approach
    takes the resolved plate containing a seed point at the current time, resolves that same
    plate at the next time step, and deactivates the point if its reconstructed position falls
    outside the next-time boundary. Any converging boundary will naturally consume seed points
    without requiring velocity thresholds, distance thresholds, or subduction-zone labels.
    This removes the _DefaultCollision, _ContinentCollision, _ReconstructByTopologiesImpl,
    and _ReconstructByTopologicalModelImpl classes entirely.

  • Prefer resolved deforming networks over rigid plates when both cover a point — the
    topology lookup is now split into two passes (networks then boundaries) using a shared
    spatial tree, with the network result taking precedence. This correctly handles deforming
    networks that overlay rigid plates.

  • Accept PlateReconstruction instead of raw rotation model + topology features
    ReconstructByTopologies.__init__ and reconstruct_points_by_topologies() now take a
    single plate_reconstruction argument. Topological snapshots are obtained from
    PlateReconstruction.topological_snapshot(), which caches resolved topologies and avoids
    redundant resolving across concurrent workers.

  • Deprecate subduction_collision_parameters in SeafloorGrid — the parameter is no
    longer used (collision detection no longer depends on velocity thresholds). Passing it now
    emits a DeprecationWarning; the parameter is removed from __init__ and the class
    docstring is updated to remove references to the old velocity-delta mechanism.

What happens when a topology at the current time cannot be resolved at the next time

This results in inconsistent next-time topology boundaries, which are handled by cloning and extending their sub-segment valid times.

To deactivate seed points at converging boundaries, the code resolves the same plate topology at the next time step and checks whether each seed point's reconstructed position still falls inside it. This requires that all boundary sub-segment features are valid at the next time, but a topology's valid time period often does not include the next time (e.g., at the last time step before a topology disappears). _NextTopologicalFeatures handles this by cloning any boundary section feature (and any topological-line sub-section feature) whose valid time does not include the next time, extending the clone's valid time to cover it (distant past → 0 Ma), and using the clone when resolving at the next time. If the resulting next topology is still inconsistent with the current one — detected by comparing boundary sub-segment counts and checking for unexpected multiple intersections between neighbouring sections, which can distort the resolved boundary shape — _NextTopologicalBoundary falls back to reconstructing the inconsistent sub-segments directly: each current sub-segment geometry is reverse-reconstructed to present day, its valid time is extended to cover the next time if needed, and it is then reconstructed forward to the next time, with the resulting geometries stitched into a replacement boundary polygon.

jcannon-gplates and others added 17 commits June 25, 2026 16:44
This naturally deactivates seed points at convergent plate boundaries
without having to compare velocity deltas and distances to boundaries
with empirical thresholds.
Topological lines can be sections of topological boundaries/networks.
New collision detection was recently added in 521b6fe.
Resolving the same current topological boundary/network to the next
time might generate different number of intersections between boundary
sections. We now detect this so we can generate a topology boundary
polygon using a different approach when this happens.
Instead of returning the boundary of the next resolved topology, return
the boundary sub-segments of the current resolved topology moved to the
next time and joined together.
The consistent sub-segments (resolved at 'next' time) can be kept.
And we can now sample all points together, rather than one by one.
And remove implementation based on TopologicalModel since it's no longer
needed (since we now use a different collision detection algorithm and
also the new implementation can reconstruct points that are in deforming
networks, which the original implementation could not).
And no longer return all the points (active and inactive). Now returns
only the active points and their indices into the original points.
More chance of reusing cached resolved topologies.
So that subsequent diffs don't show the whole file as changed.
Also merge separate seafloor age and spreading rate plots into a
single function.
@jcannon-gplates jcannon-gplates added this to the release 2.1 milestone Jun 25, 2026
@jcannon-gplates jcannon-gplates self-assigned this Jun 25, 2026
@jcannon-gplates

Copy link
Copy Markdown
Contributor Author

Because this PR relies on functionality that will be in the next pyGPlates release (1.1), I won't merge it until that's available on conda (because the conda version of pyGPlates is used for testing GPlately).

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

Successfully merging this pull request may close these issues.

1 participant