mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
Make block_shapes and files into lists
This commit is contained in:
parent
1dca528a4a
commit
0538b55d46
@ -66,6 +66,8 @@ New features:
|
||||
|
||||
Bug fixes:
|
||||
|
||||
- The block_shapes and files properties of datasets now return lists instead
|
||||
of tuples.
|
||||
- The ``--nodata`` option of rio-merge is now passed to the output file
|
||||
(#1345).
|
||||
- The precision keyword arguments for methods in the windows and transform
|
||||
|
||||
@ -414,7 +414,7 @@ cdef class DatasetBase(object):
|
||||
GDALGetBlockSize(band, &xsize, &ysize)
|
||||
self._block_shapes.append((ysize, xsize))
|
||||
|
||||
return tuple(self._block_shapes)
|
||||
return list(self._block_shapes)
|
||||
|
||||
def get_nodatavals(self):
|
||||
cdef GDALRasterBandH band = NULL
|
||||
@ -1193,7 +1193,7 @@ cdef class DatasetBase(object):
|
||||
file_list = GDALGetFileList(h_dataset)
|
||||
num_items = CSLCount(file_list)
|
||||
try:
|
||||
return tuple([file_list[i] for i in range(num_items)])
|
||||
return list([file_list[i] for i in range(num_items)])
|
||||
finally:
|
||||
CSLDestroy(file_list)
|
||||
|
||||
|
||||
@ -68,7 +68,7 @@ class RasterBlocksTest(unittest.TestCase):
|
||||
def test_blocks(self):
|
||||
with rasterio.open('tests/data/RGB.byte.tif') as s:
|
||||
self.assertEqual(len(s.block_shapes), 3)
|
||||
self.assertEqual(s.block_shapes, ((3, 791), (3, 791), (3, 791)))
|
||||
self.assertEqual(s.block_shapes, [(3, 791), (3, 791), (3, 791)])
|
||||
itr = s.block_windows(1)
|
||||
(j, i), first = next(itr)
|
||||
self.assertEqual((j, i), (0, 0))
|
||||
|
||||
@ -15,7 +15,7 @@ def test_files(data):
|
||||
with open(aux, 'w'):
|
||||
pass
|
||||
with rasterio.open(tif) as src:
|
||||
assert src.files == (tif, aux)
|
||||
assert src.files == [tif, aux]
|
||||
|
||||
|
||||
def test_handle_closed(path_rgb_byte_tif):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user