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

Fails to build with Shapely 2.0 #484

Closed
sebastic opened this issue Dec 6, 2022 · 3 comments · Fixed by #485
Closed

Fails to build with Shapely 2.0 #484

sebastic opened this issue Dec 6, 2022 · 3 comments · Fixed by #485
Labels

Comments

@sebastic
Copy link
Contributor

sebastic commented Dec 6, 2022

The build fails due to test failures:

=================================== FAILURES ===================================
___________________ Test.test_area_def_geocentric_resolution ___________________

self = <pyresample.test.test_geometry.Test testMethod=test_area_def_geocentric_resolution>

    def test_area_def_geocentric_resolution(self):
        """Test the AreaDefinition.geocentric_resolution method."""
        from pyresample import get_area_def
        area_extent = (-5570248.477339745, -5561247.267842293, 5567248.074173927, 5570248.477339745)
        proj_dict = {'a': 6378169.0, 'b': 6356583.8, 'h': 35785831.0,
                     'lon_0': 0.0, 'proj': 'geos', 'units': 'm'}
        # metered projection
        area_def = get_area_def('orig', 'Test area', 'test',
                                proj_dict,
                                3712, 3712,
                                area_extent)
        geo_res = area_def.geocentric_resolution()
>       np.testing.assert_allclose(10646.562531, geo_res)
E       AssertionError: 
E       Not equal to tolerance rtol=1e-07, atol=0
E       
E       Mismatched elements: 1 / 1 (100%)
E       Max absolute difference: 0.09742581
E       Max relative difference: 9.15100108e-06
E        x: array(10646.562531)
E        y: array(10646.465105)

pyresample/test/test_geometry.py:1432: AssertionError

self = <pyresample.test.test_geometry.Test testMethod=test_cartopy_crs>

    def test_cartopy_crs(self):
        """Test conversion from area definition to cartopy crs."""
        europe = geometry.AreaDefinition(area_id='areaD',
                                         description='Europe (3km, HRV, VTC)',
                                         proj_id='areaD',
                                         projection={'a': '6378144.0',
                                                     'b': '6356759.0',
                                                     'lat_0': '50.00',
                                                     'lat_ts': '50.00',
                                                     'lon_0': '8.00',
                                                     'proj': 'stere'},
                                         width=800, height=800,
                                         area_extent=[-1370912.72,
                                                      -909968.64000000001,
                                                      1029087.28,
                                                      1490031.3600000001])
        seviri = geometry.AreaDefinition(area_id='seviri',
                                         description='SEVIRI HRIT like (flipped, south up)',
                                         proj_id='seviri',
                                         projection={'proj': 'geos',
                                                     'lon_0': 0.0,
                                                     'a': 6378169.00,
                                                     'b': 6356583.80,
                                                     'h': 35785831.00,
                                                     'units': 'm'},
                                         width=123, height=123,
                                         area_extent=[5500000, 5500000, -5500000, -5500000])
    
        for area_def in [europe, seviri]:
>           crs = area_def.to_cartopy_crs()

pyresample/test/test_geometry.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyresample/geometry.py:1929: in to_cartopy_crs
    import cartopy.crs as ccrs
/usr/lib/python3/dist-packages/cartopy/__init__.py:107: in <module>
    import cartopy.crs  # noqa: E402  module-level imports
/usr/lib/python3/dist-packages/cartopy/crs.py:27: in <module>
    import cartopy.trace
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   ImportError: cannot import name lgeos

lib/cartopy/trace.pyx:56: ImportError

The latter is caused by Cartopy, see: SciTools/cartopy#2076

@djhoese
Copy link
Member

djhoese commented Dec 6, 2022

Could you provide more information about your environment? I have not tested against shapely 2.0, but the geocentric resolution test that is failing shouldn't be depending on shapely at all so I'm not sure why that test would have changed.

@djhoese djhoese added the bug label Dec 6, 2022
@sebastic
Copy link
Contributor Author

sebastic commented Dec 7, 2022

Environment: Debian packages from unstable with python3-shapely (2.0~rc2-1~exp2) from experimental.

The test succeeds with python3-shapely (1.8.5-2) from Debian unstable.

@sebastic
Copy link
Contributor Author

sebastic commented Dec 7, 2022

The build with shapely 1.8.5 was misleading, it used some older dependencies.

Changes between the last successful build and the failing one (both with Shapely 1.8.5):

Package Success Failure
glib2.0 2.74.1 2.74.2
proj 9.1.0 9.1.1
certifi 2022.6.15 2022.9.24
charset-normalizer 2.0.6 3.0.1
click 8.0.3 8.1.3
colorama 0.4.5 0.4.6
sphinx 4.5.0 5.3.0
xarray 2022.11.0 2022.12.0

test_area_def_geocentric_resolution also fails in a bookworm environment, which suggest that the recent update of proj to 9.1.1 caused the issue. Increasing the tolerance may suffice to resolve the issue.

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

Successfully merging a pull request may close this issue.

2 participants