Esempio n. 1
0
def get_process_list(node: Node):
    """Analyse the process description and return the Actinia process chain
    and the name of the processing result layer
    which is a single raster layer

    :param node: The process node
    :return: (output_objects, actinia_process_list)
    """

    tree, operators = construct_tree(
        node.as_dict()['arguments']['process']['process_graph'])
    # print (operators)
    formula = None
    output_datatype = GrassDataType.RASTER
    formula = serialize_tree(tree)
    # print(formula)
    output_datatype = GrassDataType.STRDS

    input_objects, process_list = check_node_parents(node=node)
    output_objects = []

    for input_object in node.get_parent_by_name("data").output_objects:

        output_object = DataObject(name=create_output_name(
            input_object.name, PROCESS_NAME),
                                   datatype=output_datatype)
        output_objects.append(output_object)
        node.add_output(output_object=output_object)

        pc = create_process_chain_entry(input_object, formula, operators,
                                        output_object)
        process_list.append(pc)

    return output_objects, process_list
Esempio n. 2
0
def get_process_list(node: Node):
    """Analyse the process description and return the Actinia process chain
    and the name of the processing result layer
    which is a single raster layer

    :param node: The process node
    :return: (output_objects, actinia_process_list)
    """
    # get dimension type
    dimtype = get_dimension_type(node.arguments["dimension"])
    if dimtype is None:
        raise Exception(
            'Unable to determine dimension type for dimension <%s>.' %
            (node.arguments["dimension"]))

    tree, operators = construct_tree(
        node.as_dict()['arguments']['reducer']['process_graph'])
    # print (operators)
    formula = None
    output_datatype = GrassDataType.STRDS
    if dimtype == 'bands':
        formula = serialize_tree(tree)
        # print (formula)
        output_datatype = GrassDataType.STRDS
    elif dimtype == 'temporal':
        if len(operators) != 1:
            raise Exception(
                'Only one method is supported by reduce process on the temporal dimension.'
            )

    input_objects, process_list = check_node_parents(node=node)
    output_objects = []

    for input_object in node.get_parent_by_name("data").output_objects:

        output_object = DataObject(name=create_output_name(
            input_object.name, node),
                                   datatype=output_datatype)
        output_objects.append(output_object)
        node.add_output(output_object=output_object)

        pc = create_process_chain_entry(input_object, dimtype, formula,
                                        operators, output_object)
        process_list.extend(pc)

    return output_objects, process_list