Skip to content

Commit

Permalink
FIX: Remove force_path_ccw of contours
Browse files Browse the repository at this point in the history
This was added to fix previously unoriented paths from Matplotlib's
contouring code. This has seemingly been fixed upstream somewhere
in the past and there is no test/reproducer in Cartopy, so we
can remove this for now.
  • Loading branch information
greglucas committed Nov 23, 2023
1 parent b363e43 commit a1d9e49
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions lib/cartopy/mpl/geoaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,7 @@ def transform_path_non_affine(self, src_path):
return mpath.Path(self.transform(src_path.vertices))

transformed_geoms = []
# Check whether this transform has the "force_path_ccw" attribute set.
# This is a cartopy extension to the Transform API to allow finer
# control of Path orientation handling (Path ordering is not important
# in matplotlib, but is in Cartopy).
geoms = cpatch.path_to_geos(src_path,
getattr(self, 'force_path_ccw', False))
geoms = cpatch.path_to_geos(src_path)

for geom in geoms:
proj_geom = self.target_projection.project_geometry(
Expand Down Expand Up @@ -1642,12 +1637,6 @@ def contourf(self, *args, **kwargs):
t = kwargs.get('transform')
if isinstance(t, ccrs.Projection):
kwargs['transform'] = t = t._as_mpl_transform(self)
# Set flag to indicate correcting orientation of paths if not ccw
if isinstance(t, mtransforms.Transform):
for sub_trans, _ in t._iter_break_from_left_to_right():
if isinstance(sub_trans, InterProjectionTransform):
if not hasattr(sub_trans, 'force_path_ccw'):
sub_trans.force_path_ccw = True

result = super().contourf(*args, **kwargs)

Expand Down

0 comments on commit a1d9e49

Please sign in to comment.