GPlates / gplately

GPlately is a Python package to interrogate tectonic plate reconstructions.
https://gplates.github.io/gplately/
GNU General Public License v2.0
55 stars 12 forks source link

Plotting artefacts when crossing the dateline #99

Closed brmather closed 1 year ago

brmather commented 1 year ago

Currently gplately wraps all geometries to the dateline, which divides topologies that cross the dateline into smaller topologies that butt up against the -180/180 degree dateline.

https://github.com/GPlates/gplately/blob/9b832088a86d36b8154172d95f037bcf237f1331/gplately/geometry.py#L168-L308

However, this does not (currently) work for geometries which use the 0/360 degree longitude convention. We need to create an additional wrapping for central_meridian=180, which is implemented in this function:

https://github.com/GPlates/gplately/blob/9b832088a86d36b8154172d95f037bcf237f1331/gplately/geometry.py#L398-L469

I suppose two wrappings (-180/180 and 0/360) should be done by default. I don't think this would add too much additional overhead.

jcannon-gplates commented 1 year ago

Are there cases where a pygplates 3D geometry is converted to a Shapely 2D geometry (using one central meridian, maybe just zero) and then later sometime those Shapely geometries are plotted using a different central meridian?

Just wondering because, for polygons, that could result in vertical lines inside the plot (instead of just at the map's side boundaries).

However in plot.py it looks like shapelify_features is delayed until plotting (ie, when you know the plot's central meridian). So I guess it's not an issue provided the plot's central meridian is passed through to it.

michaelchin commented 1 year ago

However in plot.py it looks like shapelify_features is delayed until plotting (ie, when you know the plot's central meridian). So I guess it's not an issue provided the plot's central meridian is passed through to it.

I guess the problem is the central meridian was not passed through.

https://github.com/GPlates/gplately/blob/9b832088a86d36b8154172d95f037bcf237f1331/gplately/plot.py#L1926

jcannon-gplates commented 1 year ago

And looks like some work is being done to address that on the plot-kw branch (see f39008b).

brmather commented 1 year ago

I see that @cpalfonso made that commit. Is there any update on this?

michaelchin commented 1 year ago

anyone knows what's the status of the plot-kw branch? Is it ready to be merged or still under development?

brmather commented 1 year ago

@cpalfonso - is #104 safe to merge?

cpalfonso commented 1 year ago

Sorry everyone, I've only recently got around to tidying this work up into a couple of commits (#105). As far as I can tell, the changes seem to work well for different central longitudes:

image

I can't spot any issues with orthographic projections, either:

image

brmather commented 1 year ago

Thanks @cpalfonso! I'll mark this as complete.