|
30 | 30 | ) |
31 | 31 | from rioxarray.rioxarray import _generate_spatial_coords, _make_coords |
32 | 32 | from test.conftest import ( |
| 33 | + GDAL_GE_3_11, |
33 | 34 | GDAL_GE_361, |
34 | 35 | TEST_COMPARE_DATA_DIR, |
35 | 36 | TEST_INPUT_DATA_DIR, |
@@ -1170,7 +1171,26 @@ def test_reproject__no_nodata_masked(modis_reproject): |
1170 | 1171 | _assert_xarrays_equal(mds_repr, mdc) |
1171 | 1172 |
|
1172 | 1173 |
|
1173 | | -def test_reproject__gcps_kwargs(tmp_path): |
| 1174 | +@pytest.mark.parametrize( |
| 1175 | + "affine_c_param", |
| 1176 | + [ |
| 1177 | + pytest.param( |
| 1178 | + 115698.25, |
| 1179 | + marks=pytest.mark.skipif( |
| 1180 | + GDAL_GE_3_11, |
| 1181 | + reason="GDAL 3.10 and earlier used METHOD=GCP_POLYNOMIAL by default", |
| 1182 | + ), |
| 1183 | + ), |
| 1184 | + pytest.param( |
| 1185 | + 115698.0, |
| 1186 | + marks=pytest.mark.skipif( |
| 1187 | + not GDAL_GE_3_11, |
| 1188 | + reason="GDAL 3.11+ uses METHOD=GCP_HOMOGRAPHY by default if 4 or 5 GCPs (https://github.com/OSGeo/gdal/pull/11949)", |
| 1189 | + ), |
| 1190 | + ), |
| 1191 | + ], |
| 1192 | +) |
| 1193 | +def test_reproject__gcps_kwargs(tmp_path, affine_c_param): |
1174 | 1194 | tiffname = tmp_path / "test.tif" |
1175 | 1195 | src_gcps = [ |
1176 | 1196 | GroundControlPoint(row=0, col=0, x=156113, y=2818720, z=0), |
@@ -1203,7 +1223,7 @@ def test_reproject__gcps_kwargs(tmp_path): |
1203 | 1223 | Affine( |
1204 | 1224 | 216.8587081056465, |
1205 | 1225 | 0.0, |
1206 | | - 115698.25, |
| 1226 | + affine_c_param, |
1207 | 1227 | 0.0, |
1208 | 1228 | -216.8587081056465, |
1209 | 1229 | 2818720.0, |
@@ -3222,7 +3242,26 @@ def test_rio_get_gcps(with_z): |
3222 | 3242 | assert gcp.info == gdal_gcp.info |
3223 | 3243 |
|
3224 | 3244 |
|
3225 | | -def test_reproject__gcps_file(tmp_path): |
| 3245 | +@pytest.mark.parametrize( |
| 3246 | + "affine_c_param", |
| 3247 | + [ |
| 3248 | + pytest.param( |
| 3249 | + 115698.25, |
| 3250 | + marks=pytest.mark.skipif( |
| 3251 | + GDAL_GE_3_11, |
| 3252 | + reason="GDAL 3.10 and earlier used METHOD=GCP_POLYNOMIAL by default", |
| 3253 | + ), |
| 3254 | + ), |
| 3255 | + pytest.param( |
| 3256 | + 115698.0, |
| 3257 | + marks=pytest.mark.skipif( |
| 3258 | + not GDAL_GE_3_11, |
| 3259 | + reason="GDAL 3.11+ uses METHOD=GCP_HOMOGRAPHY by default if 4 or 5 GCPs (https://github.com/OSGeo/gdal/pull/11949)", |
| 3260 | + ), |
| 3261 | + ), |
| 3262 | + ], |
| 3263 | +) |
| 3264 | +def test_reproject__gcps_file(tmp_path, affine_c_param): |
3226 | 3265 | tiffname = tmp_path / "test.tif" |
3227 | 3266 | src_gcps = [ |
3228 | 3267 | GroundControlPoint(row=0, col=0, x=156113, y=2818720, z=0), |
@@ -3253,7 +3292,7 @@ def test_reproject__gcps_file(tmp_path): |
3253 | 3292 | Affine( |
3254 | 3293 | 216.8587081056465, |
3255 | 3294 | 0.0, |
3256 | | - 115698.25, |
| 3295 | + affine_c_param, |
3257 | 3296 | 0.0, |
3258 | 3297 | -216.8587081056465, |
3259 | 3298 | 2818720.0, |
|
0 commit comments