def read_tif(tasks, name: str, file_name: str, offset: tuple, output_chunk_name: str): """Read tiff files.""" for task in tasks: start = time() assert output_chunk_name not in task task[output_chunk_name] = Chunk.from_tif(file_name, global_offset=offset) task['log']['timer'][name] = time() - start yield task
def read_write_tif(chunk): """We'll lost global offset information using tif format!""" assert isinstance(chunk, np.ndarray) file_name = 'test.tif' if os.path.exists(file_name): os.remove(file_name) chunk.to_tif(file_name) chunk2 = Chunk.from_tif(file_name) assert np.alltrue(chunk == chunk2) os.remove(file_name)
def read_write_tif(chunk): """We'll lost global offset information using tif format!""" assert isinstance(chunk, Chunk) file_name = 'test.tif' if os.path.exists(file_name): os.remove(file_name) chunk.to_tif(file_name) chunk2 = Chunk.from_tif(file_name) # we can not preserve the global offset here # so chunk2's global offset will all be 0 np.testing.assert_array_equal(chunk.array, chunk2.array) os.remove(file_name)