Fix type mismatch (#1938)

* Fix types

* Fix one more type mismatch, xfail 2 tests for GDAL < 2

Resolves #1932

Co-authored-by: Denis Rykov <rykovd@gmail.com>
This commit is contained in:
Sean Gillies 2020-05-30 10:49:00 -06:00 committed by GitHub
parent 8b5613572c
commit 15d8dd7592
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 16 deletions

View File

@ -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).

View File

@ -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)

View File

@ -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

View File

@ -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.

View File

@ -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"""