diff --git a/pyproj/transformer.py b/pyproj/transformer.py index 2d3d18f12..3c308a39c 100644 --- a/pyproj/transformer.py +++ b/pyproj/transformer.py @@ -1243,7 +1243,7 @@ def transform( # pylint: disable=invalid-name "See: https://pyproj4.github.io/pyproj/stable/" "gotchas.html#upgrading-to-pyproj-2-from-pyproj-1" ), - DeprecationWarning, + FutureWarning, stacklevel=2, ) return Transformer.from_proj(p1, p2, always_xy=always_xy).transform( @@ -1324,7 +1324,7 @@ def itransform( # pylint: disable=invalid-name "See: https://pyproj4.github.io/pyproj/stable/" "gotchas.html#upgrading-to-pyproj-2-from-pyproj-1" ), - DeprecationWarning, + FutureWarning, stacklevel=2, ) return Transformer.from_proj(p1, p2, always_xy=always_xy).itransform( diff --git a/test/test_datum.py b/test/test_datum.py index d1a4a6a22..801160734 100644 --- a/test/test_datum.py +++ b/test/test_datum.py @@ -12,7 +12,7 @@ def test_datum(proj_class): s_1 = -111.5 s_2 = 45.25919444444 p2 = proj_class(proj="utm", zone=10, datum="NAD27") - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): x2, y2 = transform(p1, p2, s_1, s_2) if grids_available("us_noaa_emhpgn.tif"): assert_almost_equal((x2, y2), (1402286.33, 5076292.30), decimal=2) diff --git a/test/test_datum_shift.py b/test/test_datum_shift.py index bf15a6f90..2f0ce684f 100644 --- a/test/test_datum_shift.py +++ b/test/test_datum_shift.py @@ -36,7 +36,7 @@ def test_shift_wgs84_to_utm33(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): xutm33, yutm33, zutm33 = transform( WGS84_PROJ, UTM_33_PROJ, WGS84_lon, WGS84_lat, WGS84_z ) @@ -44,7 +44,7 @@ def test_shift_wgs84_to_utm33(): def test_shift_utm33_to_wgs84(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): back_lon, back_lat, back_z = transform( UTM_33_PROJ, WGS84_PROJ, UTM_x, UTM_y, UTM_z ) @@ -52,13 +52,13 @@ def test_shift_utm33_to_wgs84(): def test_shift_wgs84_to_gaussb_no_ellisoidal_height(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): xgb, ygb, zgb = transform(WGS84_PROJ, GAUSSSB_PROJ, WGS84_lon, WGS84_lat, 0) assert_almost_equal((xgb, ygb, zgb), (GB_x, 5055619.899, 0), decimal=2) def test_shift_gaussb_to_wgs84_no_ellisoidal_height(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): back_lon, back_lat, back_z = transform(GAUSSSB_PROJ, WGS84_PROJ, GB_x, GB_y, 0) assert_almost_equal( (back_lon, back_lat, back_z), (WGS84_lon, WGS84_lat, 0), decimal=3 diff --git a/test/test_doctest_wrapper.py b/test/test_doctest_wrapper.py index 94079cba0..bb7e02797 100644 --- a/test/test_doctest_wrapper.py +++ b/test/test_doctest_wrapper.py @@ -44,7 +44,7 @@ def test_doctests__network(): """ with proj_network_env(): pyproj.network.set_network_enabled(active=True) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): failure_count, _ = doctest.testmod(pyproj.transformer, verbose=True) assert failure_count == 0, f"{failure_count} of the doctests failed" diff --git a/test/test_proj.py b/test/test_proj.py index 09360784b..a3332c016 100644 --- a/test/test_proj.py +++ b/test/test_proj.py @@ -130,13 +130,13 @@ def setUp(self): def test_tranform_none_1st_parmeter(self): # test should raise Type error if projections are not of Proj classes # version 1.9.4 produced AttributeError, now should raise TypeError - with pytest.warns(DeprecationWarning), pytest.raises(CRSError): + with pytest.warns(FutureWarning), pytest.raises(CRSError): transform(None, self.p, -74, 39) def test_tranform_none_2nd_parmeter(self): # test should raise Type error if projections are not of Proj classes # version 1.9.4 has a Segmentation Fault, now should raise TypeError - with pytest.warns(DeprecationWarning), pytest.raises(CRSError): + with pytest.warns(FutureWarning), pytest.raises(CRSError): transform(self.p, None, -74, 39) @@ -155,7 +155,7 @@ def test_latlong_typeerror(self): p = Proj("+proj=stere +lon_0=-39 +lat_0=90 +lat_ts=71.0 +ellps=WGS84") self.assertTrue(isinstance(p, Proj)) # if not patched this line raises a "TypeError: p2 must be a Proj class" - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): lon, lat = transform(p, p.to_latlong(), 200000, 400000) diff --git a/test/test_transform.py b/test/test_transform.py index 1d582d3e1..66ff0073c 100644 --- a/test/test_transform.py +++ b/test/test_transform.py @@ -36,12 +36,12 @@ def test_transform(): print("max/min x and y for awips218 grid") print(numpy.minimum.reduce(numpy.ravel(x1)), numpy.maximum.reduce(numpy.ravel(x1))) print(numpy.minimum.reduce(numpy.ravel(y1)), numpy.maximum.reduce(numpy.ravel(y1))) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): x2, y2 = transform(awips218, awips221, x1, y1) print("max/min x and y for awips218 grid in awips221 coordinates") print(numpy.minimum.reduce(numpy.ravel(x2)), numpy.maximum.reduce(numpy.ravel(x2))) print(numpy.minimum.reduce(numpy.ravel(y2)), numpy.maximum.reduce(numpy.ravel(y2))) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): x3, y3 = transform(awips221, awips218, x2, y2) print("error for reverse transformation back to awips218 coords") print("(should be close to zero)") diff --git a/test/test_transformer.py b/test/test_transformer.py index 753842e14..8cc6d7d2b 100644 --- a/test/test_transformer.py +++ b/test/test_transformer.py @@ -34,7 +34,7 @@ def test_tranform_wgs84_to_custom(): ) wgs84 = pyproj.Proj("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs") lat, lon = 51.04715, 3.23406 - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): xx, yy = pyproj.transform(wgs84, custom_proj, lon, lat) assert f"{xx:.3f} {yy:.3f}" == "212.623 4604.975" @@ -45,7 +45,7 @@ def test_transform_wgs84_to_alaska(): lat_lon_proj = pyproj.Proj(init="epsg:4326", preserve_units=False) alaska_aea_proj = pyproj.Proj(init="epsg:2964", preserve_units=False) test = (-179.72638, 49.752533) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): xx, yy = pyproj.transform(lat_lon_proj, alaska_aea_proj, *test) if grids_available("us_noaa_alaska.tif"): assert f"{xx:.3f} {yy:.3f}" == "-1824924.495 330822.800" @@ -59,13 +59,13 @@ def test_illegal_transformation(): with pytest.warns(FutureWarning): p1 = pyproj.Proj(init="epsg:4326") p2 = pyproj.Proj(init="epsg:3857") - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): xx, yy = pyproj.transform( p1, p2, (-180, -180, 180, 180, -180), (-90, 90, 90, -90, -90) ) assert np.all(np.isinf(xx)) assert np.all(np.isinf(yy)) - with pytest.warns(DeprecationWarning), pytest.raises(ProjError): + with pytest.warns(FutureWarning), pytest.raises(ProjError): pyproj.transform( p1, p2, (-180, -180, 180, 180, -180), (-90, 90, 90, -90, -90), errcheck=True ) @@ -80,7 +80,7 @@ def test_lambert_conformal_transform(): E = 567623.931 N = 256422.787 h = 1341.467 - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): Long1, Lat1, H1 = pyproj.transform(Midelt, WGS84, E, N, h, radians=False) assert_almost_equal((Long1, Lat1, H1), (-4.6753456, 32.902199, 1341.467), decimal=5) @@ -114,7 +114,7 @@ def test_4d_transform_crs_obs1(): def test_4d_transform_orginal_crs_obs1(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( transform( 7789, 8401, x=3496737.2679, y=743254.4507, z=5264462.9620, tt=2019.0 @@ -142,7 +142,7 @@ def test_2d_with_time_transform_crs_obs2(): def test_2d_with_time_transform_original_crs_obs2(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( transform(4896, 7930, x=3496737.2679, y=743254.4507, tt=2019.0), (3496737.4105305015, 743254.1014318303, 2019.0), @@ -174,7 +174,7 @@ def test_3d_time_itransform(): def test_4d_itransform_orginal_crs_obs1(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( list( itransform( @@ -186,7 +186,7 @@ def test_4d_itransform_orginal_crs_obs1(): def test_2d_with_time_itransform_original_crs_obs2(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( list( itransform( @@ -199,7 +199,7 @@ def test_2d_with_time_itransform_original_crs_obs2(): def test_itransform_time_3rd_invalid(): - with pytest.warns(DeprecationWarning), pytest.raises( + with pytest.warns(FutureWarning), pytest.raises( ValueError, match="'time_3rd' is only valid for 3 coordinates." ): list( @@ -210,7 +210,7 @@ def test_itransform_time_3rd_invalid(): time_3rd=True, ) ) - with pytest.warns(DeprecationWarning), pytest.raises( + with pytest.warns(FutureWarning), pytest.raises( ValueError, match="'time_3rd' is only valid for 3 coordinates." ): list(itransform(7789, 8401, [(3496737.2679, 743254.4507)], time_3rd=True)) @@ -220,7 +220,7 @@ def test_transform_no_error(): with pytest.warns(FutureWarning): pj = Proj(init="epsg:4555") pjx, pjy = pj(116.366, 39.867) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): transform(pj, Proj(4326), pjx, pjy, radians=True, errcheck=True) @@ -228,7 +228,7 @@ def test_itransform_no_error(): with pytest.warns(FutureWarning): pj = Proj(init="epsg:4555") pjx, pjy = pj(116.366, 39.867) - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): list(itransform(pj, Proj(4326), [(pjx, pjy)], radians=True, errcheck=True)) @@ -251,7 +251,7 @@ def test_transform_radians(): with pytest.warns(FutureWarning): WGS84 = pyproj.Proj("+init=EPSG:4326") ECEF = pyproj.Proj(proj="geocent", ellps="WGS84", datum="WGS84") - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( pyproj.transform( ECEF, WGS84, -2704026.010, -4253051.810, 3895878.820, radians=True @@ -276,7 +276,7 @@ def test_itransform_radians(): with pytest.warns(FutureWarning): WGS84 = pyproj.Proj("+init=EPSG:4326") ECEF = pyproj.Proj(proj="geocent", ellps="WGS84", datum="WGS84") - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( list( pyproj.itransform( @@ -338,7 +338,7 @@ def test_always_xy__transformer(): def test_always_xy__transform(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( transform(2193, 4326, 1625350, 5504853, always_xy=True), (173.29964730317386, -40.60674802693758), @@ -346,7 +346,7 @@ def test_always_xy__transform(): def test_always_xy__itransform(): - with pytest.warns(DeprecationWarning): + with pytest.warns(FutureWarning): assert_almost_equal( list(itransform(2193, 4326, [(1625350, 5504853)], always_xy=True)), [(173.29964730317386, -40.60674802693758)],