diff --git a/CHANGES.txt b/CHANGES.txt index d0857e10..ee35d1c4 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,8 @@ Changes 1.1.5 (TBD) ------------------ +- The pixel shift in reads from datasets opened using the OVERVIEW_LEVEL + option, reported in the user discussion group and #1932, has been fixed (#). - Extend the signature of merge's method function (#1933). - MemoryFile implementation has been improved so that it can support multi-part S3 downloads (#1926). diff --git a/rasterio/_shim.pxd b/rasterio/_shim.pxd index 4305f04e..f7858ddd 100644 --- a/rasterio/_shim.pxd +++ b/rasterio/_shim.pxd @@ -2,9 +2,9 @@ include "gdal.pxi" cdef GDALDatasetH open_dataset(object filename, int mode, object allowed_drivers, object open_options, object siblings) except NULL cdef int delete_nodata_value(GDALRasterBandH hBand) except 3 -cdef int io_band(GDALRasterBandH band, int mode, float xoff, float yoff, float width, float height, object data, int resampling=*) except -1 -cdef int io_multi_band(GDALDatasetH hds, int mode, float xoff, float yoff, float width, float height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1 -cdef int io_multi_mask(GDALDatasetH hds, int mode, float xoff, float yoff, float width, float height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1 +cdef int io_band(GDALRasterBandH band, int mode, double xoff, double yoff, double width, double height, object data, int resampling=*) except -1 +cdef int io_multi_band(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1 +cdef int io_multi_mask(GDALDatasetH hds, int mode, double xoff, double yoff, double width, double height, object data, Py_ssize_t[:] indexes, int resampling=*) except -1 cdef const char* osr_get_name(OGRSpatialReferenceH hSrs) cdef void osr_set_traditional_axis_mapping_strategy(OGRSpatialReferenceH hSrs) cdef void set_proj_search_path(object path) diff --git a/rasterio/_shim1.pyx b/rasterio/_shim1.pyx index 1b5de864..14e1e636 100644 --- a/rasterio/_shim1.pyx +++ b/rasterio/_shim1.pyx @@ -47,8 +47,8 @@ cdef int delete_nodata_value(GDALRasterBandH hBand) except 3: cdef int io_band( - GDALRasterBandH band, int mode, float x0, float y0, - float width, float height, object data, int resampling=0) except -1: + GDALRasterBandH band, int mode, double x0, double y0, + double width, double height, object data, int resampling=0) except -1: """Read or write a region of data for the band. Implicit are @@ -83,8 +83,8 @@ cdef int io_band( cdef int io_multi_band( - GDALDatasetH hds, int mode, float x0, float y0, float width, - float height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: + GDALDatasetH hds, int mode, double x0, double y0, double width, + double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: """Read or write a region of data for multiple bands. Implicit are @@ -130,8 +130,8 @@ cdef int io_multi_band( cdef int io_multi_mask( - GDALDatasetH hds, int mode, float x0, float y0, float width, - float height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: + GDALDatasetH hds, int mode, double x0, double y0, double width, + double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: """Read or write a region of data for multiple band masks. Implicit are diff --git a/rasterio/shim_rasterioex.pxi b/rasterio/shim_rasterioex.pxi index 82122783..ba3d7c71 100644 --- a/rasterio/shim_rasterioex.pxi +++ b/rasterio/shim_rasterioex.pxi @@ -33,8 +33,8 @@ cdef extern from "gdal.h" nogil: cdef CPLErr GDALDatasetRasterIOEx(GDALDatasetH hDS, GDALRWFlag eRWFlag, int nDSXOff, int nDSYOff, int nDSXSize, int nDSYSize, void *pBuffer, int nBXSize, int nBYSize, GDALDataType eBDataType, int nBandCount, int *panBandCount, GSpacing nPixelSpace, GSpacing nLineSpace, GSpacing nBandSpace, GDALRasterIOExtraArg *psExtraArg) -cdef int io_band(GDALRasterBandH band, int mode, float x0, float y0, - float width, float height, object data, int resampling=0) except -1: +cdef int io_band(GDALRasterBandH band, int mode, double x0, double y0, + double width, double height, object data, int resampling=0) except -1: """Read or write a region of data for the band. Implicit are @@ -83,8 +83,8 @@ cdef int io_band(GDALRasterBandH band, int mode, float x0, float y0, return exc_wrap_int(retval) -cdef int io_multi_band(GDALDatasetH hds, int mode, float x0, float y0, - float width, float height, object data, +cdef int io_multi_band(GDALDatasetH hds, int mode, double x0, double y0, + double width, double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: """Read or write a region of data for multiple bands. @@ -145,8 +145,8 @@ cdef int io_multi_band(GDALDatasetH hds, int mode, float x0, float y0, CPLFree(bandmap) -cdef int io_multi_mask(GDALDatasetH hds, int mode, float x0, float y0, - float width, float height, object data, +cdef int io_multi_mask(GDALDatasetH hds, int mode, double x0, double y0, + double width, double height, object data, Py_ssize_t[:] indexes, int resampling=0) except -1: """Read or write a region of data for multiple band masks. diff --git a/tests/test_rio_merge.py b/tests/test_rio_merge.py index 2aac3ab3..7d8c6706 100644 --- a/tests/test_rio_merge.py +++ b/tests/test_rio_merge.py @@ -16,7 +16,7 @@ from rasterio.merge import merge from rasterio.rio.main import main_group from rasterio.transform import Affine -from .conftest import requires_gdal22 +from .conftest import requires_gdal22, gdal_version # Fixture to create test datasets within temporary directory @@ -478,6 +478,10 @@ def test_merge_tiny_res_bounds(tiffs): assert data[0, 1, 1] == 0 +@pytest.mark.xfail( + gdal_version.major == 1, + reason="GDAL versions < 2 do not support data read/write with float sizes and offsets", +) def test_merge_rgb(tmpdir): """Get back original image""" outputname = str(tmpdir.join('merged.tif')) @@ -501,6 +505,10 @@ def test_merge_tiny_intres(tiffs): merge(datasets, res=2) +@pytest.mark.xfail( + gdal_version.major == 1, + reason="GDAL versions < 2 do not support data read/write with float sizes and offsets", +) @pytest.mark.parametrize("precision", [[], ["--precision", "9"]]) def test_merge_precision(tmpdir, precision): """See https://github.com/mapbox/rasterio/issues/1837"""