diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b626d79b..d9807a81d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,7 @@ # Circle CI configuration file # https://circleci.com/docs/ +--- version: 2.1 @@ -8,7 +9,7 @@ version: 2.1 # Define some common steps as YAML anchors. # -apt-run: &apt-install +apt-run: &apt-install name: Install apt packages command: | apt-get -qq update @@ -17,15 +18,18 @@ apt-run: &apt-install g++ \ make -env-run: &env-setup +env-run: &env-setup # Create the basic testing environment # Mixing conda-forge and defaults in root is a recipe for trouble, so create # a separate environment. name: Setup conda environment command: | - conda config --set always_yes yes --set changeps1 no --set show_channel_urls yes - conda create -n test-environment python=$PYTHON_VERSION + conda config \ + --set always_yes yes \ + --set changeps1 no \ + --set show_channel_urls yes conda config --add channels conda-forge + conda create -n test-environment python=$PYTHON_VERSION deps-run: &deps-install name: Install Python dependencies diff --git a/lib/cartopy/crs.py b/lib/cartopy/crs.py index 1505819e2..3c26b7243 100644 --- a/lib/cartopy/crs.py +++ b/lib/cartopy/crs.py @@ -39,42 +39,7 @@ WGS84_SEMIMINOR_AXIS = 6356752.3142 -def _safe_pj_transform_611(src_crs, tgt_crs, x, y, z=None, trap=True): - """ - Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran. - - See https://github.com/OSGeo/proj#1782. - """ - lonlat = ('latlon', 'latlong', 'lonlat', 'longlat') - - if ( - src_crs.proj4_params.get('proj', '') == 'ob_tran' and - src_crs.proj4_params.get('o_proj', '') in lonlat and - 'to_meter' in src_crs.proj4_params - ): - x *= src_crs.proj4_params['to_meter'] - y *= src_crs.proj4_params['to_meter'] - - transformer = Transformer.from_crs(src_crs, tgt_crs, always_xy=True) - transformed_coords = transformer.transform(x, y, z, errcheck=trap) - if z is None: - xx, yy = transformed_coords - zz = 0 - else: - xx, yy, zz = transformed_coords - - if ( - tgt_crs.proj4_params.get('proj', '') == 'ob_tran' and - tgt_crs.proj4_params.get('o_proj', '') in lonlat and - 'to_meter' in tgt_crs.proj4_params - ): - xx /= tgt_crs.proj4_params['to_meter'] - yy /= tgt_crs.proj4_params['to_meter'] - - return xx, yy, zz - - -def _safe_pj_transform_pre_611(src_crs, tgt_crs, x, y, z=None, trap=True): +def _safe_pj_transform(src_crs, tgt_crs, x, y, z=None, trap=True): transformer = Transformer.from_crs(src_crs, tgt_crs, always_xy=True) transformed_coords = transformer.transform(x, y, z, errcheck=trap) if z is None: @@ -85,12 +50,6 @@ def _safe_pj_transform_pre_611(src_crs, tgt_crs, x, y, z=None, trap=True): return xx, yy, zz -if (6, 1, 1) <= PROJ_VERSION < (6, 3, 0): - _safe_pj_transform = _safe_pj_transform_611 -else: - _safe_pj_transform = _safe_pj_transform_pre_611 - - class Globe(object): """ Define an ellipsoid and, optionally, how to relate it to the real world. @@ -1465,12 +1424,8 @@ def __init__(self, central_longitude=0.0, central_latitude=0.0, ('lat_0', central_latitude), ('k', scale_factor), ('x_0', false_easting), ('y_0', false_northing), ('units', 'm')] - if PROJ_VERSION < (6, 0, 0): - if not approx: - proj4_params[0] = ('proj', 'etmerc') - else: - if approx: - proj4_params += [('approx', None)] + if approx: + proj4_params += [('approx', None)] super().__init__(proj4_params, globe=globe) self.threshold = 1e4 @@ -2018,25 +1973,6 @@ def __init__(self, central_latitude=0.0, central_longitude=0.0, false_easting=0.0, false_northing=0.0, true_scale_latitude=None, scale_factor=None, globe=None): - # Warn when using Stereographic with proj < 5.0.0 due to - # incorrect transformation with lon_0=0 (see - # https://github.com/OSGeo/proj.4/issues/194). - if central_latitude == 0: - if PROJ_VERSION != (): - if PROJ_VERSION < (5, 0, 0): - warnings.warn( - 'The Stereographic projection in Proj older than ' - '5.0.0 incorrectly transforms points when ' - 'central_latitude=0. Use this projection with ' - 'caution.', - stacklevel=2) - else: - warnings.warn( - 'Cannot determine Proj version. The Stereographic ' - 'projection may be unreliable and should be used with ' - 'caution.', - stacklevel=2) - proj4_params = [('proj', 'stere'), ('lat_0', central_latitude), ('lon_0', central_longitude), ('x_0', false_easting), ('y_0', false_northing)] @@ -2115,19 +2051,6 @@ class Orthographic(Projection): def __init__(self, central_longitude=0.0, central_latitude=0.0, globe=None): - if PROJ_VERSION != (): - if (5, 0, 0) <= PROJ_VERSION < (5, 1, 0): - warnings.warn( - 'The Orthographic projection in the v5.0.x series of Proj ' - 'incorrectly transforms points. Use this projection with ' - 'caution.', - stacklevel=2) - else: - warnings.warn( - 'Cannot determine Proj version. The Orthographic projection ' - 'may be unreliable and should be used with caution.', - stacklevel=2) - proj4_params = [('proj', 'ortho'), ('lon_0', central_longitude), ('lat_0', central_latitude)] super().__init__(proj4_params, globe=globe) @@ -2350,11 +2273,6 @@ def __init__(self, central_longitude=0, false_easting=None, If omitted, a default globe is created. """ - if PROJ_VERSION < (5, 2, 0): - _proj_ver = '.'.join(str(v) for v in PROJ_VERSION) - raise ValueError('The EqualEarth projection requires Proj version ' - f'5.2.0, but you are using {_proj_ver}.') - proj_params = [('proj', 'eqearth'), ('lon_0', central_longitude)] super().__init__(proj_params, central_longitude, false_easting=false_easting, @@ -2436,22 +2354,6 @@ def __init__(self, central_longitude=0, globe=None, This projection does not handle elliptical globes. """ - # Warn when using Robinson with proj 4.8 due to discontinuity at - # 40 deg N introduced by incomplete fix to issue #113 (see - # https://github.com/OSGeo/proj.4/issues/113). - if PROJ_VERSION != (): - if (4, 8) <= PROJ_VERSION < (4, 9): - warnings.warn('The Robinson projection in the v4.8.x series ' - 'of Proj contains a discontinuity at ' - '40 deg latitude. Use this projection with ' - 'caution.', - stacklevel=2) - else: - warnings.warn('Cannot determine Proj version. The Robinson ' - 'projection may be unreliable and should be used ' - 'with caution.', - stacklevel=2) - proj4_params = [('proj', 'robin'), ('lon_0', central_longitude)] super().__init__(proj4_params, central_longitude, false_easting=false_easting, @@ -2543,11 +2445,6 @@ def __init__(self, central_longitude=0, globe=None, emphasis='land'): super().__init__(proj4_params, globe=globe) elif emphasis == 'ocean': - if PROJ_VERSION < (7, 1, 0): - _proj_ver = '.'.join(str(v) for v in PROJ_VERSION) - raise ValueError('The Interrupted Goode Homolosine ocean ' - 'projection requires Proj version 7.1.0, ' - f'but you are using {_proj_ver}') proj4_params = [('proj', 'igh_o'), ('lon_0', central_longitude)] super().__init__(proj4_params, globe=globe) @@ -2929,22 +2826,6 @@ def __init__(self, central_longitude=0.0, central_latitude=0.0, globe is created. """ - # Warn when using Azimuthal Equidistant with proj < 4.9.2 due to - # incorrect transformation past 90 deg distance (see - # https://github.com/OSGeo/proj.4/issues/246). - if PROJ_VERSION != (): - if PROJ_VERSION < (4, 9, 2): - warnings.warn('The Azimuthal Equidistant projection in Proj ' - 'older than 4.9.2 incorrectly transforms points ' - 'farther than 90 deg from the origin. Use this ' - 'projection with caution.', - stacklevel=2) - else: - warnings.warn('Cannot determine Proj version. The Azimuthal ' - 'Equidistant projection may be unreliable and ' - 'should be used with caution.', - stacklevel=2) - proj4_params = [('proj', 'aeqd'), ('lon_0', central_longitude), ('lat_0', central_latitude), ('x_0', false_easting), ('y_0', false_northing)] diff --git a/lib/cartopy/tests/crs/test_equal_earth.py b/lib/cartopy/tests/crs/test_equal_earth.py index f2d4ac983..4ab904d90 100644 --- a/lib/cartopy/tests/crs/test_equal_earth.py +++ b/lib/cartopy/tests/crs/test_equal_earth.py @@ -16,10 +16,6 @@ from .helpers import check_proj_params -pytestmark = pytest.mark.skipif(ccrs.PROJ_VERSION < (5, 2, 0), - reason='Proj is too old.') - - def test_default(): eqearth = ccrs.EqualEarth() other_args = {'ellps=WGS84', 'lon_0=0'} diff --git a/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py b/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py index c36c24963..4b51492f0 100644 --- a/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py +++ b/lib/cartopy/tests/crs/test_interrupted_goode_homolosine.py @@ -18,8 +18,6 @@ @pytest.mark.parametrize("emphasis", ["land", "ocean"]) def test_default(emphasis): - if emphasis == "ocean" and ccrs.PROJ_VERSION < (7, 1, 0): - pytest.skip() igh = ccrs.InterruptedGoodeHomolosine(emphasis=emphasis) other_args = {"ellps=WGS84", "lon_0=0"} if emphasis == "land": @@ -36,8 +34,6 @@ def test_default(emphasis): @pytest.mark.parametrize("emphasis", ["land", "ocean"]) def test_eccentric_globe(emphasis): - if emphasis == "ocean" and ccrs.PROJ_VERSION < (7, 1, 0): - pytest.skip() globe = ccrs.Globe(semimajor_axis=1000, semiminor_axis=500, ellipse=None) igh = ccrs.InterruptedGoodeHomolosine(globe=globe, emphasis=emphasis) other_args = {"a=1000", "b=500", "lon_0=0"} @@ -55,8 +51,6 @@ def test_eccentric_globe(emphasis): [("land", -10.0), ("land", 10.0), ("ocean", -10.0), ("ocean", 10.0)], ) def test_central_longitude(emphasis, lon): - if emphasis == "ocean" and ccrs.PROJ_VERSION < (7, 1, 0): - pytest.skip() igh = ccrs.InterruptedGoodeHomolosine( central_longitude=lon, emphasis=emphasis ) diff --git a/lib/cartopy/tests/crs/test_orthographic.py b/lib/cartopy/tests/crs/test_orthographic.py index d005a570b..0b4c1254b 100644 --- a/lib/cartopy/tests/crs/test_orthographic.py +++ b/lib/cartopy/tests/crs/test_orthographic.py @@ -43,9 +43,7 @@ def test_ellipse_globe(): with pytest.warns(UserWarning, match='does not handle elliptical globes.') as w: ortho = ccrs.Orthographic(globe=globe) - assert len(w) == (2 - if (5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0) - else 1) + assert len(w) == 1 other_args = {'ellps=WGS84', 'lon_0=0.0', 'lat_0=0.0'} check_proj_params('ortho', ortho, other_args) @@ -61,9 +59,7 @@ def test_eccentric_globe(): with pytest.warns(UserWarning, match='does not handle elliptical globes.') as w: ortho = ccrs.Orthographic(globe=globe) - assert len(w) == (2 - if (5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0) - else 1) + assert len(w) == 1 other_args = {'a=1000', 'b=500', 'lon_0=0.0', 'lat_0=0.0'} check_proj_params('ortho', ortho, other_args) diff --git a/lib/cartopy/tests/crs/test_robinson.py b/lib/cartopy/tests/crs/test_robinson.py index d906da824..77f85624e 100644 --- a/lib/cartopy/tests/crs/test_robinson.py +++ b/lib/cartopy/tests/crs/test_robinson.py @@ -19,25 +19,14 @@ _CRS_PC = ccrs.PlateCarree() _CRS_ROB = ccrs.Robinson() -# Increase tolerance if using older proj releases -if ccrs.PROJ_VERSION >= (6, 3, 1): - _TRANSFORM_TOL = 7 -elif ccrs.PROJ_VERSION >= (4, 9): - _TRANSFORM_TOL = 0 -else: - _TRANSFORM_TOL = -1 -_LIMIT_TOL = -1 # if ccrs.PROJ_VERSION < (5, 2, 0) else 7 - def test_default(): robin = ccrs.Robinson() other_args = {'a=6378137.0', 'lon_0=0'} check_proj_params('robin', robin, other_args) - assert_almost_equal(robin.x_limits, - [-17005833.3305252, 17005833.3305252]) - assert_almost_equal(robin.y_limits, - [-8625154.6651000, 8625154.6651000], _LIMIT_TOL) + assert_almost_equal(robin.x_limits, [-17005833.3305252, 17005833.3305252]) + assert_almost_equal(robin.y_limits, [-8625154.6651000, 8625154.6651000]) def test_sphere_globe(): @@ -47,8 +36,7 @@ def test_sphere_globe(): check_proj_params('robin', robin, other_args) assert_almost_equal(robin.x_limits, [-2666.2696851, 2666.2696851]) - assert_almost_equal(robin.y_limits, [-1352.3000000, 1352.3000000], - _LIMIT_TOL) + assert_almost_equal(robin.y_limits, [-1352.3000000, 1352.3000000]) def test_ellipse_globe(): @@ -63,8 +51,7 @@ def test_ellipse_globe(): # Limits are the same as default since ellipses are not supported. assert_almost_equal(robin.x_limits, [-17005833.3305252, 17005833.3305252]) - assert_almost_equal(robin.y_limits, [-8625154.6651000, 8625154.6651000], - _LIMIT_TOL) + assert_almost_equal(robin.y_limits, [-8625154.6651000, 8625154.6651000]) def test_eccentric_globe(): @@ -80,8 +67,7 @@ def test_eccentric_globe(): # Limits are the same as spheres since ellipses are not supported. assert_almost_equal(robin.x_limits, [-2666.2696851, 2666.2696851]) - assert_almost_equal(robin.y_limits, [-1352.3000000, 1352.3000000], - _LIMIT_TOL) + assert_almost_equal(robin.y_limits, [-1352.3000000, 1352.3000000]) def test_offset(): @@ -99,11 +85,9 @@ def test_central_longitude(lon): other_args = {'a=6378137.0', f'lon_0={lon}'} check_proj_params('robin', robin, other_args) - assert_almost_equal(robin.x_limits, - [-17005833.3305252, 17005833.3305252], + assert_almost_equal(robin.x_limits, [-17005833.3305252, 17005833.3305252], decimal=5) - assert_almost_equal(robin.y_limits, - [-8625154.6651000, 8625154.6651000], _LIMIT_TOL) + assert_almost_equal(robin.y_limits, [-8625154.6651000, 8625154.6651000]) def test_transform_point(): @@ -115,8 +99,7 @@ def test_transform_point(): # this way has always worked result = _CRS_ROB.transform_point(35.0, 70.0, _CRS_PC) - assert_array_almost_equal(result, (2376187.2182271, 7275318.1162980), - _TRANSFORM_TOL) + assert_array_almost_equal(result, (2376187.2182271, 7275318.1162980)) # this always did something, but result has altered result = _CRS_ROB.transform_point(np.nan, 70.0, _CRS_PC) @@ -139,16 +122,14 @@ def test_transform_points(): np.array([35.0]), np.array([70.0])) assert_array_almost_equal(result, - [[2376187.2182271, 7275318.1162980, 0]], - _TRANSFORM_TOL) + [[2376187.2182271, 7275318.1162980, 0]]) result = _CRS_ROB.transform_points(_CRS_PC, np.array([35.0]), np.array([70.0]), np.array([0.0])) assert_array_almost_equal(result, - [[2376187.2182271, 7275318.1162980, 0]], - _TRANSFORM_TOL) + [[2376187.2182271, 7275318.1162980, 0]]) # this always did something, but result has altered result = _CRS_ROB.transform_points(_CRS_PC, diff --git a/lib/cartopy/tests/crs/test_transverse_mercator.py b/lib/cartopy/tests/crs/test_transverse_mercator.py index aef320cf3..ce4c56f67 100644 --- a/lib/cartopy/tests/crs/test_transverse_mercator.py +++ b/lib/cartopy/tests/crs/test_transverse_mercator.py @@ -92,9 +92,8 @@ def setup_class(self): def test_default(self, approx): proj = ccrs.OSNI(approx=approx) res = proj.transform_point(*self.point_a, src_crs=self.src_crs) - np.testing.assert_array_almost_equal( - res, (275614.26762651594, 386984.206429612), - decimal=0 if ccrs.PROJ_VERSION < (5, 0, 0) else 6) + np.testing.assert_array_almost_equal(res, + (275614.267627, 386984.206430)) def test_nan(self): proj = ccrs.OSNI(approx=True) diff --git a/lib/cartopy/tests/mpl/test_crs.py b/lib/cartopy/tests/mpl/test_crs.py index 583c6e03b..c61ac83be 100644 --- a/lib/cartopy/tests/mpl/test_crs.py +++ b/lib/cartopy/tests/mpl/test_crs.py @@ -21,7 +21,6 @@ def test_igh_land(): ax.gridlines() -@pytest.mark.skipif(ccrs.PROJ_VERSION < (7, 1, 0), reason="Proj is too old.") @pytest.mark.natural_earth @ImageTesting(["igh_ocean"]) def test_igh_ocean(): diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py index 9d14156ce..1bc9a950e 100644 --- a/lib/cartopy/tests/mpl/test_gridliner.py +++ b/lib/cartopy/tests/mpl/test_gridliner.py @@ -54,7 +54,7 @@ @pytest.mark.natural_earth @ImageTesting(['gridliner1'], # Robinson projection is slightly better in Proj 6+. - tolerance=0.7 if ccrs.PROJ_VERSION >= (6, 0, 0) else 0.5) + tolerance=0.7) def test_gridliner(): ny, nx = 2, 4 @@ -210,9 +210,7 @@ def test_grid_labels(): @pytest.mark.skipif(geos_version == (3, 9, 0), reason="GEOS intersection bug") @pytest.mark.natural_earth -@ImageTesting(['gridliner_labels_tight'], - tolerance=grid_label_tol if ccrs.PROJ_VERSION < (7, 1, 0) - else 4) +@ImageTesting(['gridliner_labels_tight'], tolerance=4) def test_grid_labels_tight(): # Ensure tight layout accounts for gridlines fig = plt.figure(figsize=(7, 5)) @@ -262,14 +260,7 @@ def test_grid_labels_inline(): else: kwargs = {} ax = plt.subplot(7, 4, i, projection=proj(**kwargs)) - if (ccrs.PROJ_VERSION[:2] == (5, 0) and - proj in (ccrs.Orthographic, ccrs.AlbersEqualArea, - ccrs.Geostationary, ccrs.NearsidePerspective)): - # Above projections are broken, so skip labels. - # Add gridlines anyway to minimize image differences. - ax.gridlines() - else: - ax.gridlines(draw_labels=True, auto_inline=True) + ax.gridlines(draw_labels=True, auto_inline=True) ax.coastlines(resolution="110m") ax.set_title(proj, y=1.075) plt.subplots_adjust(wspace=0.35, hspace=0.35) @@ -297,14 +288,7 @@ def test_grid_labels_inline_usa(): except Exception: pass ax.set_title(proj, y=1.075) - if (ccrs.PROJ_VERSION[:2] == (5, 0) and - proj in (ccrs.Orthographic, ccrs.AlbersEqualArea, - ccrs.Geostationary, ccrs.NearsidePerspective)): - # Above projections are broken, so skip labels. - # Add gridlines anyway to minimize image differences. - ax.gridlines() - else: - ax.gridlines(draw_labels=True, auto_inline=True, clip_on=True) + ax.gridlines(draw_labels=True, auto_inline=True, clip_on=True) ax.coastlines(resolution="110m") plt.subplots_adjust(wspace=0.35, hspace=0.35) diff --git a/lib/cartopy/tests/mpl/test_images.py b/lib/cartopy/tests/mpl/test_images.py index 0ba8ad229..8fc41a144 100644 --- a/lib/cartopy/tests/mpl/test_images.py +++ b/lib/cartopy/tests/mpl/test_images.py @@ -35,9 +35,6 @@ # care that it is putting images onto the map which are roughly correct. @pytest.mark.natural_earth @pytest.mark.network -@pytest.mark.xfail(ccrs.PROJ_VERSION == (5, 0, 0), - reason='Proj returns slightly different bounds.', - strict=True) @ImageTesting(['web_tiles'], tolerance=5.91) def test_web_tiles(): extent = [-15, 0.1, 50, 60] @@ -74,9 +71,6 @@ def test_web_tiles(): @pytest.mark.natural_earth @pytest.mark.network -@pytest.mark.xfail(ccrs.PROJ_VERSION == (5, 0, 0), - reason='Proj returns slightly different bounds.', - strict=True) @ImageTesting(['image_merge'], tolerance=0.01) def test_image_merge(): # tests the basic image merging functionality @@ -103,9 +97,6 @@ def test_image_merge(): plt.imshow(img, origin=origin, extent=extent, alpha=0.5) -@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0), - reason='Proj Orthographic projection is buggy.', - strict=True) @ImageTesting(['imshow_natural_earth_ortho'], tolerance=0.7) def test_imshow(): source_proj = ccrs.PlateCarree() @@ -170,18 +161,12 @@ def test_imshow_rgb(): plt.close() -@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0), - reason='Proj Orthographic projection is buggy.', - strict=True) @ImageTesting(['imshow_natural_earth_ortho'], tolerance=0.7) def test_stock_img(): ax = plt.axes(projection=ccrs.Orthographic()) ax.stock_img() -@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0), - reason='Proj Orthographic projection is buggy.', - strict=True) @ImageTesting(['imshow_natural_earth_ortho'], tolerance=0.7) def test_pil_Image(): img = Image.open(NATURAL_EARTH_IMG) @@ -191,9 +176,6 @@ def test_pil_Image(): extent=[-180, 180, -90, 90]) -@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0), - reason='Proj Orthographic projection is buggy.', - strict=True) @ImageTesting(['imshow_natural_earth_ortho']) def test_background_img(): ax = plt.axes(projection=ccrs.Orthographic()) diff --git a/lib/cartopy/tests/mpl/test_mpl_integration.py b/lib/cartopy/tests/mpl/test_mpl_integration.py index 3fdf9097f..79c5bbca0 100644 --- a/lib/cartopy/tests/mpl/test_mpl_integration.py +++ b/lib/cartopy/tests/mpl/test_mpl_integration.py @@ -211,8 +211,6 @@ def test_multiple_projections(): transform=prj.as_geodetic()) -@pytest.mark.skipif(ccrs.PROJ_VERSION < (5, 2, 0), - reason='Proj is too old.') @pytest.mark.natural_earth @ImageTesting(['multiple_projections520'], tolerance=0.65) def test_multiple_projections_520(): @@ -345,15 +343,8 @@ def test_pcolormesh_get_array_with_mask(): 'Data supplied does not match data retrieved in unwrapped case' -tolerance = 1.87 -if (5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0): - tolerance += 0.8 - - @pytest.mark.natural_earth -@ImageTesting( - ['pcolormesh_global_wrap2'], - tolerance=tolerance) +@ImageTesting(['pcolormesh_global_wrap2'], tolerance=1.87) def test_pcolormesh_global_with_wrap2(): # make up some realistic data with bounds (such as data from the UM) nx, ny = 36, 18 @@ -381,15 +372,8 @@ def test_pcolormesh_global_with_wrap2(): ax.set_global() # make sure everything is visible -tolerance = 1.42 -if (5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0): - tolerance += 1.4 - - @pytest.mark.natural_earth -@ImageTesting( - ['pcolormesh_global_wrap3'], - tolerance=tolerance) +@ImageTesting(['pcolormesh_global_wrap3'], tolerance=1.42) def test_pcolormesh_global_with_wrap3(): nx, ny = 33, 17 xbnds = np.linspace(-1.875, 358.125, nx, endpoint=True) @@ -430,7 +414,7 @@ def test_pcolormesh_global_with_wrap3(): @pytest.mark.natural_earth -@ImageTesting(['pcolormesh_global_wrap3'], tolerance=tolerance) +@ImageTesting(['pcolormesh_global_wrap3'], tolerance=1.42) def test_pcolormesh_set_array_with_mask(): """Testing that set_array works with masked arrays properly.""" nx, ny = 33, 17 @@ -480,7 +464,7 @@ def test_pcolormesh_set_array_with_mask(): @pytest.mark.natural_earth -@ImageTesting(['pcolormesh_global_wrap3'], tolerance=tolerance) +@ImageTesting(['pcolormesh_global_wrap3'], tolerance=1.42) def test_pcolormesh_set_clim_with_mask(): """Testing that set_clim works with masked arrays properly.""" nx, ny = 33, 17 diff --git a/lib/cartopy/tests/mpl/test_web_services.py b/lib/cartopy/tests/mpl/test_web_services.py index aff0f0180..1d4bfd3f4 100644 --- a/lib/cartopy/tests/mpl/test_web_services.py +++ b/lib/cartopy/tests/mpl/test_web_services.py @@ -37,9 +37,6 @@ def test_wms_tight_layout(): @pytest.mark.network -@pytest.mark.xfail((5, 0, 0) <= ccrs.PROJ_VERSION < (5, 1, 0), - reason='Proj Orthographic projection is buggy.', - strict=True) @pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.') @ImageTesting(['wms'], tolerance=0.02) def test_wms(): diff --git a/lib/cartopy/tests/test_crs.py b/lib/cartopy/tests/test_crs.py index 8871816e9..25bf934f0 100644 --- a/lib/cartopy/tests/test_crs.py +++ b/lib/cartopy/tests/test_crs.py @@ -75,18 +75,9 @@ def test_osgb(self, approx): def test_epsg(self): uk = ccrs.epsg(27700) assert uk.epsg_code == 27700 - if ccrs.PROJ_VERSION >= (8, 0, 0): - assert_almost_equal(uk.x_limits, (-104009.357, 688806.007), - decimal=3) - assert_almost_equal(uk.y_limits, (-8908.37, 1256558.45), - decimal=2) - assert_almost_equal(uk.threshold, 7928.15, decimal=2) - else: - assert_almost_equal(uk.x_limits, (-118397.001, 751441.779), - decimal=3) - assert_almost_equal(uk.y_limits, (-5192.07, 1272149.35), - decimal=2) - assert_almost_equal(uk.threshold, 8698.39, decimal=2) + assert_almost_equal(uk.x_limits, (-104009.357, 688806.007), decimal=3) + assert_almost_equal(uk.y_limits, (-8908.37, 1256558.45), decimal=2) + assert_almost_equal(uk.threshold, 7928.15, decimal=2) self._check_osgb(uk) def test_epsg_compound_crs(self): diff --git a/lib/cartopy/tests/test_img_tiles.py b/lib/cartopy/tests/test_img_tiles.py index 7d7bea5ac..abe11a483 100644 --- a/lib/cartopy/tests/test_img_tiles.py +++ b/lib/cartopy/tests/test_img_tiles.py @@ -31,19 +31,6 @@ (8, 9, 4): (0, 2504688.542848654, -5009377.085697312, -2504688.542848654), } -if ccrs.PROJ_VERSION == (5, 0, 0): - KNOWN_EXTENTS = { - (0, 0, 0): (-20037508.342789244, 20037508.342789244, - -19994827.892149, 19994827.892149), - (2, 0, 2): (0, 10018754.171395, - 9997413.946075, 19994827.892149), - (0, 2, 2): (-20037508.342789244, -10018754.171394622, - -9997413.946075, 0), - (2, 2, 2): (0, 10018754.171395, - -9997413.946075, 0), - (8, 9, 4): (0, 2504688.542849, - -4998706.973037, -2499353.486519), - } def GOOGLE_IMAGE_URL_REPLACEMENT(self, tile): @@ -157,14 +144,9 @@ def test_image_for_domain(): ll_extent = ccrs.Geodetic().transform_points(gt.crs, np.array(extent[:2]), np.array(extent[2:])) - if ccrs.PROJ_VERSION == (5, 0, 0): - assert_arr_almost(ll_extent[:, :2], - [[-11.25, 49.033955], - [11.25, 61.687101]]) - else: - assert_arr_almost(ll_extent[:, :2], - [[-11.25, 48.92249926], - [11.25, 61.60639637]]) + assert_arr_almost(ll_extent[:, :2], + [[-11.25, 48.92249926], + [11.25, 61.60639637]]) def test_quadtree_wts(): diff --git a/lib/cartopy/trace.pyx b/lib/cartopy/trace.pyx index 1d016a019..82ea1a431 100644 --- a/lib/cartopy/trace.pyx +++ b/lib/cartopy/trace.pyx @@ -589,18 +589,6 @@ def _interpolator(src_crs, dest_projection): else: interpolator = CartesianInterpolator() interpolator.init(src_crs, dest_projection) - if (6, 1, 1) <= PROJ_VERSION < (6, 3, 0): - # Workaround bug in Proj 6.1.1+ with +to_meter on +proj=ob_tran. - # See https://github.com/OSGeo/proj#1782. - lonlat = ('latlon', 'latlong', 'lonlat', 'longlat') - if (src_crs.proj4_params.get('proj', '') == 'ob_tran' and - src_crs.proj4_params.get('o_proj', '') in lonlat and - 'to_meter' in src_crs.proj4_params): - interpolator.src_scale = src_crs.proj4_params['to_meter'] - if (dest_projection.proj4_params.get('proj', '') == 'ob_tran' and - dest_projection.proj4_params.get('o_proj', '') in lonlat and - 'to_meter' in dest_projection.proj4_params): - interpolator.dest_scale = 1 / dest_projection.proj4_params['to_meter'] return interpolator diff --git a/setup.py b/setup.py index 21963de72..c04029448 100644 --- a/setup.py +++ b/setup.py @@ -62,7 +62,7 @@ # Please keep in sync with INSTALL file. GEOS_MIN_VERSION = (3, 7, 2) -PROJ_MIN_VERSION = (4, 9, 0) +PROJ_MIN_VERSION = (8, 0, 0) def file_walk_relative(top, remove=''): @@ -172,18 +172,6 @@ def find_proj_version_by_program(conda=None): return proj_version -def get_proj_libraries(): - """ - This function gets the PROJ libraries to cythonize with - """ - proj_libraries = ["proj"] - if os.name == "nt" and (6, 0, 0) <= proj_version < (6, 3, 0): - proj_libraries = [ - "proj_{}_{}".format(proj_version[0], proj_version[1]) - ] - return proj_libraries - - conda = os.getenv('CONDA_DEFAULT_ENV') if conda is not None and conda in sys.prefix: # Conda does not provide pkg-config compatibility, but the search paths @@ -199,7 +187,7 @@ def get_proj_libraries(): exit(1) proj_includes = [] - proj_libraries = get_proj_libraries() + proj_libraries = ["proj"] proj_library_dirs = [] else: @@ -222,7 +210,7 @@ def get_proj_libraries(): exit(1) proj_includes = [] - proj_libraries = get_proj_libraries() + proj_libraries = ["proj"] proj_library_dirs = [] else: if proj_version < PROJ_MIN_VERSION: