diff --git a/pyresample/spherical.py b/pyresample/spherical.py index a9d15e18d..6a163e758 100644 --- a/pyresample/spherical.py +++ b/pyresample/spherical.py @@ -42,7 +42,10 @@ class SCoordinate(object): """ def __init__(self, lon, lat): - self.lon = float(_unwrap_radians(lon)) + if np.isfinite(lon): + self.lon = float(_unwrap_radians(lon)) + else: + self.lon = float(lon) self.lat = lat def cross2cart(self, point): diff --git a/pyresample/test/test_spherical.py b/pyresample/test/test_spherical.py index 03a96cf1c..3ef7594ba 100644 --- a/pyresample/test/test_spherical.py +++ b/pyresample/test/test_spherical.py @@ -146,6 +146,12 @@ def test_equality_at_antimeridian(self): point_end = SCoordinate(np.pi, 0) assert point_start == point_end + def test_equality_of_infinites(self): + """Test that infinite coordinates are equal.""" + coord1 = SCoordinate(np.inf, np.inf) + coord2 = SCoordinate(np.inf, np.inf) + assert coord1 == coord2 + class TestCCoordinate(unittest.TestCase): """Test SCoordinates."""