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

Reorganise plotting module #133

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Reorganise plotting module #133

wants to merge 6 commits into from

Conversation

cpalfonso
Copy link
Collaborator

There are a few major changes in this pull request:

  • New subduction teeth implementation with more consistent size/spacing parameters (now based entirely on display units, not data units)
    • This implementation should also be able to handle changes to the figure (e.g. updating axes limits) after plotting
  • Refactor gplately.plot by splitting the module up into several files since the single huge file was becoming unwieldy
  • Add a simple test for the new gplately.plot.SubductionTeeth class

@michaelchin
Copy link
Contributor

See the code below. The seg0 and seg1 could be Point in some situation and it will break linemerge([seg0, seg1]). Could you please also look into this?

gplately/gplately/plot.py

Lines 611 to 624 in 9a751e9

if boundary_segment.length > 0.5 * boundary.length:
if d1 > d0:
seg0 = substring(boundary, d0, 0, normalized=True)
seg1 = substring(boundary, 1, d1, normalized=True)
else:
seg0 = substring(boundary, d0, 1, normalized=True)
seg1 = substring(boundary, 0, d1, normalized=True)
if isinstance(seg0, Point) and isinstance(seg1, LineString):
boundary_segment = seg1
elif isinstance(seg1, Point) and isinstance(seg0, LineString):
boundary_segment = seg0
else:
boundary_segment = linemerge([seg0, seg1])

@brmather
Copy link
Collaborator

@cpalfonso - a gentle reminder for you to look into the issue raised by @michaelchin

@michaelchin
Copy link
Contributor

See the code below. The seg0 and seg1 could be Point in some situation and it will break linemerge([seg0, seg1]). Could you please also look into this?

gplately/gplately/plot.py

Lines 611 to 624 in 9a751e9

if boundary_segment.length > 0.5 * boundary.length:
if d1 > d0:
seg0 = substring(boundary, d0, 0, normalized=True)
seg1 = substring(boundary, 1, d1, normalized=True)
else:
seg0 = substring(boundary, d0, 1, normalized=True)
seg1 = substring(boundary, 0, d1, normalized=True)
if isinstance(seg0, Point) and isinstance(seg1, LineString):
boundary_segment = seg1
elif isinstance(seg1, Point) and isinstance(seg0, LineString):
boundary_segment = seg0
else:
boundary_segment = linemerge([seg0, seg1])

This happened to me in https://github.com/GPlates/gplately/blob/master/Notebooks/01-GettingStarted.ipynb in case you would like to reproduce the error.

@brmather
Copy link
Collaborator

@cpalfonso - can you revisit this again, please?

@michaelchin
Copy link
Contributor

@cpalfonso if you would like to finish the subduction teeth improvement, it would be great if you could take care of #188 as well. Sabin reported this issue. You might need to contact him regarding how to reproduce the bug. Thanks.

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.

3 participants