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

TST: Adjust NAD83 to NAD27 transform tests for PROJ 9.1.1 #1258

Merged
merged 2 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
proj-version: ['9.1.0']
proj-version: ['9.2.0']
include:
- python-version: '3.9'
proj-version: '9.1.1'
- python-version: '3.9'
proj-version: '9.1.0'
- python-version: '3.9'
proj-version: '9.0.1'
steps:
Expand Down Expand Up @@ -126,6 +130,10 @@ jobs:
python-version: '*'
python-implementation: pypy
proj-version: '*'
- os: ubuntu-latest
python-version: '*'
python-implementation: python
proj-version: '9.1.1'
steps:
- uses: actions/checkout@v3

Expand Down
1 change: 1 addition & 0 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

_NETWORK_ENABLED = pyproj.network.is_network_enabled()
PROJ_LOOSE_VERSION = version.parse(pyproj.__proj_version__)
PROJ_911 = PROJ_LOOSE_VERSION == version.parse("9.1.1")
PROJ_GTE_901 = PROJ_LOOSE_VERSION >= version.parse("9.0.1")
PROJ_GTE_91 = PROJ_LOOSE_VERSION >= version.parse("9.1")
PROJ_GTE_911 = PROJ_LOOSE_VERSION >= version.parse("9.1.1")
Expand Down
74 changes: 44 additions & 30 deletions test/test_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from numpy.testing import assert_allclose, assert_almost_equal

from pyproj import Proj, __proj_version__, transform
from test.conftest import PROJ_GTE_92, grids_available
from test.conftest import PROJ_911, PROJ_GTE_92, PROJ_GTE_911, grids_available


def test_transform():
Expand Down Expand Up @@ -52,6 +52,7 @@ def test_transform():
assert_allclose(numpy.maximum.reduce(numpy.ravel(y3 - y1)), 0, atol=1e-4)


@pytest.mark.xfail(PROJ_911, reason="Patch applied in conda-forge changes behavior")
def test_transform_single_point_nad83_to_nad27():
# projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
# (defined by epsg code 26915)
Expand All @@ -67,30 +68,36 @@ def test_transform_single_point_nad83_to_nad27():
(569704.566, 4269024.671),
decimal=3,
)
expected_xy2 = (569722.342, 4268814.028)
if PROJ_GTE_92:
expected_xy2 = (569720.46, 4268813.88)
if grids_available(
"ca_nrc_ntv2_0.tif", "us_noaa_nadcon5_nad27_nad83_1986_conus.tif"
expected_xy2 = (569722, 4268814)
if PROJ_GTE_911:
expected_xy2 = (569720, 4268813)
if (
PROJ_GTE_92
and grids_available(
"us_noaa_nadcon5_nad27_nad83_1986_conus.tif", check_network=False
)
) or grids_available():
expected_xy2 = (569722, 4268814)
elif grids_available(
"ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif", check_network=False
):
expected_xy2 = (569722.394, 4268814.27)
elif grids_available("ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif"):
expected_xy2 = (569706.333, 4268817.68)
elif grids_available("us_noaa_conus.tif"):
expected_xy2 = (569722.342, 4268814.028)
expected_xy2 = (569706, 4268817)
elif grids_available("us_noaa_conus.tif", check_network=False):
expected_xy2 = (569722, 4268814)

assert_almost_equal(
(x2, y2),
expected_xy2,
decimal=3,
decimal=0,
)
assert_almost_equal(
p2(x2, y2, inverse=True),
p2(x2, y2, inverse=True, errcheck=True),
(-92.200, 38.567),
decimal=3,
)


@pytest.mark.xfail(PROJ_911, reason="Patch applied in conda-forge changes behavior")
def test_transform_tuple_nad83_to_nad27():
# projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
# (defined by epsg code 26915)
Expand All @@ -112,32 +119,39 @@ def test_transform_tuple_nad83_to_nad27():
(4298200.739, 4353698.725, 4292319.005),
decimal=3,
)
expected_x2 = (567721.149, 351747.558, 728569.133)
expected_y2 = (4297989.112, 4353489.645, 4292106.305)
if PROJ_GTE_92:
expected_x2 = (567719.249, 351748.119, 728568.053)
expected_y2 = (4297989.776, 4353487.434, 4292108.075)
if grids_available("us_noaa_nadcon5_nad27_nad83_1986_conus.tif"):
expected_x2 = (567721.401, 351747.526, 728569.212)
expected_y2 = (4297989.733, 4353489.752, 4292106.351)
elif grids_available("ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif"):
expected_x2 = (567705.072, 351727.113, 728558.917)
expected_y2 = (4297993.157, 4353490.111, 4292111.678)
elif grids_available("us_noaa_conus.tif"):
expected_x2 = (567721.149, 351747.558, 728569.133)
expected_y2 = (4297989.112, 4353489.645, 4292106.305)
expected_x2 = (567721, 351747, 728569)
expected_y2 = (4297989, 4353489, 4292106)
if PROJ_GTE_911:
expected_x2 = (567719, 351748, 728568)
expected_y2 = (4297989, 4353487, 4292108)
if (
PROJ_GTE_92
and grids_available(
"us_noaa_nadcon5_nad27_nad83_1986_conus.tif", check_network=False
)
) or grids_available():
expected_x2 = (567721, 351747, 728569)
expected_y2 = (4297989, 4353489, 4292106)
elif grids_available(
"ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif", check_network=False
):
expected_x2 = (567705, 351727, 728558)
expected_y2 = (4297993, 4353490, 4292111)
elif grids_available("us_noaa_conus.tif", check_network=False):
expected_x2 = (567721, 351747, 728569.133)
expected_y2 = (4297989, 4353489, 4292106)

assert_almost_equal(
x2,
expected_x2,
decimal=3,
decimal=0,
)
assert_almost_equal(
y2,
expected_y2,
decimal=3,
decimal=0,
)
lons2, lats2 = p2(x2, y2, inverse=True)
lons2, lats2 = p2(x2, y2, inverse=True, errcheck=True)
assert_almost_equal(
lons2,
(-92.220, -94.720, -90.370),
Expand Down