Skip to content

Commit 1ca9a1c

Browse files
authored
Merge pull request #1258 from snowman2/tst
TST: Adjust NAD83 to NAD27 transform tests for PROJ 9.1.1
2 parents 356e45b + 006ec29 commit 1ca9a1c

File tree

3 files changed

+54
-31
lines changed

3 files changed

+54
-31
lines changed

.github/workflows/tests.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ jobs:
4040
fail-fast: false
4141
matrix:
4242
python-version: ['3.8', '3.9', '3.10', '3.11']
43-
proj-version: ['9.1.0']
43+
proj-version: ['9.2.0']
4444
include:
45+
- python-version: '3.9'
46+
proj-version: '9.1.1'
47+
- python-version: '3.9'
48+
proj-version: '9.1.0'
4549
- python-version: '3.9'
4650
proj-version: '9.0.1'
4751
steps:
@@ -126,6 +130,10 @@ jobs:
126130
python-version: '*'
127131
python-implementation: pypy
128132
proj-version: '*'
133+
- os: ubuntu-latest
134+
python-version: '*'
135+
python-implementation: python
136+
proj-version: '9.1.1'
129137
steps:
130138
- uses: actions/checkout@v3
131139

test/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
_NETWORK_ENABLED = pyproj.network.is_network_enabled()
1414
PROJ_LOOSE_VERSION = version.parse(pyproj.__proj_version__)
15+
PROJ_911 = PROJ_LOOSE_VERSION == version.parse("9.1.1")
1516
PROJ_GTE_901 = PROJ_LOOSE_VERSION >= version.parse("9.0.1")
1617
PROJ_GTE_91 = PROJ_LOOSE_VERSION >= version.parse("9.1")
1718
PROJ_GTE_911 = PROJ_LOOSE_VERSION >= version.parse("9.1.1")

test/test_transform.py

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from numpy.testing import assert_allclose, assert_almost_equal
44

55
from pyproj import Proj, __proj_version__, transform
6-
from test.conftest import PROJ_GTE_92, grids_available
6+
from test.conftest import PROJ_911, PROJ_GTE_92, PROJ_GTE_911, grids_available
77

88

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

5454

55+
@pytest.mark.xfail(PROJ_911, reason="Patch applied in conda-forge changes behavior")
5556
def test_transform_single_point_nad83_to_nad27():
5657
# projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
5758
# (defined by epsg code 26915)
@@ -67,30 +68,36 @@ def test_transform_single_point_nad83_to_nad27():
6768
(569704.566, 4269024.671),
6869
decimal=3,
6970
)
70-
expected_xy2 = (569722.342, 4268814.028)
71-
if PROJ_GTE_92:
72-
expected_xy2 = (569720.46, 4268813.88)
73-
if grids_available(
74-
"ca_nrc_ntv2_0.tif", "us_noaa_nadcon5_nad27_nad83_1986_conus.tif"
71+
expected_xy2 = (569722, 4268814)
72+
if PROJ_GTE_911:
73+
expected_xy2 = (569720, 4268813)
74+
if (
75+
PROJ_GTE_92
76+
and grids_available(
77+
"us_noaa_nadcon5_nad27_nad83_1986_conus.tif", check_network=False
78+
)
79+
) or grids_available():
80+
expected_xy2 = (569722, 4268814)
81+
elif grids_available(
82+
"ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif", check_network=False
7583
):
76-
expected_xy2 = (569722.394, 4268814.27)
77-
elif grids_available("ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif"):
78-
expected_xy2 = (569706.333, 4268817.68)
79-
elif grids_available("us_noaa_conus.tif"):
80-
expected_xy2 = (569722.342, 4268814.028)
84+
expected_xy2 = (569706, 4268817)
85+
elif grids_available("us_noaa_conus.tif", check_network=False):
86+
expected_xy2 = (569722, 4268814)
8187

8288
assert_almost_equal(
8389
(x2, y2),
8490
expected_xy2,
85-
decimal=3,
91+
decimal=0,
8692
)
8793
assert_almost_equal(
88-
p2(x2, y2, inverse=True),
94+
p2(x2, y2, inverse=True, errcheck=True),
8995
(-92.200, 38.567),
9096
decimal=3,
9197
)
9298

9399

100+
@pytest.mark.xfail(PROJ_911, reason="Patch applied in conda-forge changes behavior")
94101
def test_transform_tuple_nad83_to_nad27():
95102
# projection 1: UTM zone 15, grs80 ellipse, NAD83 datum
96103
# (defined by epsg code 26915)
@@ -112,32 +119,39 @@ def test_transform_tuple_nad83_to_nad27():
112119
(4298200.739, 4353698.725, 4292319.005),
113120
decimal=3,
114121
)
115-
expected_x2 = (567721.149, 351747.558, 728569.133)
116-
expected_y2 = (4297989.112, 4353489.645, 4292106.305)
117-
if PROJ_GTE_92:
118-
expected_x2 = (567719.249, 351748.119, 728568.053)
119-
expected_y2 = (4297989.776, 4353487.434, 4292108.075)
120-
if grids_available("us_noaa_nadcon5_nad27_nad83_1986_conus.tif"):
121-
expected_x2 = (567721.401, 351747.526, 728569.212)
122-
expected_y2 = (4297989.733, 4353489.752, 4292106.351)
123-
elif grids_available("ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif"):
124-
expected_x2 = (567705.072, 351727.113, 728558.917)
125-
expected_y2 = (4297993.157, 4353490.111, 4292111.678)
126-
elif grids_available("us_noaa_conus.tif"):
127-
expected_x2 = (567721.149, 351747.558, 728569.133)
128-
expected_y2 = (4297989.112, 4353489.645, 4292106.305)
122+
expected_x2 = (567721, 351747, 728569)
123+
expected_y2 = (4297989, 4353489, 4292106)
124+
if PROJ_GTE_911:
125+
expected_x2 = (567719, 351748, 728568)
126+
expected_y2 = (4297989, 4353487, 4292108)
127+
if (
128+
PROJ_GTE_92
129+
and grids_available(
130+
"us_noaa_nadcon5_nad27_nad83_1986_conus.tif", check_network=False
131+
)
132+
) or grids_available():
133+
expected_x2 = (567721, 351747, 728569)
134+
expected_y2 = (4297989, 4353489, 4292106)
135+
elif grids_available(
136+
"ca_nrc_ntv2_0.tif", "ca_nrc_ntv1_can.tif", check_network=False
137+
):
138+
expected_x2 = (567705, 351727, 728558)
139+
expected_y2 = (4297993, 4353490, 4292111)
140+
elif grids_available("us_noaa_conus.tif", check_network=False):
141+
expected_x2 = (567721, 351747, 728569.133)
142+
expected_y2 = (4297989, 4353489, 4292106)
129143

130144
assert_almost_equal(
131145
x2,
132146
expected_x2,
133-
decimal=3,
147+
decimal=0,
134148
)
135149
assert_almost_equal(
136150
y2,
137151
expected_y2,
138-
decimal=3,
152+
decimal=0,
139153
)
140-
lons2, lats2 = p2(x2, y2, inverse=True)
154+
lons2, lats2 = p2(x2, y2, inverse=True, errcheck=True)
141155
assert_almost_equal(
142156
lons2,
143157
(-92.220, -94.720, -90.370),

0 commit comments

Comments
 (0)