Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve numpy deprection warnings #680

Merged
merged 1 commit into from May 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions rasterio/_io.pyx
Expand Up @@ -861,9 +861,9 @@ cdef class RasterReader(_base.DatasetReader):
roff = 0
coff = 0
if window[0][0] < 0:
roff = -window[0][0] * scaling_h
roff = int(-window[0][0] * scaling_h)
if window[1][0] < 0:
coff = -window[1][0] * scaling_w
coff = int(-window[1][0] * scaling_w)

for dst, src in zip(
out if len(out.shape) == 3 else [out],
Expand Down
15 changes: 15 additions & 0 deletions tests/test_read_boundless.py
Expand Up @@ -2,6 +2,7 @@
import sys

import numpy
import pytest

import rasterio

Expand Down Expand Up @@ -101,3 +102,17 @@ def test_read_boundless_noshift():
r2 = src.read(boundless=True,
window=((-1, src.shape[0] + 1), (100, 101)))[0, 0, 0:9]
assert numpy.array_equal(r1, r2)


def test_numpy_warning(recwarn):
"""Ensure no deprecation warnings
On numpy 1.11 and previous versions of rasterio you might see:
VisibleDeprecationWarning: using a non-integer number
instead of an integer will result in an error in the future
"""
import warnings
warnings.simplefilter('always')
with rasterio.open('tests/data/RGB.byte.tif') as src:
window = ((-10, 100), (-10, 100))
src.read(1, window=window, boundless=True)
assert len(recwarn) == 0