def test_build_process_dict_from_process(con100): from openeo.processes import add data = Parameter.number("data") proc = add(x=data, y=1) actual = build_process_dict(process_graph=proc, process_id="increment", summary="Increment value", description="Add 1 to input.", parameters=[data], returns={"schema": { "type": "number" }}) expected = { "id": "increment", "description": "Add 1 to input.", "summary": "Increment value", "process_graph": { "add1": { "arguments": { "x": { "from_parameter": "data" }, "y": 1 }, "process_id": "add", "result": True } }, "parameters": [{ "name": "data", "description": "data", "schema": { "type": "number" } }], "returns": { "schema": { "type": "number" } }, } assert actual == expected
def transform(x: ProcessBuilder) -> ProcessBuilder: return add(cos(absolute(x)), y=1.23)
def test_apply_callback_chain_lambda_functions(con100): im = con100.load_collection("S2") from openeo.processes import absolute, cos, add result = im.apply(lambda data: add(cos(absolute(data)), 1.23)) assert result.graph == load_json_resource('data/1.0.0/apply_chain.json')