-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failures with PROJ 9.0.1 #2051
Comments
I'd be a lot more interested in knowing how those tests are failing exactly. Are these tests overly precise? Were the values wrong before? |
Overly precise is a likely cause. The values could also be wrong, someone who understands the CRS changes will need to answer that. |
I wonder what would happen if you replace Edit: and the relative differences now showing the OP really are tiny! |
With these changes (on top of the xfail changes), the tests succeed with PROJ 9.0.1: --- a/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py
+++ b/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py
@@ -9,14 +9,13 @@ Tests for the InterruptedGoodeHomolosine
"""
import numpy as np
-from numpy.testing import assert_almost_equal
+from numpy.testing import assert_almost_equal, assert_allclose
import pytest
import cartopy.crs as ccrs
from .helpers import check_proj_params
-@pytest.mark.xfail(reason='Fails with PROJ 9.0.1', strict=False)
@pytest.mark.parametrize("emphasis", ["land", "ocean"])
def test_default(emphasis):
igh = ccrs.InterruptedGoodeHomolosine(emphasis=emphasis)
@@ -25,10 +24,10 @@ def test_default(emphasis):
check_proj_params("igh", igh, other_args)
elif emphasis == "ocean":
check_proj_params("igh_o", igh, other_args)
- assert_almost_equal(
+ assert_allclose(
np.array(igh.x_limits), [-20037508.3427892, 20037508.3427892]
)
- assert_almost_equal(
+ assert_allclose(
np.array(igh.y_limits), [-8683259.7164347, 8683259.7164347]
)
@@ -47,7 +46,6 @@ def test_eccentric_globe(emphasis):
assert_almost_equal(np.array(igh.y_limits), [-1361.410035, 1361.410035])
-@pytest.mark.xfail(reason='Fails with PROJ 9.0.1', strict=False)
@pytest.mark.parametrize(
("emphasis", "lon"),
[("land", -10.0), ("land", 10.0), ("ocean", -10.0), ("ocean", 10.0)],
@@ -62,11 +60,10 @@ def test_central_longitude(emphasis, lon
elif emphasis == "ocean":
check_proj_params("igh_o", igh, other_args)
- assert_almost_equal(
+ assert_allclose(
np.array(igh.x_limits),
[-20037508.3427892, 20037508.3427892],
- decimal=5,
)
- assert_almost_equal(
+ assert_allclose(
np.array(igh.y_limits), [-8683259.7164347, 8683259.7164347]
)
--- a/lib/cartopy/tests/crs/test_mollweide.py
+++ b/lib/cartopy/tests/crs/test_mollweide.py
@@ -9,22 +9,21 @@ Tests for the Mollweide coordinate syste
"""
import numpy as np
-from numpy.testing import assert_almost_equal
+from numpy.testing import assert_almost_equal, assert_allclose
import pytest
import cartopy.crs as ccrs
from .helpers import check_proj_params
-@pytest.mark.xfail(reason='Fails with PROJ 9.0.1', strict=False)
def test_default():
moll = ccrs.Mollweide()
other_args = {'a=6378137.0', 'lon_0=0'}
check_proj_params('moll', moll, other_args)
- assert_almost_equal(np.array(moll.x_limits),
+ assert_allclose(np.array(moll.x_limits),
[-18040095.6961473, 18040095.6961473])
- assert_almost_equal(np.array(moll.y_limits),
+ assert_allclose(np.array(moll.y_limits),
[-9020047.8480736, 9020047.8480736])
@@ -38,7 +37,6 @@ def test_sphere_globe():
assert_almost_equal(moll.y_limits, [-1414.2135624, 1414.2135624])
-@pytest.mark.xfail(reason='Fails with PROJ 9.0.1', strict=False)
def test_ellipse_globe():
globe = ccrs.Globe(ellipse='WGS84')
with pytest.warns(UserWarning,
@@ -50,8 +48,8 @@ def test_ellipse_globe():
check_proj_params('moll', moll, other_args)
# Limits are the same as default since ellipses are not supported.
- assert_almost_equal(moll.x_limits, [-18040095.6961473, 18040095.6961473])
- assert_almost_equal(moll.y_limits, [-9020047.8480736, 9020047.8480736])
+ assert_allclose(moll.x_limits, [-18040095.6961473, 18040095.6961473])
+ assert_allclose(moll.y_limits, [-9020047.8480736, 9020047.8480736])
def test_eccentric_globe():
@@ -79,17 +77,15 @@ def test_offset():
assert tuple(np.array(crs.y_limits) - 4321) == crs_offset.y_limits
-@pytest.mark.xfail(reason='Fails with PROJ 9.0.1', strict=False)
@pytest.mark.parametrize('lon', [-10.0, 10.0])
def test_central_longitude(lon):
moll = ccrs.Mollweide(central_longitude=lon)
other_args = {'a=6378137.0', f'lon_0={lon}'}
check_proj_params('moll', moll, other_args)
- assert_almost_equal(np.array(moll.x_limits),
- [-18040095.6961473, 18040095.6961473],
- decimal=5)
- assert_almost_equal(np.array(moll.y_limits),
+ assert_allclose(np.array(moll.x_limits),
+ [-18040095.6961473, 18040095.6961473])
+ assert_allclose(np.array(moll.y_limits),
[-9020047.8480736, 9020047.8480736])
|
Our test limits are somewhat arbitrarily set. The |
Description
The first release candidates for PROJ 9.0.1 have been released, the release contains changes that cause test failures due to almost_equal tests failing.
Code to reproduce
Build cartopy with PROJ 9.0.1RC2.
The following changes work around the test failures:
The text was updated successfully, but these errors were encountered: