Skip to content

Commit

Permalink
Handle a warning, reformat, cleanup, version bump, and changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Gillies committed Dec 4, 2019
1 parent 0953bfe commit d8a3f3f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
CHANGES

1.0.0 (2019-12-04)
------------------
- Rasterio's NodataShadowWarning is handled in the mask reading tests.
- Unused imports were removed from the setup script.
- Rasterio version ~= 1.0 is specified in the setup requirements.

1.0b1 (2019-12-03)
------------------
- This module now relies on a rasterio dataset's dataset_mask method. The
Expand Down
2 changes: 1 addition & 1 deletion rio_hist/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging


__version__ = "1.0b1"
__version__ = "1.0.0"

log = logging.getLogger(__name__)
log.addHandler(logging.NullHandler())
5 changes: 2 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os
import sys
from setuptools import setup, find_packages
from setuptools.extension import Extension

# Parse the version from the fiona module.
with open('rio_hist/__init__.py') as f:
Expand All @@ -20,6 +18,7 @@
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()


setup(name='rio-hist',
version=version,
description=u"Histogram matching plugin for rasterio",
Expand All @@ -33,7 +32,7 @@ def read(fname):
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=["click", "rasterio", "rio_color>=0.4"],
install_requires=["click", "rasterio~=1.0", "rio_color>=0.4"],
extras_require={
'plot': ['matplotlib'],
'test': ['pytest', 'pytest-cov', 'codecov']},
Expand Down
14 changes: 12 additions & 2 deletions tests/test_read_mask.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from affine import Affine
import numpy as np
import pytest
import rasterio
from affine import Affine
from rasterio.errors import NodataShadowWarning

from rio_hist.utils import read_mask


Expand Down Expand Up @@ -115,17 +118,22 @@ def test_no_ndv():
with rasterio.open('/tmp/rgb_no_ndv.tif') as src:
assert np.array_equal(read_mask(src), alldata)


def test_rgb_ndv():
with rasterio.open('/tmp/rgb_ndv.tif') as src:
assert np.array_equal(read_mask(src), alp)


def test_rgba_no_ndv():
with rasterio.open('/tmp/rgba_no_ndv.tif') as src:
assert np.array_equal(read_mask(src), alp)


def test_rgba_ndv():
with rasterio.open('/tmp/rgba_ndv.tif') as src:
assert np.array_equal(read_mask(src), alp)
with pytest.warns(NodataShadowWarning):
assert np.array_equal(read_mask(src), alp)


def test_rgb_msk():
with rasterio.open('/tmp/rgb_msk.tif') as src:
Expand All @@ -134,10 +142,12 @@ def test_rgb_msk():
for bmask in src.read_masks():
assert np.array_equal(bmask, msk)


def test_rgb_msk_int():
with rasterio.open('/tmp/rgb_msk_internal.tif') as src:
assert np.array_equal(read_mask(src), msk)


def test_rgba_msk():
with rasterio.open('/tmp/rgba_msk.tif') as src:
# mask takes precendent over alpha
Expand Down

0 comments on commit d8a3f3f

Please sign in to comment.