光栅化窗口多处理包装器
rio-mucho的Python项目详细描述
rio mucho
==
>Rasterio的并行处理包装
----
pypi的安装:
``pip安装rio mucho`
github的安装(通常用于分支/dev):
`pip安装pip安装pipgit+ssh://git@github.com/mapbox/rio mucho.git@<;branch>;egg=riomucho``
开发:
:
cd rio mucho
pip install-e.
----
代码::python
with riomucho.riomucho([{inputs}],{output},{run function},
windows={windows},
global args={global arguments},
options={options to write})作为rios:
rios.run({processes})
参数
~~~~~~~~~
``inputs``
^^^^^^^^^^
to.
``运行函数``
^^^^^^^^^^^^^^^^^^^^^
应用于每个窗口块的函数。这应该有输入
参数:
1。一个数据输入,它可以是:
-一个形状的numpy数组列表(x,y,z),每个文件一个,如输入文件列表``mode="simple_read"[默认]``
-一个形状的numpy数组({*n*输入文件x*n*带区计数},{window
行},{window cols}``mode=array-read``
-用于读取``mode="manual-read"``
2的开放源代码列表。一个"rasterio"窗口元组
3。"rasterio"窗口索引(``ij``)
4。一个全局参数对象,可用于传入全局
参数
该对象应返回:
1。一个由({count},{window rows},{window cols})形状和
正确数据类型组成的输出数组,用于写入
。代码::python
>def basic运行({data},{window},{ij},{global args},{br/>做点事
return{out}
做点事
;做点事
做点事
return{{out}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~br/>
/>`{windows{{windows{{windows}` ` `
一个"光栅"列表(窗口,ij)要操作的元组。
`[默认值=src[0].block_windows()]``
``全局参数{global arguments}`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
因为这是并行工作的,所以您
希望在`` run函数``中可以访问的任何其他对象/值。``[默认值={}]``
…代码::python
global_args={
"divide_value":2
}
``options={keyword args}``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
传递到写入输出的选项。``[默认值=srcs[0].meta```
>示例
----
…代码::python
import riomucho,rasterio,numpy
def basic_run(data,window,ij,g_args):
从输入
以rasterio.open('/tmp/test_1.tif')作为src:
以抓取窗口为例。默认行为是相同的。
windows=[[window,ij]对于ij,window in src.block_windows()]
options=src.meta
进程数=4
使用riomucho.riomucho(['input1.tif','input2.tif','output.tif',basic_run,
windows=windows,
global_args=global_args,运行它
options=options=options)作为rm:
>
>
>>
`riomucho.utils.riomucho.utils.array\u堆栈([ar数组,数组,数组,…])
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~},{rows},{cols})numpy数组,堆栈成
单个(l{list length\*each image depth},{rows},{cols})数组。这个
对于处理单个
文件的"rgb"输入之间的变化或每个文件的单独文件之间的变化非常有用。
代码::python
files=['rgb.tif']
open嫒files=[rasterio.open(f)for f in files]
rgb=`riomucho.utils.array嫒stack([src.read()for src in open嫒files])
代码::python
files=['r.tif','g.tif','b.tif']
open戋files=[rasterio.open(f)for f in files]
rgb=`riomucho.utils.array戋stack([src.read()for src in open戋files])
| pypi图像::https://img.shields.io/pypi/v/rio-mucho.svg?最大值=2592000?样式=塑料
:目标:
…|构建状态图像::https://travis-ci.org/mapbox/rio-mucho.svg?branch=master
:目标:https://travis ci.org/mapbox/rio mucho
…|覆盖状态图像::https://coveralls.io/repos/mapbox/rio-mucho/badge.svg?branch=master&service=github
:目标:https://coveralls.io/github/mapbox/rio-mucho?分支=主
==
>Rasterio的并行处理包装
----
pypi的安装:
``pip安装rio mucho`
github的安装(通常用于分支/dev):
`pip安装pip安装pipgit+ssh://git@github.com/mapbox/rio mucho.git@<;branch>;egg=riomucho``
开发:
:
pip install-e.
----
代码::python
with riomucho.riomucho([{inputs}],{output},{run function},
windows={windows},
global args={global arguments},
options={options to write})作为rios:
rios.run({processes})
参数
~~~~~~~~~
``inputs``
^^^^^^^^^^
to.
``运行函数``
^^^^^^^^^^^^^^^^^^^^^
应用于每个窗口块的函数。这应该有输入
参数:
1。一个数据输入,它可以是:
-一个形状的numpy数组列表(x,y,z),每个文件一个,如输入文件列表``mode="simple_read"[默认]``
-一个形状的numpy数组({*n*输入文件x*n*带区计数},{window
行},{window cols}``mode=array-read``
-用于读取``mode="manual-read"``
2的开放源代码列表。一个"rasterio"窗口元组
3。"rasterio"窗口索引(``ij``)
4。一个全局参数对象,可用于传入全局
参数
该对象应返回:
1。一个由({count},{window rows},{window cols})形状和
正确数据类型组成的输出数组,用于写入
。代码::python
>def basic运行({data},{window},{ij},{global args},{br/>做点事
return{out}
做点事
;做点事
做点事
return{{out}
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~br/>
/>`{windows{{windows{{windows}` ` `
一个"光栅"列表(窗口,ij)要操作的元组。
`[默认值=src[0].block_windows()]``
``全局参数{global arguments}`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
因为这是并行工作的,所以您
希望在`` run函数``中可以访问的任何其他对象/值。``[默认值={}]``
…代码::python
global_args={
"divide_value":2
}
``options={keyword args}``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
传递到写入输出的选项。``[默认值=srcs[0].meta```
>示例
----
…代码::python
import riomucho,rasterio,numpy
def basic_run(data,window,ij,g_args):
从输入
以rasterio.open('/tmp/test_1.tif')作为src:
以抓取窗口为例。默认行为是相同的。
windows=[[window,ij]对于ij,window in src.block_windows()]
options=src.meta
进程数=4
使用riomucho.riomucho(['input1.tif','input2.tif','output.tif',basic_run,
windows=windows,
global_args=global_args,运行它
options=options=options)作为rm:
>
>
>>
`riomucho.utils.riomucho.utils.array\u堆栈([ar数组,数组,数组,…])
>>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~},{rows},{cols})numpy数组,堆栈成
单个(l{list length\*each image depth},{rows},{cols})数组。这个
对于处理单个
文件的"rgb"输入之间的变化或每个文件的单独文件之间的变化非常有用。
代码::python
files=['rgb.tif']
open嫒files=[rasterio.open(f)for f in files]
rgb=`riomucho.utils.array嫒stack([src.read()for src in open嫒files])
代码::python
files=['r.tif','g.tif','b.tif']
open戋files=[rasterio.open(f)for f in files]
rgb=`riomucho.utils.array戋stack([src.read()for src in open戋files])
| pypi图像::https://img.shields.io/pypi/v/rio-mucho.svg?最大值=2592000?样式=塑料
:目标:
…|构建状态图像::https://travis-ci.org/mapbox/rio-mucho.svg?branch=master
:目标:https://travis ci.org/mapbox/rio mucho
…|覆盖状态图像::https://coveralls.io/repos/mapbox/rio-mucho/badge.svg?branch=master&service=github
:目标:https://coveralls.io/github/mapbox/rio-mucho?分支=主