我试图运行以下代码来对裁剪geotifs的函数进行视差化。Geotifs的名称为<location>__img_news1a_iw_rt30_<hex_code>_g_gpf_vv.tif
。该代码工作得非常好,但它甚至从vv_tif iterable中跳过了一组特定的geotif。特别是,在locationA_img_news1a_iw_rt30_20170314t115609_g_gpf_vv.tif
、locationA_img_news1a_iw_rt30_20170606t115613_g_gpf_vv.tif
和locationA_img_news1a_iw_rt30_20170712t115615_g_gpf_vv.tif
中,每当我读取这些文件以及其他位置地理信息时,它都会跳过locationA_img_news1a_iw_rt30_20170712t115615_g_gpf_vv.tif
。但是,如果我仅从这三个geotif文件创建iterable,它将读取此文件。我试过改变chunksize,但没用。我是不是遗漏了什么
from multiprocessing import Pool, cpu_count
try:
pool = Pool(cpu_count())
pool.imap_unordered(tile_geotif, vv_tif, chunksize=11)
finally:
pool.close()
编辑:我总共有55个文件,每次只删除locationA_img_news1a_iw_rt30_20170712t115615_g_gpf_vv.tif
个文件
请注意结果上的差异,这取决于“time.sleep”是输入还是输出
这太多了,无法在评论中显示,请在这里回答
在我看来,映射函数在下面的玩具示例中起作用。我认为您的输入数据有错误,导致输出损坏。要么这样,要么你发现了一个bug。如果是这样,请尝试创建一个可复制的示例
输出:
通常这4条线都是一样的。我运行了几次,直到我得到一个不同的订单。在我看来,这是可行的
注意,his证明了各种
map
函数没有改变底层数据相关问题 更多 >
编程相关推荐