Skip to content

math: Basic math routine

Commands of moraine.cli.math (source); the same functions are called in Python as mc.<name>(...) with import moraine.cli as mc. The help below is generated from the docstrings, like moraine COMMAND --help.

command summary
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]
argument type default description
--output str required output path of the result, same shape and chunks as the inputs
--operation str required numexpr expression of the input arrays, e.g. 'sin(a)*exp(b)/2'
--kw KEY=VALUE extra keyword argument, repeatable: input: the arrays used in operation as NAME=zarr path, e.g. a='a.zarr' (on the command line: --kw a=a.zarr)

Global options: --json, --traceback, --log FILE, -q / --quiet (conventions).

In a pipeline (not used by the example pipelines; required arguments only):

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

In Python:

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