[Git][debian-gis-team/rasterio][master] 4 commits: New upstream version 1.0.21

Bas Couwenberg gitlab at salsa.debian.org
Fri Mar 1 06:00:55 GMT 2019


Bas Couwenberg pushed to branch master at Debian GIS Project / rasterio


Commits:
0582ad60 by Bas Couwenberg at 2019-03-01T05:45:39Z
New upstream version 1.0.21
- - - - -
9934f04f by Bas Couwenberg at 2019-03-01T05:45:44Z
Merge tag 'upstream/1.0.21'

Upstream version 1.0.21

- - - - -
e6108d0c by Bas Couwenberg at 2019-03-01T05:46:35Z
New upstream release.

- - - - -
c236461e by Bas Couwenberg at 2019-03-01T05:47:13Z
Set distribution to unstable.

- - - - -


19 changed files:

- CHANGES.txt
- README.rst
- debian/changelog
- − docs/faq.rst
- docs/index.rst
- docs/quickstart.rst
- docs/topics/masking-by-shapefile.rst
- docs/topics/migrating-to-v1.rst
- docs/topics/windowed-rw.rst
- rasterio/__init__.py
- rasterio/_base.pyx
- rasterio/crs.py
- rasterio/gdal.pxi
- rasterio/merge.py
- rasterio/windows.py
- tests/conftest.py
- tests/test_crs.py
- tests/test_memoryfile.py
- tests/test_write.py


Changes:

=====================================
CHANGES.txt
=====================================
@@ -1,6 +1,11 @@
 Changes
 =======
 
+1.0.21 (2019-02-28)
+-------------------
+
+- Fix for bug in implementation of the pickle protocol (#1643).
+
 1.0.20 (2019-02-27)
 -------------------
 


=====================================
README.rst
=====================================
@@ -195,7 +195,7 @@ Linux
 Rasterio distributions are available from UbuntuGIS and Anaconda's conda-forge
 channel.
 
-`Manylinux1 <https://github.com/pypa/manylinux>`__ wheels are available on PyPI.
+`Manylinux1 <https://github.com/pypa/manylinux>`__ wheels are available on PyPI.```
 
 OS X
 ++++


=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+rasterio (1.0.21-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org>  Fri, 01 Mar 2019 06:47:05 +0100
+
 rasterio (1.0.20-1) unstable; urgency=medium
 
   * Team upload.


=====================================
docs/faq.rst deleted
=====================================
@@ -1,46 +0,0 @@
-Frequently Asked Questions
-==========================
-
-Where is "ERROR 4: Unable to open EPSG support file gcs.csv" coming from and what does it mean?
------------------------------------------------------------------------------------------------
-
-The full message is "ERROR 4: Unable to open EPSG support file gcs.csv.  Try
-setting the GDAL_DATA environment variable to point to the directory containing
-EPSG csv files." The GDAL/OGR library prints this text to your process's stdout
-stream when it can not find the gcs.csv data file it needs to interpret spatial
-reference system information stored with a dataset. If you've never seen this
-before, you can summon this message by setting GDAL_DATA to a bogus value in
-your shell and running a command like ogrinfo:
-
-.. code-block:: console
-
-    $ GDAL_DATA="/path/to/nowhere" ogrinfo example.shp -so example
-    INFO: Open of 'example.shp'
-          using driver 'ESRI Shapefile' successful.
-
-    Layer name: example
-    Geometry: Polygon
-    Feature Count: 67
-    Extent: (-113.564247, 37.068981) - (-104.970871, 41.996277)
-    ERROR 4: Unable to open EPSG support file gcs.csv.  Try setting the GDAL_DATA environment variable to point to the directory containing EPSG csv files.
-
-If you're using GDAL software installed by a package management system like apt
-or yum, or Homebrew, or if you've built and installed it using ``configure;
-make; make install``, you don't need to set the GDAL_DATA environment variable.
-That software has the right directory path built in. If you see this error,
-it's likely a sign that GDAL_DATA is set to a bogus value. Unset GDAL_DATA if
-it exists and see if that eliminates the error condition and the message.
-
-If you're installing GDAL into a Conda environment or into a Python virtual
-environment (remember that the Rasterio wheels on the Python Package Index
-include a GDAL library and its data files) the situation is different. The
-proper data directory path is not built in and GDAL_DATA must be set.
-
-Rasterio 1.0.18, whether from PyPI or Conda, will set the GDAL_DATA environment
-variable to the correct location when it is imported, but only if it has not
-already been set. Previous versions of Rasterio tried to avoid patching the
-environment of the process, but there's really no better option.
-
-Get the latest version of Rasterio, 1.0.18, and use it without setting
-GDAL_DATA. You shouldn't experience the error condition or the message about
-it.


=====================================
docs/index.rst
=====================================
@@ -51,7 +51,6 @@ Rasterio supports Python versions 2.7 and 3.3 or higher.
    topics/index
    api/index
    contributing
-   faq
 
 Indices and Tables
 ==================


=====================================
docs/quickstart.rst
=====================================
@@ -194,7 +194,7 @@ dataset's upper left corner, do the following.
     >>> row, col = dataset.index(x, y)
     >>> row, col
     (1666, 3333)
-    >>> band1[row, col]
+    >>> band_one[row, col]
     7566
 
 To get the spatial coordinates of a pixel, use the dataset's ``xy()`` method.


=====================================
docs/topics/masking-by-shapefile.rst
=====================================
@@ -9,15 +9,16 @@ Using ``rasterio`` with ``fiona``, it is simple to open a shapefile, read geomet
         import rasterio.mask
 
         with fiona.open("tests/data/box.shp", "r") as shapefile:
-            shapes = [feature["geometry"] for feature in shapefile] 
+            features = [feature["geometry"] for feature in shapefile] 
 
 This shapefile contains a single polygon, a box near the center of the raster, so in this case, our list of features is one element long.
 
 .. code-block:: python
 
         with rasterio.open("tests/data/RGB.byte.tif") as src:
-            out_image, out_transform = rasterio.mask.mask(src, shapes, crop=True)
-            out_meta = src.meta
+            out_image, out_transform = rasterio.mask.mask(src, features,
+                                                                crop=True)
+            out_meta = src.meta.copy()
 
 Using ``plot`` and ``imshow`` from ``matplotlib``, we can see the region defined by the shapefile in red overlaid on the original raster.
 
@@ -31,7 +32,6 @@ Applying the features in the shapefile as a mask on the raster sets all pixels o
                          "height": out_image.shape[1],
                          "width": out_image.shape[2],
                          "transform": out_transform})
-
         with rasterio.open("RGB.byte.masked.tif", "w", **out_meta) as dest:
             dest.write(out_image) 
 


=====================================
docs/topics/migrating-to-v1.rst
=====================================
@@ -171,7 +171,7 @@ Tickets
 ```````
 
 * `#284 <https://github.com/mapbox/rasterio/pull/284>`__ - Deprecation of
-  ``src.read_mask()``.
+  ``src.read_masks()``.
 
 
 Moved: Functions for working with dataset windows
@@ -263,4 +263,4 @@ Creation Options
 
 Rasterio no longer saves dataset creation options to the metadata of created
 datasets and will ignore such metadata starting in version 1.0. Users may opt
-in to this by setting RIO_IGNORE_CREATION_KWDS=TRUE in their environments.
+in to this by setting RIO_IGNORE_CREATION_KWDS=TRUE in their environments.
\ No newline at end of file


=====================================
docs/topics/windowed-rw.rst
=====================================
@@ -37,6 +37,7 @@ and open-ended slices may be used.
    Window.from_slices(slice(10, -10), slice(10, -10), height=100, width=100)
    # Window(col_off=10, row_off=10, width=80, height=80)
 
+
 Reading
 -------
 
@@ -114,7 +115,7 @@ a dataset:
     from rasterio.windows import get_data_window
 
     with rasterio.open('tests/data/RGB.byte.tif') as src:
-        window = get_data_window(src.read(1, masked=True))
+        window - get_data_window(src.read(1, masked-True))
         # window = Window(col_off=13, row_off=3, width=757, height=711)
 
         kwargs = src.meta.copy()
@@ -126,29 +127,6 @@ a dataset:
         with rasterio.open('/tmp/cropped.tif', 'w', **kwargs) as dst:
             dst.write(src.read(window=window))
 
-Window transforms
------------------
-
-The affine transform of a window can be accessed using a dataset's
-``window_transform`` method:
-
-.. code-block:: pycon
-
-    >>> import rasterio
-    >>> from rasterio.windows import Window
-    >>> win = Window(256, 256, 128, 128)
-    >>> with rasterio.open('tests/data/RGB.byte.tif') as src:
-    ...     src_transform = src.transform
-    ...     win_transform = src.window_transform(win)
-    ...
-    >>> print(src_transform)
-    | 300.04, 0.00, 101985.00|
-    | 0.00,-300.04, 2826915.00|
-    | 0.00, 0.00, 1.00|
-    >>> print(win_transform)
-    | 300.04, 0.00, 178794.71|
-    | 0.00,-300.04, 2750104.30|
-    | 0.00, 0.00, 1.00|
 
 Window utilities
 ----------------


=====================================
rasterio/__init__.py
=====================================
@@ -42,7 +42,7 @@ import rasterio.path
 
 
 __all__ = ['band', 'open', 'pad', 'Env']
-__version__ = "1.0.20"
+__version__ = "1.0.21"
 __gdal_version__ = gdal_version()
 
 # Rasterio attaches NullHandler to the 'rasterio' logger and its


=====================================
rasterio/_base.pyx
=====================================
@@ -1099,7 +1099,7 @@ cdef class DatasetBase(object):
             if color == NULL:
                 log.warn("NULL color at %d, skipping", i)
                 continue
-            log.debug(
+            log.info(
                 "Color: (%d, %d, %d, %d)",
                 color.c1, color.c2, color.c3, color.c4)
             retval[i] = (color.c1, color.c2, color.c3, color.c4)


=====================================
rasterio/crs.py
=====================================
@@ -12,6 +12,7 @@ used.
 
 import collections
 import json
+import pickle
 
 from rasterio._crs import _CRS, all_proj_keys
 from rasterio.compat import string_types
@@ -90,11 +91,16 @@ class CRS(collections.Mapping):
         return (self._crs == other._crs)
 
     def __getstate__(self):
-        return self.wkt
+        return self.to_wkt()
 
     def __setstate__(self, state):
+        self._wkt = None
+        self._data = None
         self._crs = _CRS.from_wkt(state)
 
+    def __copy__(self):
+        return pickle.loads(pickle.dumps(self))
+
     def to_proj4(self):
         """Convert CRS to a PROJ4 string
 


=====================================
rasterio/gdal.pxi
=====================================
@@ -91,6 +91,7 @@ cdef extern from "ogr_srs_api.h" nogil:
     OGRSpatialReferenceH OSRClone(OGRSpatialReferenceH srs)
     int OSRExportToProj4(OGRSpatialReferenceH srs, char **params)
     int OSRExportToWkt(OGRSpatialReferenceH srs, char **params)
+    int OSRFixup(OGRSpatialReferenceH srs)
     const char *OSRGetAuthorityName(OGRSpatialReferenceH srs, const char *key)
     const char *OSRGetAuthorityCode(OGRSpatialReferenceH srs, const char *key)
     int OSRImportFromEPSG(OGRSpatialReferenceH srs, int code)


=====================================
rasterio/merge.py
=====================================
@@ -43,8 +43,6 @@ def merge(datasets, bounds=None, res=None, nodata=None, precision=7, indexes=Non
     nodata: float, optional
         nodata value to use in output file. If not set, uses the nodata value
         in the first input raster.
-    precision: float, optional
-        Number of decimal points of precision when computing inverse transform.
     indexes : list of ints or a single int, optional
         bands to read and merge
 


=====================================
rasterio/windows.py
=====================================
@@ -639,8 +639,8 @@ class Window(object):
     def round_lengths(self, op='floor', pixel_precision=None):
         """Return a copy with width and height rounded.
 
-        Lengths are rounded to the preceding (floor) or succeeding (ceil)
-        whole number. The offsets are not changed.
+        Lengths are rounded to the nearest whole number. The offsets
+        are not changed.
 
         Parameters
         ----------
@@ -669,8 +669,8 @@ class Window(object):
     def round_offsets(self, op='floor', pixel_precision=None):
         """Return a copy with column and row offsets rounded.
 
-        Offsets are rounded to the preceding (floor) or succeeding (ceil)
-        whole number. The lengths are not changed.
+        Offsets are rounded to the nearest whole number. The lengths
+        are not changed.
 
         Parameters
         ----------


=====================================
tests/conftest.py
=====================================
@@ -475,19 +475,16 @@ def data_dir():
 
 @pytest.fixture(scope='session')
 def path_rgb_byte_tif(data_dir):
-    """The original RGB test fixture with no sidecar files"""
     return os.path.join(data_dir, 'RGB.byte.tif')
 
 
 @pytest.fixture(scope='session')
 def path_rgba_byte_tif(data_dir):
-    """Derived from RGB.byte.tif, this has an alpha band"""
     return os.path.join(data_dir, 'RGBA.byte.tif')
 
 
 @pytest.fixture(scope='session')
 def path_rgb_msk_byte_tif(data_dir):
-    """Derived from RGB.byte.tif, this has an external mask"""
     return os.path.join(data_dir, 'RGB2.byte.tif')
 
 


=====================================
tests/test_crs.py
=====================================
@@ -1,5 +1,6 @@
 """crs module tests"""
 
+import copy
 import json
 import logging
 import os
@@ -184,18 +185,6 @@ def test_is_projected():
     assert CRS(wgs84_crs).is_projected is False
 
 
- at requires_gdal21(reason="CRS equality is buggy pre-2.1")
- at pytest.mark.parametrize('epsg_code', [3857, 4326, 26913, 32618])
-def test_equality_from_epsg(epsg_code):
-    assert CRS.from_epsg(epsg_code) == CRS.from_epsg(epsg_code)
-
-
- at requires_gdal21(reason="CRS equality is buggy pre-2.1")
- at pytest.mark.parametrize('epsg_code', [3857, 4326, 26913, 32618])
-def test_equality_from_dict(epsg_code):
-    assert CRS.from_dict(init='epsg:{}'.format(epsg_code)) == CRS.from_dict(init='epsg:{}'.format(epsg_code))
-
-
 def test_is_same_crs():
     crs1 = CRS({'init': 'epsg:4326'})
     crs2 = CRS({'init': 'epsg:3857'})
@@ -457,3 +446,8 @@ def test_pickle(factory, arg):
 def test_linear_units():
     """CRS linear units can be had"""
     assert CRS.from_epsg(3857).linear_units == 'metre'
+
+
+def test_crs_copy():
+    """CRS can be copied"""
+    assert copy.copy(CRS.from_epsg(3857)).wkt.startswith('PROJCS["WGS 84 / Pseudo-Mercator",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84"')


=====================================
tests/test_memoryfile.py
=====================================
@@ -11,9 +11,7 @@ import pytest
 
 import rasterio
 from rasterio.io import MemoryFile, ZipMemoryFile
-from rasterio.enums import MaskFlags
 from rasterio.env import GDALVersion
-from rasterio.shutil import copyfiles
 
 
 # Skip ENTIRE module if not GDAL >= 2.x.
@@ -258,26 +256,3 @@ def test_write_plus_model_jpeg():
             assert (data[0] == 255).all()
             assert (data[1] == 204).all()
             assert (data[2] == 153).all()
-
-
-def test_memfile_copyfiles(path_rgb_msk_byte_tif):
-    """Multiple files can be copied to a MemoryFile using copyfiles"""
-    with rasterio.open(path_rgb_msk_byte_tif) as src:
-        src_basename = os.path.basename(src.name)
-        with MemoryFile(filename=src_basename) as memfile:
-            copyfiles(src.name, memfile.name)
-            with memfile.open() as rgb2:
-                assert sorted(rgb2.files) == sorted(['/vsimem/{}'.format(src_basename), '/vsimem/{}.msk'.format(src_basename)])
-
-
-def test_multi_memfile(path_rgb_msk_byte_tif):
-    """Multiple files can be copied to a MemoryFile using copyfiles"""
-    with open(path_rgb_msk_byte_tif, 'rb') as tif_fp:
-        tif_bytes = tif_fp.read()
-    with open(path_rgb_msk_byte_tif + '.msk', 'rb') as msk_fp:
-        msk_bytes = msk_fp.read()
-
-    with MemoryFile(tif_bytes, filename='foo.tif') as tifmemfile, MemoryFile(msk_bytes, filename='foo.tif.msk') as mskmemfile:
-        with tifmemfile.open() as src:
-            assert sorted(src.files) == sorted(['/vsimem/foo.tif', '/vsimem/foo.tif.msk'])
-            assert src.mask_flag_enums == ([MaskFlags.per_dataset],) * 3


=====================================
tests/test_write.py
=====================================
@@ -36,7 +36,10 @@ def test_validate_dtype_str(tmpdir):
 def test_validate_dtype_float128(tmpdir, basic_image):
     """Raise TypeError if dtype is unsupported by GDAL."""
     name = str(tmpdir.join('float128.tif'))
-    basic_image_f128 = basic_image.astype('float128')
+    try:
+        basic_image_f128 = basic_image.astype('float128')
+    except TypeError:
+        pytest.skip("Unsupported data type")
     height, width = basic_image_f128.shape
     with pytest.raises(TypeError):
         rasterio.open(name, 'w', driver='GTiff', width=width, height=height,



View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/f77e99cd383a3a3a643e3e46d207b0d1ef9fb2b0...c236461ea06fbda500ff6ca3a004fb9329f9076c

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/f77e99cd383a3a3a643e3e46d207b0d1ef9fb2b0...c236461ea06fbda500ff6ca3a004fb9329f9076c
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20190301/f2ac7517/attachment-0001.html>


More information about the Pkg-grass-devel mailing list