Skip to content

New homography transform type breaks test_warpedvrt.test_warpedvrt_gcps__width_height #3321

@schwehr

Description

@schwehr

OSGeo/gdal#11949

Expected behavior and actual behavior.

Tests pass in our unusual google3 test environment.

Steps to reproduce the problem.

Use GDAL from head (at OSGeo/gdal@d8e3962 or newer) and rasterio at 7f8bda2

Environment Information

Rasterio:

  • version: "7f8bda2e32df5b5eefc6e1ea6b5f04a946567ede"
  • closest_version: "1.4.3"
  • python 3.11
  • debian testing derived linux / google3 / bazel build

Installation Method

copybara

Test failure:

test_warpedvrt.test_warpedvrt_gcps__width_height

AssertionError: assert False
 +  where False = <bound method Affine.almost_equals of Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0)>(Affine(22271.389322449897, 0.0, 115698.25,\n       0.0, -20016.05875815117, 2818720.0))
 +    where <bound method Affine.almost_equals of Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0)> = Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0).almost_equals
 +      where Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0) = <open WarpedVRT name='WarpedVRT(/tmp/pytest-of-forge-00/pytest-0/test_warpedvrt_gcps__width_hei0/test.tif)' mode='r'>.dst_transform
 +    and   Affine(22271.389322449897, 0.0, 115698.25,\n       0.0, -20016.05875815117, 2818720.0) = <class 'affine.Affine'>(22271.389322449897, 0.0, 115698.25, 0.0, -20016.05875815117, 2818720.0)
 +      where <class 'affine.Affine'> = affine.Affine
tmp_path = PosixPath('/tmp/pytest-of-forge-00/pytest-0/test_warpedvrt_gcps__width_hei0')

    def test_warpedvrt_gcps__width_height(tmp_path):
        tiffname = tmp_path / "test.tif"
        src_gcps = [
            GroundControlPoint(row=0, col=0, x=156113, y=2818720, z=0),
            GroundControlPoint(row=0, col=800, x=338353, y=2785790, z=0),
            GroundControlPoint(row=800, col=800, x=297939, y=2618518, z=0),
            GroundControlPoint(row=800, col=0, x=115698, y=2651448, z=0),
        ]
        crs = CRS.from_epsg(32618)
        with rasterio.open(tiffname, mode='w', height=800, width=800, count=3, dtype=numpy.uint8) as source:
            source.gcps = (src_gcps, crs)
    
        with rasterio.open(tiffname) as src:
            with WarpedVRT(src, width=10, height=10) as vrt:
                assert vrt.height == 10
                assert vrt.width == 10
                assert vrt.crs == crs
>               assert vrt.dst_transform.almost_equals(
                    affine.Affine(22271.389322449897, 0.0, 115698.25, 0.0, -20016.05875815117, 2818720.0)
                )
E               AssertionError: assert False
E                +  where False = <bound method Affine.almost_equals of Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0)>(Affine(22271.389322449897, 0.0, 115698.25,\n       0.0, -20016.05875815117, 2818720.0))
E                +    where <bound method Affine.almost_equals of Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0)> = Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0).almost_equals
E                +      where Affine(22271.389322449897, 0.0, 115698.00000000003,\n       0.0, -20016.05875815117, 2818720.0) = <open WarpedVRT name='WarpedVRT(/tmp/pytest-of-forge-00/pytest-0/test_warpedvrt_gcps__width_hei0/test.tif)' mode='r'>.dst_transform
E                +    and   Affine(22271.389322449897, 0.0, 115698.25,\n       0.0, -20016.05875815117, 2818720.0) = <class 'affine.Affine'>(22271.389322449897, 0.0, 115698.25, 0.0, -20016.05875815117, 2818720.0)
E                +      where <class 'affine.Affine'> = affine.Affine

tests/test_warpedvrt.py:657: AssertionError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions