Repository navigation
Conversation
63fc941 to
114ceee
Compare
114ceee to
a7bed21
Compare
|
I thought that we had something in the code that said we take the shorter path around. If we have a line defined as going from (-170, 0) to (170, 0) how do I know I want that line going through (0, 0) instead of through (+/-180, 0). So in this case, this would be a single point on the line. |
|
Given import cartopy.crs as ccrs
import matplotlib.pyplot as plt
import shapely
tgt_proj = ccrs.NorthPolarStereo(central_longitude=180)
src_proj = ccrs.PlateCarree(central_longitude=180)
start = [-170, 0]
end = [170, 0]
line_string = shapely.LineString([start, end])
fig, ax = plt.subplots(subplot_kw={'projection':tgt_proj})
ax.add_geometries(line_string, src_proj, facecolor='none', edgecolor='blue')
plt.show() |
|
I'm still a bit confused for when we decide to use "wrappable" coordinates versus not in various functions (like quadmesh and other draws). Changing your example to: |
|
I fell down a rabbit-hole looking at the history of the Iris code involved in #2747. I found this explanation, which is basically what you just said #368 (comment). |
|
Are we not still taking the shortest path? |

Rationale
Fixes #2745
When we project a line segment to a different CRS, we use the bisect function to add extra points between the input ones, in order to produce a suitable curve if necessary.
bisectuses straightAndDomain to decide whether the straight line between the given two points it is looking at are close enough to the actual curve. If they are it says "I'm done", if not it continues to add more points.Currently, if the projected points are the same then along will be nan and so
straightAndDomainreturnsTrueandbisectsays "I'm done". So we end up with just the two points on top of each other. This PR adds an extra check so thatbisectcontinues if the projected points are the same and the projection of their midpoint is different, as is the case when the line is wrapped around the equator.I'm not sure about the exact form of the check: is there any way that
alongwill benanwithoutseg_hypot_sqbeing zero?Implications