Skip to content
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.2.0 #2145

Closed
dotlambda opened this issue Mar 12, 2023 · 2 comments · Fixed by #2163
Closed

Test failures with PROJ 9.2.0 #2145

dotlambda opened this issue Mar 12, 2023 · 2 comments · Fixed by #2163

Comments

@dotlambda
Copy link

Description

AssertionError about arrays not being almost equal in

  • tests/test_crs.py::TestCRS::test_epsg
  • tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_default
  • tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_eccentric_globe
  • tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_ellipsoid_transform
  • tests/crs/test_sinusoidal.py::TestSinusoidal::test_eccentric_globe
Traceback
============================= test session starts ==============================
platform linux -- Python 3.11.2, pytest-7.2.0, pluggy-1.0.0
Matplotlib: 3.6.2
Freetype: 2.12.1
rootdir: /build/Cartopy-0.21.1, configfile: setup.cfg
plugins: mpl-0.16.1
collecting ... INFO:matplotlib.font_manager:generated new fontManager
collected 777 items / 187 deselected / 590 selected

tests/test_coding_standards.py s                                         [  0%]
tests/test_crs.py .....F....................                             [  4%]
tests/test_crs_transform_vectors.py ........                             [  5%]
tests/test_features.py ......                                            [  6%]
tests/test_geodesic.py .............                                     [  9%]
tests/test_img_nest.py .......                                           [ 10%]
tests/test_img_tiles.py .........                                        [ 11%]
tests/test_img_transform.py ............................................ [ 19%]
......................                                                   [ 23%]
tests/test_line_string.py ..................x                            [ 26%]
tests/test_linear_ring.py ......                                         [ 27%]
tests/test_polygon.py ..............................                     [ 32%]
tests/test_shapereader.py ...                                            [ 32%]
tests/test_util.py ..............................................        [ 40%]
tests/test_vector_transform.py .......                                   [ 41%]
tests/crs/test_albers_equal_area.py ........                             [ 43%]
tests/crs/test_azimuthal_equidistant.py ........                         [ 44%]
tests/crs/test_eckert.py ..............................................  [ 52%]
tests/crs/test_equal_earth.py .....                                      [ 53%]
tests/crs/test_equidistant_conic.py FF.....F                             [ 54%]
tests/crs/test_geostationary.py ....                                     [ 55%]
tests/crs/test_gnomonic.py ...............                               [ 57%]
tests/crs/test_interrupted_goode_homolosine.py ........                  [ 59%]
tests/crs/test_lambert_azimuthal_equal_area.py .....                     [ 60%]
tests/crs/test_lambert_conformal.py ........                             [ 61%]
tests/crs/test_mercator.py ........                                      [ 62%]
tests/crs/test_miller.py ........                                        [ 64%]
tests/crs/test_mollweide.py .........                                    [ 65%]
tests/crs/test_nearside_perspective.py ...                               [ 66%]
tests/crs/test_orthographic.py ...............                           [ 68%]
tests/crs/test_robinson.py .........                                     [ 70%]
tests/crs/test_rotated_geodetic.py .                                     [ 70%]
tests/crs/test_rotated_pole.py .                                         [ 70%]
tests/crs/test_sinusoidal.py .F....                                      [ 71%]
tests/crs/test_stereographic.py .....                                    [ 72%]
tests/crs/test_transverse_mercator.py .....x......                       [ 74%]
tests/crs/test_utm.py ...                                                [ 74%]
tests/feature/test_nightshade.py ......                                  [ 75%]
tests/io/test_downloaders.py ..                                          [ 76%]
tests/mpl/test_axes.py ...........                                       [ 78%]
tests/mpl/test_caching.py .                                              [ 78%]
tests/mpl/test_contour.py ......                                         [ 79%]
tests/mpl/test_feature_artist.py .......                                 [ 80%]
tests/mpl/test_features.py WARNING:shapefile:Possible issue encountered when converting Shape #95 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
WARNING:shapefile:Possible issue encountered when converting Shape #95 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
WARNING:shapefile:Possible issue encountered when converting Shape #471 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
WARNING:shapefile:Possible issue encountered when converting Shape #471 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
WARNING:shapefile:Possible issue encountered when converting Shape #1541 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
WARNING:shapefile:Possible issue encountered when converting Shape #1541 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
.                                             [ 80%]
tests/mpl/test_gridliner.py ................                             [ 83%]
tests/mpl/test_images.py .........                                       [ 84%]
tests/mpl/test_img_transform.py ..                                       [ 85%]
tests/mpl/test_mpl_integration.py ..........                             [ 86%]
tests/mpl/test_patch.py ...                                              [ 87%]
tests/mpl/test_plots.py ..                                               [ 87%]
tests/mpl/test_pseudo_color.py .....                                     [ 88%]
tests/mpl/test_quiver.py ....                                            [ 89%]
tests/mpl/test_set_extent.py ........                                    [ 90%]
tests/mpl/test_style.py ....................                             [ 94%]
tests/mpl/test_ticker.py .................................               [ 99%]
tests/mpl/test_ticks.py ..                                               [100%]

=================================== FAILURES ===================================
______________________________ TestCRS.test_epsg _______________________________

self = <cartopy.tests.test_crs.TestCRS object at 0x7fffcb633950>

    def test_epsg(self):
        uk = ccrs.epsg(27700)
        assert uk.epsg_code == 27700
>       assert_almost_equal(uk.x_limits, (-104009.357, 688806.007), decimal=3)
E       AssertionError:
E       Arrays are not almost equal to 3 decimals
E
E       Mismatched elements: 1 / 2 (50%)
E       Max absolute difference: 719.40770292
E       Max relative difference: 0.00691676
E        x: array([-104728.765,  688806.007])
E        y: array([-104009.357,  688806.007])

/nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/test_crs.py:92: AssertionError
______________________ TestEquidistantConic.test_default _______________________

self = <cartopy.tests.crs.test_equidistant_conic.TestEquidistantConic object at 0x7fffc845bfd0>

    def test_default(self):
        eqdc = ccrs.EquidistantConic()
        other_args = {'ellps=WGS84', 'lon_0=0.0', 'lat_0=0.0', 'x_0=0.0',
                      'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('eqdc', eqdc, other_args)

>       assert_almost_equal(np.array(eqdc.x_limits),
                            (-22784919.35600352, 22784919.35600352),
                            decimal=7)
E       AssertionError:
E       Arrays are not almost equal to 7 decimals
E
E       Mismatched elements: 2 / 2 (100%)
E       Max absolute difference: 5.34579158e-06
E       Max relative difference: 2.34619728e-13
E        x: array([-22784919.3559982,  22784919.3559982])
E        y: array([-22784919.3560035,  22784919.3560035])

/nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/crs/test_equidistant_conic.py:26: AssertionError
__________________ TestEquidistantConic.test_eccentric_globe ___________________

self = <cartopy.tests.crs.test_equidistant_conic.TestEquidistantConic object at 0x7fffc845b610>

    def test_eccentric_globe(self):
        globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500,
                           ellipse=None)
        eqdc = ccrs.EquidistantConic(globe=globe)
        other_args = {'a=1000', 'b=500', 'lon_0=0.0', 'lat_0=0.0', 'x_0=0.0',
                      'y_0=0.0', 'lat_1=20.0', 'lat_2=50.0'}
        check_proj_params('eqdc', eqdc, other_args)

>       assert_almost_equal(np.array(eqdc.x_limits),
                            (-3016.869847713461, 3016.869847713461),
                            decimal=7)
E       AssertionError:
E       Arrays are not almost equal to 7 decimals
E
E       Mismatched elements: 2 / 2 (100%)
E       Max absolute difference: 56.76889961
E       Max relative difference: 0.01881715
E        x: array([-2960.1009481,  2960.1009481])
E        y: array([-3016.8698477,  3016.8698477])

/nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/crs/test_equidistant_conic.py:41: AssertionError
________________ TestEquidistantConic.test_ellipsoid_transform _________________

self = <cartopy.tests.crs.test_equidistant_conic.TestEquidistantConic object at 0x7fffc841a8d0>

    def test_ellipsoid_transform(self):
        # USGS Professional Paper 1395, pp 299--300
        globe = ccrs.Globe(semimajor_axis=6378206.4,
                           flattening=1 - np.sqrt(1 - 0.00676866),
                           ellipse=None)
        lat_1 = 29.5
        lat_2 = 45.5
        eqdc = ccrs.EquidistantConic(central_latitude=23.0,
                                     central_longitude=-96.0,
                                     standard_parallels=(lat_1, lat_2),
                                     globe=globe)
        geodetic = eqdc.as_geodetic()

        other_args = {'a=6378206.4', 'f=0.003390076308689371', 'lon_0=-96.0',
                      'lat_0=23.0', 'x_0=0.0', 'y_0=0.0', 'lat_1=29.5',
                      'lat_2=45.5'}
        check_proj_params('eqdc', eqdc, other_args)

>       assert_almost_equal(np.array(eqdc.x_limits),
                            (-22421870.719894886, 22421870.719894886),
                            decimal=7)
E       AssertionError:
E       Arrays are not almost equal to 7 decimals
E
E       Mismatched elements: 2 / 2 (100%)
E       Max absolute difference: 5.14835119e-06
E       Max relative difference: 2.29612919e-13
E        x: array([-22421870.7198897,  22421870.7198898])
E        y: array([-22421870.7198949,  22421870.7198949])

/nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/crs/test_equidistant_conic.py:131: AssertionError
_____________________ TestSinusoidal.test_eccentric_globe ______________________

self = <cartopy.tests.crs.test_sinusoidal.TestSinusoidal object at 0x7fffc841b750>

    def test_eccentric_globe(self):
        globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500,
                           ellipse=None)
        crs = ccrs.Sinusoidal(globe=globe)
        other_args = {'a=1000', 'b=500', 'lon_0=0.0', 'x_0=0.0', 'y_0=0.0'}
        check_proj_params('sinu', crs, other_args)

        assert_almost_equal(np.array(crs.x_limits),
                            [-3141.59, 3141.59], decimal=2)
>       assert_almost_equal(np.array(crs.y_limits),
                            [-1216.60, 1216.60], decimal=2)
E       AssertionError:
E       Arrays are not almost equal to 2 decimals
E
E       Mismatched elements: 2 / 2 (100%)
E       Max absolute difference: 5.54426234
E       Max relative difference: 0.00455718
E        x: array([-1211.06,  1211.06])
E        y: array([-1216.6,  1216.6])

/nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/crs/test_sinusoidal.py:37: AssertionError
=============================== warnings summary ===============================
../../nix/store/pvyr0gxrf2vck0a8fcm2dmn124215y37-python3.11-owslib-0.28.0/lib/python3.11/site-packages/owslib/map/wms111.py:18
  /nix/store/pvyr0gxrf2vck0a8fcm2dmn124215y37-python3.11-owslib-0.28.0/lib/python3.11/site-packages/owslib/map/wms111.py:18: DeprecationWarning: 'cgi' is deprecated and slated for removal in Python 3.13
    import cgi

tests/test_crs.py::TestCRS::test_osgb[True]
tests/test_crs.py::TestCRS::test_osgb[False]
  /nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/test_crs.py:61: UserWarning: uk_os_OSTN15_NTv2_OSGBtoETRS.tif is unavailable; testing OSGB at reduced precision
    warnings.warn(f'{grid_name} is unavailable; '

tests/test_img_tiles.py: 3 warnings
tests/test_linear_ring.py: 10 warnings
tests/test_polygon.py: 42 warnings
tests/mpl/test_axes.py: 8 warnings
tests/mpl/test_contour.py: 16 warnings
tests/mpl/test_feature_artist.py: 4 warnings
tests/mpl/test_features.py: 26 warnings
tests/mpl/test_mpl_integration.py: 20 warnings
tests/mpl/test_pseudo_color.py: 17 warnings
tests/mpl/test_set_extent.py: 2 warnings
  /nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/crs.py:827: DeprecationWarning: The 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version
    multi_line_string = cartopy.trace.project_linear(linear_ring,

tests/test_line_string.py: 28 warnings
tests/mpl/test_axes.py: 18 warnings
tests/mpl/test_contour.py: 22 warnings
tests/mpl/test_features.py: 1 warning
tests/mpl/test_gridliner.py: 63 warnings
tests/mpl/test_images.py: 3 warnings
tests/mpl/test_plots.py: 1 warning
tests/mpl/test_set_extent.py: 6 warnings
  /nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/crs.py:814: DeprecationWarning: The 'geom_factory' function is deprecated in Shapely 2.0, and will be removed in a future version
    return cartopy.trace.project_linear(geometry, src_crs, self)

tests/test_shapereader.py::TestLakes::test_geometry
  /nix/store/17w2lx3jjgf1h09sir4r3i82h4r3zman-python3.11-cartopy-0.21.1/lib/python3.11/site-packages/cartopy/tests/test_shapereader.py:32: ShapelyDeprecationWarning: The 'type' attribute is deprecated, and will be removed in the future. You can use the 'geom_type' attribute instead.
    assert lake_geometry.type == 'Polygon'

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/test_crs.py::TestCRS::test_epsg - AssertionError:
FAILED tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_default - AssertionError:
FAILED tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_eccentric_globe - AssertionError:
FAILED tests/crs/test_equidistant_conic.py::TestEquidistantConic::test_ellipsoid_transform - AssertionError:
FAILED tests/crs/test_sinusoidal.py::TestSinusoidal::test_eccentric_globe - AssertionError:
= 5 failed, 582 passed, 1 skipped, 187 deselected, 2 xfailed, 294 warnings in 207.99s (0:03:27) =
Full environment definition

Operating system

NixOS Linux x86_64

Cartopy version

0.2.1

Dependencies

  • PROJ 9.2.0
  • GEOS 3.11.1
  • matplotlib 3.6.2
  • numpy 1.23.4
  • pyproj 3.4.1
  • pyshp 2.3.1
  • shapely 2.0.1
@greglucas
Copy link
Contributor

Care to make a PR updating these tolerances in the tests? All seem pretty reasonable.

@greglucas greglucas added this to the 0.22 milestone Mar 12, 2023
@dotlambda
Copy link
Author

I'm honestly not sure how much the tolerances can be increased. Some of the values seem to be completely off. Would you mind updating them yourself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants