[rasterio] 01/03: Imported Upstream version 0.29.0

Johan Van de Wauw johanvdw-guest at moszumanska.debian.org
Mon Oct 26 10:19:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

johanvdw-guest pushed a commit to branch master
in repository rasterio.

commit 6bf9f19310b630d429e5bd3d82bc37392dc3bbe7
Author: Johan Van de Wauw <johan at vandewauw.be>
Date:   Mon Oct 26 11:03:51 2015 +0100

    Imported Upstream version 0.29.0
---
 .travis.yml                    |  13 +++++-
 CHANGES.txt                    |   9 ++++
 CODE_OF_CONDUCT.md             |  22 ++++++++++
 rasterio/__init__.py           |   2 +-
 rasterio/_base.pyx             |  15 +++++--
 rasterio/rio/calc.py           |   5 ++-
 rasterio/rio/merge.py          |   1 +
 rasterio/rio/options.py        |   2 +
 requirements-dev.txt           |   2 +-
 requirements.txt               |   2 +-
 scripts/travis_gdal_install.sh |  91 +++++++++++++++++++++++++++++++++++++++++
 setup.py                       |   7 +---
 tests/data/shade.tif           | Bin 1050093 -> 1050234 bytes
 tests/test_options.py          |   2 +-
 tests/test_profile.py          |  21 ++++++++--
 15 files changed, 174 insertions(+), 20 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 955a27d..dbe6503 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,11 +2,18 @@ language: python
 sudo: false
 cache:
   directories:
+    - $GDALINST
     - ~/.cache/pip
 env:
   global:
     - PIP_WHEEL_DIR=$HOME/.cache/pip/wheels
     - PIP_FIND_LINKS=file://$HOME/.cache/pip/wheels
+    - GDALINST=$HOME/gdalinstall
+    - GDALBUILD=$HOME/gdalbuild
+  matrix:
+    - GDALVERSION = "1.9.2"
+    - GDALVERSION = "1.11.2"
+      #- GDALVERSION = "2.0.1"
 addons:
   apt:
     packages:
@@ -23,12 +30,16 @@ python:
 before_install:
   - pip install -U pip
   - pip install wheel
+  - . ./scripts/travis_gdal_install.sh
+  - export PATH=$GDALINST/gdal-$GDALVERSION/bin:$PATH
+  - export LD_LIBRARY_PATH=$GDALINST/gdal-$GDALVERSION/lib:$LD_LIBRARY_PATH
 install:
   - "pip wheel -r requirements-dev.txt"
   - "pip install -r requirements-dev.txt"
+  - "pip install --upgrade --force-reinstall --global-option=build_ext --global-option='-I$GDALINST/gdal-$GDALVERSION/include' --global-option='-L$GDALINST/gdal-$GDALVERSION/lib' --global-option='-R$GDALINST/gdal-$GDALVERSION/lib' -e ."
   - "pip install coveralls"
   - "pip install -e ."
-script: 
+script:
   - py.test --cov rasterio --cov-report term-missing
 after_success:
   - coveralls
diff --git a/CHANGES.txt b/CHANGES.txt
index 03326b6..4f28341 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,15 @@
 Changes
 =======
 
+0.29.0 (2015-10-22)
+-------------------
+- Fill masked arrays in rio-calc when using Numpy 1.10.x as well as with 1.8.x
+  (#500).
+- When a raster dataset is not tiled, blockxszie and blockysize items are no
+  longer included in its `profile` property. This prevents meaningless block
+  size parameters from stripped, not tiled, datasets from being used when
+  creating new datasets (#503).
+
 0.28.0 (2015-10-06)
 -------------------
 - Ensure that tools module is packaged (#489, #490). The rio-merge command was
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..01b8644
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,22 @@
+# Contributor Code of Conduct
+
+As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery
+* Personal attacks
+* Trolling or insulting/derogatory comments
+* Public or private harassment
+* Publishing other's private information, such as physical or electronic addresses, without explicit permission
+* Other unethical or unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
+
+This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
diff --git a/rasterio/__init__.py b/rasterio/__init__.py
index 0460125..43a7b26 100644
--- a/rasterio/__init__.py
+++ b/rasterio/__init__.py
@@ -23,7 +23,7 @@ from rasterio import _err, coords, enums
 
 __all__ = [
     'band', 'open', 'drivers', 'copy', 'pad']
-__version__ = "0.28.0"
+__version__ = "0.29.0"
 
 log = logging.getLogger('rasterio')
 class NullHandler(logging.Handler):
diff --git a/rasterio/_base.pyx b/rasterio/_base.pyx
index a5ef369..04f454d 100644
--- a/rasterio/_base.pyx
+++ b/rasterio/_base.pyx
@@ -448,6 +448,10 @@ cdef class DatasetReader(object):
         else:
             return None
 
+    @property
+    def is_tiled(self):
+        return self.block_shapes[0][1] != self.width
+
     property profile:
         """Basic metadata and creation options of this dataset.
 
@@ -457,10 +461,13 @@ cdef class DatasetReader(object):
         def __get__(self):
             m = self.meta
             m.update(self.tags(ns='rio_creation_kwds'))
-            m.update(
-                blockxsize=self.block_shapes[0][1],
-                blockysize=self.block_shapes[0][0],
-                tiled=self.block_shapes[0][1] != self.width)
+            if self.is_tiled:
+                m.update(
+                    blockxsize=self.block_shapes[0][1],
+                    blockysize=self.block_shapes[0][0],
+                    tiled=True)
+            else:
+                m.update(tiled=False)
             if self.compression:
                 m['compress'] = self.compression.name
             if self.interleaving:
diff --git a/rasterio/rio/calc.py b/rasterio/rio/calc.py
index 7018174..b9df4ff 100644
--- a/rasterio/rio/calc.py
+++ b/rasterio/rio/calc.py
@@ -123,8 +123,9 @@ def calc(ctx, command, files, output, name, dtype, masked, creation_options):
 
             res = snuggs.eval(command, **ctxkwds)
 
-            if (isinstance(res, np.ma.core.MaskedArray) and
-                    tuple(LooseVersion(np.__version__).version) < (1, 9, 0)):
+            if (isinstance(res, np.ma.core.MaskedArray) and (
+                    tuple(LooseVersion(np.__version__).version) < (1, 9) or
+                    tuple(LooseVersion(np.__version__).version) > (1, 10))):
                 res = res.filled(kwargs['nodata'])
 
             if len(res.shape) == 3:
diff --git a/rasterio/rio/merge.py b/rasterio/rio/merge.py
index d816ac7..5e637c8 100644
--- a/rasterio/rio/merge.py
+++ b/rasterio/rio/merge.py
@@ -73,6 +73,7 @@ def merge(ctx, files, output, driver, bounds, res, nodata, force_overwrite,
     profile['height'] = dest.shape[1]
     profile['width'] = dest.shape[2]
     profile['driver'] = driver
+
     profile.update(**creation_options)
 
     with rasterio.open(output, 'w', **profile) as dst:
diff --git a/rasterio/rio/options.py b/rasterio/rio/options.py
index 0e5aeb8..dfccd54 100644
--- a/rasterio/rio/options.py
+++ b/rasterio/rio/options.py
@@ -73,6 +73,8 @@ def _cb_key_val(ctx, param, value):
                 raise click.BadParameter("Invalid syntax for KEY=VAL arg: {}".format(pair))
             else:
                 k, v = pair.split('=', 1)
+                k = k.lower()
+                v = v.lower()
                 out[k] = v
 
         return out
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 563cdc1..b9e2dd1 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -4,7 +4,7 @@ coveralls>=0.4
 cython>=0.23.1
 delocate
 enum34
-numpy>=1.8.0
+numpy>=1.8
 snuggs>=1.2
 pytest
 pytest-cov
diff --git a/requirements.txt b/requirements.txt
index 0b59530..9071810 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
 affine
 cligj
 enum34
-numpy>=1.8.0
+numpy>=1.8
 snuggs>=1.2
 setuptools
diff --git a/scripts/travis_gdal_install.sh b/scripts/travis_gdal_install.sh
new file mode 100644
index 0000000..022dfd8
--- /dev/null
+++ b/scripts/travis_gdal_install.sh
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# originally contributed by @rbuffat to Toblerity/Fiona
+set -ex
+
+GDALOPTS="  --with-ogr \
+            --with-geos \
+            --with-expat \
+            --without-libtool \
+            --with-libz=internal \
+            --with-libtiff=internal \
+            --with-geotiff=internal \
+            --without-gif \
+            --without-pg \
+            --without-grass \
+            --without-libgrass \
+            --without-cfitsio \
+            --without-pcraster \
+            --without-netcdf \
+            --without-png \
+            --with-jpeg=internal \
+            --without-gif \
+            --without-ogdi \
+            --without-fme \
+            --without-hdf4 \
+            --without-hdf5 \
+            --without-jasper \
+            --without-ecw \
+            --without-kakadu \
+            --without-mrsid \
+            --without-jp2mrsid \
+            --without-bsb \
+            --without-grib \
+            --without-mysql \
+            --without-ingres \
+            --without-xerces \
+            --without-odbc \
+            --without-curl \
+            --without-sqlite3 \
+            --without-dwgdirect \
+            --without-idb \
+            --without-sde \
+            --without-perl \
+            --without-php \
+            --without-ruby \
+            --without-python"
+
+# Create build dir if not exists
+if [ ! -d "$GDALBUILD" ]; then
+  mkdir $GDALBUILD;
+fi
+
+if [ ! -d "$GDALINST" ]; then
+  mkdir $GDALINST;
+fi
+
+ls -l $GDALINST
+
+# download and compile gdal version
+if [ ! -d $GDALINST/gdal-1.9.2 ]; then
+  cd $GDALBUILD
+  wget http://download.osgeo.org/gdal/gdal-1.9.2.tar.gz
+  tar -xzf gdal-1.9.2.tar.gz
+  cd gdal-1.9.2
+  ./configure --prefix=$GDALINST/gdal-1.9.2 $GDALOPTS
+  make -s -j 2
+  make install
+fi
+
+if [ ! -d $GDALINST/gdal-1.11.2 ]; then
+  cd $GDALBUILD
+  wget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gz
+  tar -xzf gdal-1.11.2.tar.gz
+  cd gdal-1.11.2
+  ./configure --prefix=$GDALINST/gdal-1.11.2 $GDALOPTS
+  make -s -j 2
+  make install
+fi
+
+if [ ! -d $GDALINST/gdal-2.0.1 ]; then
+  cd $GDALBUILD
+  wget http://download.osgeo.org/gdal/2.0.1/gdal-2.0.1.tar.gz
+  tar -xzf gdal-2.0.1.tar.gz
+  cd gdal-2.0.1
+  ./configure --prefix=$GDALINST/gdal-2.0.1 $GDALOPTS
+  make -s -j 2
+  make install
+fi
+
+# change back to travis build dir
+cd $TRAVIS_BUILD_DIR
diff --git a/setup.py b/setup.py
index ed3b07f..0cefec9 100755
--- a/setup.py
+++ b/setup.py
@@ -193,12 +193,7 @@ with open('README.rst') as f:
     readme = f.read()
 
 # Runtime requirements.
-inst_reqs = [
-    'affine>=1.0',
-    'cligj>=0.2.0',
-    'Numpy>=1.7',
-    'snuggs>=1.3.1',
-    'click-plugins']
+inst_reqs = ['affine', 'cligj', 'numpy', 'snuggs', 'click-plugins']
 
 if sys.version_info < (3, 4):
     inst_reqs.append('enum34')
diff --git a/tests/data/shade.tif b/tests/data/shade.tif
index 6a5a226..9ea0f3f 100644
Binary files a/tests/data/shade.tif and b/tests/data/shade.tif differ
diff --git a/tests/test_options.py b/tests/test_options.py
index 38ee698..03bb15d 100644
--- a/tests/test_options.py
+++ b/tests/test_options.py
@@ -7,7 +7,7 @@ def test_cb_key_val():
 
     pairs = ['KEY=val', '1==']
     expected = {
-        'KEY': 'val',
+        'key': 'val',
         '1': '=',
     }
     assert options._cb_key_val(None, None, pairs) == expected
diff --git a/tests/test_profile.py b/tests/test_profile.py
index 32979c4..07cc2cf 100644
--- a/tests/test_profile.py
+++ b/tests/test_profile.py
@@ -79,11 +79,26 @@ def test_profile_overlay():
     assert kwds['count'] == 3
 
 
-def test_dataset_profile_property(data):
+def test_dataset_profile_property_tiled(data):
+    """An tiled dataset's profile has block sizes"""
+    with rasterio.open('tests/data/shade.tif') as src:
+        assert src.profile['blockxsize'] == 256
+        assert src.profile['blockysize'] == 256
+        assert src.profile['tiled'] == True
+
+
+def test_dataset_profile_property_untiled(data):
+    """An untiled dataset's profile has no block sizes"""
+    with rasterio.open('tests/data/RGB.byte.tif') as src:
+        assert 'blockxsize' not in src.profile
+        assert 'blockysize' not in src.profile
+        assert src.profile['tiled'] == False
+
+
+def test_dataset_profile_creation_kwds(data):
+    """Updated creation keyword tags appear in profile"""
     tiffile = str(data.join('RGB.byte.tif'))
     with rasterio.open(tiffile, 'r+') as src:
         src.update_tags(ns='rio_creation_kwds', foo='bar')
-        assert src.profile['blockxsize'] == 791
-        assert src.profile['blockysize'] == 3
         assert src.profile['tiled'] == False
         assert src.profile['foo'] == 'bar'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/rasterio.git



More information about the Pkg-grass-devel mailing list