Skip to content

Commit 17ae40b

Browse files
authored
Merge pull request #19076 from anntzer/aitoff
Small improvements to aitoff projection.
2 parents a610953 + 527faa4 commit 17ae40b

File tree

1 file changed

+2
-5
lines changed
  • lib/matplotlib/projections

1 file changed

+2
-5
lines changed

lib/matplotlib/projections/geo.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,7 @@ def transform_non_affine(self, ll):
264264
cos_latitude = np.cos(latitude)
265265

266266
alpha = np.arccos(cos_latitude * np.cos(half_long))
267-
# Avoid divide-by-zero errors using same method as NumPy.
268-
alpha[alpha == 0.0] = 1e-20
269-
# We want unnormalized sinc. numpy.sinc gives us normalized
270-
sinc_alpha = np.sin(alpha) / alpha
267+
sinc_alpha = np.sinc(alpha / np.pi) # np.sinc is sin(pi*x)/(pi*x).
271268

272269
x = (cos_latitude * np.sin(half_long)) / sinc_alpha
273270
y = np.sin(latitude) / sinc_alpha
@@ -282,7 +279,7 @@ class InvertedAitoffTransform(_GeoTransform):
282279
def transform_non_affine(self, xy):
283280
# docstring inherited
284281
# MGDTODO: Math is hard ;(
285-
return xy
282+
return np.full_like(xy, np.nan)
286283

287284
def inverted(self):
288285
# docstring inherited

0 commit comments

Comments
 (0)