跳转至

math: Basic math routine

moraine.cli.math 的命令(源码);同样的函数在 Python 里以 mc.<name>(...) 调用(import moraine.cli as mc)。下面的帮助由 docstring 生成,与 moraine COMMAND --help 相同(docstring 为英文)。

命令 摘要
math Basic math manipulation

math

Basic math manipulation. Only elementwise operations are supported. Only one output is supported.

moraine math --output STR --operation STR [--kw KEY=VALUE]
参数 类型 默认值 说明
--output str 必需 output path of the result, same shape and chunks as the inputs
--operation str 必需 numexpr expression of the input arrays, e.g. 'sin(a)*exp(b)/2'
--kw KEY=VALUE 额外关键字参数,可重复:input: the arrays used in operation as NAME=zarr path, e.g. a='a.zarr' (on the command line: --kw a=a.zarr)

全局选项:--json、--traceback、--log FILE、-q / --quiet(约定)。

在 pipeline 文件中(示例 pipeline 未使用此命令;只列必需参数):

[[step]]
name = "math"
run = "math"
output = "..."
operation = "..."

在 Python 中:

import moraine.cli as mc
mc.math(output, operation, **data)