mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
Merge pull request #302 from mapbox/issue-301
Add missing keywords: blockxsize, blockysize, tiled
This commit is contained in:
commit
76e5fb7306
@ -1,6 +1,10 @@
|
||||
Changes
|
||||
=======
|
||||
|
||||
Maint next
|
||||
----------
|
||||
- Add missing blockxsize, blockysize, tiled keywords (#301).
|
||||
|
||||
0.19.0 (2015-03-25)
|
||||
-------------------
|
||||
- New rio-calc command (#175).
|
||||
|
||||
@ -395,7 +395,10 @@ cdef class DatasetReader(object):
|
||||
'count': self.count,
|
||||
'crs': self.crs,
|
||||
'transform': self.affine.to_gdal(),
|
||||
'affine': self.affine }
|
||||
'affine': self.affine,
|
||||
'blockxsize': self.block_shapes[0][1],
|
||||
'blockysize': self.block_shapes[0][0],
|
||||
'tiled': self.block_shapes[0][1] != self.width }
|
||||
self._read = True
|
||||
return m
|
||||
|
||||
|
||||
28
tests/test_meta.py
Normal file
28
tests/test_meta.py
Normal file
@ -0,0 +1,28 @@
|
||||
# Tests of dataset meta keywords and dataset creation
|
||||
|
||||
import rasterio
|
||||
|
||||
|
||||
def test_blocksize_rgb(tmpdir):
|
||||
with rasterio.open('tests/data/RGB.byte.tif') as src:
|
||||
kwds = src.meta
|
||||
assert kwds['blockxsize'] == 791
|
||||
assert kwds['blockysize'] == 3
|
||||
assert kwds['tiled'] is False
|
||||
|
||||
def test_blocksize_shade(tmpdir):
|
||||
with rasterio.open('tests/data/shade.tif') as src:
|
||||
kwds = src.meta
|
||||
assert kwds['blockxsize'] == 1024
|
||||
assert kwds['blockysize'] == 8
|
||||
assert kwds['tiled'] is False
|
||||
|
||||
def test_copy_meta(tmpdir):
|
||||
with rasterio.open('tests/data/RGB.byte.tif') as src:
|
||||
kwds = src.meta
|
||||
with rasterio.open(
|
||||
str(tmpdir.join('test_copy_meta.tif')), 'w', **kwds) as dst:
|
||||
assert dst.meta['count'] == 3
|
||||
assert dst.meta['blockxsize'] == 791
|
||||
assert dst.meta['blockysize'] == 3
|
||||
assert dst.meta['tiled'] is False
|
||||
Loading…
x
Reference in New Issue
Block a user