[Git][debian-gis-team/rasterio][master] 4 commits: New upstream version 1.0.1
Bas Couwenberg
gitlab at salsa.debian.org
Tue Jul 24 06:39:41 BST 2018
Bas Couwenberg pushed to branch master at Debian GIS Project / rasterio
Commits:
f4c8286f by Bas Couwenberg at 2018-07-24T07:04:04+02:00
New upstream version 1.0.1
- - - - -
b32826e5 by Bas Couwenberg at 2018-07-24T07:04:13+02:00
Merge tag 'upstream/1.0.1'
Upstream version 1.0.1
- - - - -
8c9550c5 by Bas Couwenberg at 2018-07-24T07:08:36+02:00
New upstream release.
- - - - -
d2379ce4 by Bas Couwenberg at 2018-07-24T07:09:36+02:00
Set distribution to unstable.
- - - - -
12 changed files:
- AUTHORS.txt
- CHANGES.txt
- debian/changelog
- docs/cli.rst
- rasterio/__init__.py
- rasterio/_warp.pyx
- rasterio/enums.py
- rasterio/rio/warp.py
- rasterio/warp.py
- tests/test_rio_warp.py
- tests/test_warp.py
- tests/test_warp_transform.py
Changes:
=====================================
AUTHORS.txt
=====================================
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -36,7 +36,7 @@ Authors
* Martin Kaesberger
* ngrue
* Nat Wilson
-* Juan Luis
+* Juan Luis Cano
* Gregory Raevski
* Tyler Erickson
* Jeffrey Gerard
=====================================
CHANGES.txt
=====================================
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,19 @@
Changes
=======
+1.0.1 (2018-07-23)
+------------------
+
+Bug fixes:
+
+- Bounding envelopes are densified at higher precision in transform_bounds to
+ fix #1411.
+- Add LERC compression to enums.Compression (#1412).
+- The reproject() function now passes dst_alpha properly to _reproject(), which
+ unlocks materialization of warp destination alpha band masks (#1417).
+- The --dimensions and --src-bounds options of rio-warp can be used together
+ as expected (#1418).
+
1.0.0 (2018-07-12)
------------------
=====================================
debian/changelog
=====================================
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+rasterio (1.0.1-1) unstable; urgency=medium
+
+ * Team upload.
+ * New upstream release.
+
+ -- Bas Couwenberg <sebastic at debian.org> Tue, 24 Jul 2018 07:09:22 +0200
+
rasterio (1.0.0-1) unstable; urgency=medium
* Team upload.
=====================================
docs/cli.rst
=====================================
--- a/docs/cli.rst
+++ b/docs/cli.rst
@@ -648,6 +648,12 @@ Or provide output bounds (in source crs) and resolution:
$ rio warp input.tif output.tif --dst-crs EPSG:4326 --bounds -78 22 -76 24 --res 0.1
+Previous command in case of south-up image, ``--`` escapes the next ``-``:
+
+.. code-block:: console
+
+ $ rio warp input.tif output.tif --dst-crs EPSG:4326 --bounds -78 22 -76 24 --res 0.1 -- -0.1
+
Other options are available, see:
.. code-block:: console
=====================================
rasterio/__init__.py
=====================================
--- a/rasterio/__init__.py
+++ b/rasterio/__init__.py
@@ -43,7 +43,7 @@ import rasterio.path
__all__ = ['band', 'open', 'pad', 'Env']
-__version__ = "1.0.0"
+__version__ = "1.0.1"
__gdal_version__ = gdal_version()
# Rasterio attaches NullHandler to the 'rasterio' logger and its
=====================================
rasterio/_warp.pyx
=====================================
--- a/rasterio/_warp.pyx
+++ b/rasterio/_warp.pyx
@@ -437,9 +437,6 @@ def _reproject(
else:
dst_bidx = src_bidx
- if destination.shape[0] != src_count:
- raise ValueError("Destination's shape is invalid")
-
try:
driver = exc_wrap_pointer(GDALGetDriverByName("MEM"))
except:
@@ -448,14 +445,22 @@ def _reproject(
"in a `with rasterio.Env()` or `with rasterio.open()` "
"block.")
- _, rows, cols = destination.shape
+ count, rows, cols = destination.shape
datasetname = str(uuid.uuid4()).encode('utf-8')
dst_dataset = exc_wrap_pointer(
- GDALCreate(driver, <const char *>datasetname, cols, rows,
- src_count,
+ GDALCreate(driver, <const char *>datasetname, cols, rows, count,
dtypes.dtype_rev[np.dtype(destination.dtype).name], NULL))
+ if dst_alpha:
+ for i in range(destination.shape[0]):
+ try:
+ delete_nodata_value(GDALGetRasterBand(dst_dataset, i+1))
+ except NotImplementedError as exc:
+ log.warn(str(exc))
+
+ GDALSetRasterColorInterpretation(GDALGetRasterBand(dst_dataset, dst_alpha), <GDALColorInterp>6)
+
GDALSetDescription(
dst_dataset, "Temporary destination dataset for _reproject()")
=====================================
rasterio/enums.py
=====================================
--- a/rasterio/enums.py
+++ b/rasterio/enums.py
@@ -65,6 +65,7 @@ class Compression(Enum):
lzma = 'LZMA'
none = 'NONE'
zstd = 'ZSTD'
+ lerc = 'LERC'
class Interleaving(Enum):
=====================================
rasterio/rio/warp.py
=====================================
--- a/rasterio/rio/warp.py
+++ b/rasterio/rio/warp.py
@@ -177,9 +177,10 @@ def warp(ctx, files, output, driver, like, dst_crs, dimensions, src_bounds,
# Calculate resolution appropriate for dimensions
# in target.
dst_width, dst_height = dimensions
+ bounds = src_bounds or src.bounds
try:
xmin, ymin, xmax, ymax = transform_bounds(
- src.crs, dst_crs, *src.bounds)
+ src.crs, dst_crs, *bounds)
except CRSError as err:
raise click.BadParameter(
str(err), param='dst_crs', param_hint='dst_crs')
=====================================
rasterio/warp.py
=====================================
--- a/rasterio/warp.py
+++ b/rasterio/warp.py
@@ -154,13 +154,13 @@ def transform_bounds(
for x in (left, right):
in_xs.extend([x] * (densify_pts + 2))
in_ys.extend(
- bottom + np.arange(0, densify_pts + 2, dtype=np.float32) *
+ bottom + np.arange(0, densify_pts + 2, dtype=np.float64) *
((top - bottom) * densify_factor)
)
for y in (bottom, top):
in_xs.extend(
- left + np.arange(1, densify_pts + 1, dtype=np.float32) *
+ left + np.arange(1, densify_pts + 1, dtype=np.float64) *
((right - left) * densify_factor)
)
in_ys.extend([y] * densify_pts)
@@ -291,7 +291,7 @@ def reproject(source, destination, src_transform=None, gcps=None,
_reproject(
source, destination, src_transform=src_transform, gcps=gcps,
src_crs=src_crs, src_nodata=src_nodata, dst_transform=dst_transform,
- dst_crs=dst_crs, dst_nodata=dst_nodata, dst_alpa=dst_alpha,
+ dst_crs=dst_crs, dst_nodata=dst_nodata, dst_alpha=dst_alpha,
src_alpha=src_alpha, resampling=resampling,
init_dest_nodata=init_dest_nodata, num_threads=num_threads,
warp_mem_limit=warp_mem_limit, **kwargs)
=====================================
tests/test_rio_warp.py
=====================================
--- a/tests/test_rio_warp.py
+++ b/tests/test_rio_warp.py
@@ -348,6 +348,26 @@ def test_warp_reproject_src_bounds_res(runner, tmpdir):
assert output.height == 14
+def test_warp_reproject_src_bounds_dimensions(runner, tmpdir):
+ """--src-bounds option works with dimensions"""
+ srcname = 'tests/data/shade.tif'
+ outputname = str(tmpdir.join('test.tif'))
+ out_bounds = [-11850000, 4810000, -11849000, 4812000]
+ result = runner.invoke(
+ main_group, [
+ 'warp', srcname, outputname, '--dst-crs', 'EPSG:4326',
+ '--dimensions', 9, 14, '--src-bounds'] + out_bounds)
+ assert result.exit_code == 0
+ assert os.path.exists(outputname)
+
+ with rasterio.open(outputname) as output:
+ assert output.crs == {'init': 'epsg:4326'}
+ assert np.allclose(output.bounds[:],
+ [-106.45036, 39.6138, -106.44136, 39.6278])
+ assert round(output.transform.a, 4) == 0.001
+ assert round(-output.transform.e, 4) == 0.001
+
+
def test_warp_reproject_dst_bounds(runner, tmpdir):
"""--bounds option works."""
srcname = 'tests/data/shade.tif'
=====================================
tests/test_warp.py
=====================================
--- a/tests/test_warp.py
+++ b/tests/test_warp.py
@@ -1247,3 +1247,24 @@ def test_issue1401():
dst_crs=dst_crs,
resampling=Resampling.nearest,
warp_mem_limit=4000)
+
+
+def test_reproject_dst_alpha(path_rgb_msk_byte_tif):
+ """Materialization of external mask succeeds"""
+
+ with rasterio.open(path_rgb_msk_byte_tif) as src:
+
+ nrows, ncols = src.shape
+
+ dst_arr = np.zeros((src.count + 1, nrows, ncols), dtype=np.uint8)
+
+ reproject(
+ rasterio.band(src, src.indexes),
+ dst_arr,
+ src_transform=src.transform,
+ src_crs=src.crs,
+ dst_transform=DST_TRANSFORM,
+ dst_crs={'init': 'EPSG:3857'},
+ dst_alpha=4)
+
+ assert dst_arr[3].any()
=====================================
tests/test_warp_transform.py
=====================================
--- a/tests/test_warp_transform.py
+++ b/tests/test_warp_transform.py
@@ -146,3 +146,9 @@ def test_gcps_calculate_transform():
'epsg:3857', 'epsg:4326', width=800, height=800, gcps=src_gcps)
assert width == 1087
assert height == 895
+
+
+def test_transform_bounds_identity():
+ """Confirm fix of #1411"""
+ bounds = (12978395.906596646, 146759.09430753812, 12983287.876406897, 151651.06411778927)
+ assert transform_bounds("+init=epsg:3857", "+init=epsg:3857", *bounds) == bounds
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/8f5aacd26badc8e8ca0e461e7e3abe01053bd10b...d2379ce40bbc10a06b38cecbfaa5cdd96f5f5225
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/rasterio/compare/8f5aacd26badc8e8ca0e461e7e3abe01053bd10b...d2379ce40bbc10a06b38cecbfaa5cdd96f5f5225
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/20180724/b849e3f0/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list