我有一个Dask图像数据数组。如何将该数组保存到tiff文件的目录中?
答案 0 :(得分:1)
理想情况下会有某种select
p.pid,
p.userID,
p.parentID,
p.title,
p.date,
u.userID,
u.username,
u.loginDate,
group_concat(t.tag order by t.tag) tags
from
postTable as p
inner join userTable as u on on p.userID = u.userID
inner join tagTable as t on p.pid = t.pid
where p.parentID = '0'
group by
p.pid,
p.userID,
p.parentID,
p.title,
p.date,
u.userID,
u.username,
u.loginDate
order by p.date
limit 10
函数。截至2019年10月31日,我找不到一个,但是您将来可能希望观看https://image.dask.org来获得这种功能。
您今天可以使用map_blocks和skimage.io.imread
完成此操作imsave
。
import dask.array as da
import skimage.io
x = da.random.random((2000, 2000), chunks=(200, 200)) # make a dask array
def save_file(arr, block_info=None):
""" Save file to foo-x-y.tif, where x and y are block locations """
filename = "foo-" + "-".join(map(str, block_info[0]["chunk-location"])) + ".tif"
skimage.io.imsave(filename, arr)
return arr
x.map_blocks(save_file, dtype=x.dtype).compute() # call function on every block