def create_process_description():
    p_x = Parameter(description="A number.",
                    schema={"type": ["number", "null"]})

    rv = ReturnValue(description="The computed signum value of `x`.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"x": -2}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"sgn_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "The signum (also known as *sign*) of `x` is defined as:\n\n* *1* if *x > 0*\n* *0* if *x = 0*\n* *-1* if *x < 0*.",
        summary="Signum",
        parameters={"x": p_x},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(description="The data to check.",
                    schema={"description": "Any data type is allowed."})

    rv = ReturnValue(
        description="`true` if the data is a no-data value, otherwise `false`",
        schema={"type": "boolean"})

    # Example
    arguments = {"x": 1}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"isnodata_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Checks whether the specified data is a missing data, i.e. equals to any of the no-data values",
        summary="Value is a no-data value",
        parameters={"x": p_x},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(description="A number",
                    schema={"type": ["number", "null"]})

    rv = ReturnValue(description="Integer part of the number.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"x": 3.5}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"int_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="The integer part of the real number `x`.",
        summary="Integer part of a number",
        parameters={"x": p_x},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 4
0
def create_process_description():
    p_data = Parameter(description="A number.",
                       schema={"type": ["number", "null"]})

    rv = ReturnValue(description="The computed absolute value.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"x": 0}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"abs_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Computes the absolute value of a real number `x`.",
        summary="Absolute value",
        parameters={
            "x": p_data,
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 5
0
def create_process_description():
    p_x = Parameter(description="First operand.",
                    schema={"description": "Any data type is allowed."})
    p_y = Parameter(description="Second operand.",
                    schema={"description": "Any data type is allowed."})

    rv = ReturnValue(
        description=
        "`true` if `x` is strictly greater than `y` or `null` if any operand is `null`, otherwise `false`.",
        schema={"type": ["boolean", "null"]})

    # Example
    arguments = {"x": 1, "y": None}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"gt_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Compares whether `x` is strictly greater than `y`.",
        summary="Greater than comparison",
        parameters={
            "x": p_x,
            "y": p_y
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_band1 = Parameter(
        description=
        "Any openEO process object that returns a single space-time raster datasets "
        "that contains the first band for normalized difference computation.",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    p_band2 = Parameter(
        description=
        "Any openEO process object that returns a single space-time raster datasets "
        "that contains the second band for normalized difference computation.",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {
        "band1": {
            "from_node": "get_band1_data"
        },
        "band2": {
            "from_node": "get_band2_data"
        },
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"nnormalized difference_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "The normalized difference is computed as *(band1 - band2) / (band1 + band2).",
        summary=
        "The normalized difference is computed as *(band1 - band2) / (band1 + band2).",
        parameters={
            "band1": p_band1,
            "band2": p_band2
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 7
0
def create_process_description():
    p_x = Parameter(description="A boolean value.",
                    schema={"type": ["boolean", "null"]})
    p_y = Parameter(description="A boolean value.",
                    schema={"type": ["boolean", "null"]})

    rv = ReturnValue(description="Boolean result of the logical OR.",
                     schema={
                         "type": ["boolean", "null"],
                     })

    # Example
    arguments = {"x": True, "y": True}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"or_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Checks if **at least one** of the values is true.",
        summary="Logical OR",
        parameters={
            "x": p_x,
            "y": p_y
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(
        description="A number to compute the natural logarithm for.",
        schema={"type": ["number", "null"]})

    rv = ReturnValue(description="The computed natural logarithm.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"x": 1}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"ln_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "The natural logarithm is the logarithm to the base *e* of the number `x`.",
        summary="Natural logarithm",
        parameters={"x": p_x},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(description="Boolean value to invert.",
                    schema={"type": ["boolean", "null"]})

    rv = ReturnValue(description="Inverted boolean value.",
                     schema={
                         "type": ["boolean", "null"],
                     })

    # Example
    arguments = {"x": False}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"not_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Inverts a single boolean so that `true` gets `false` and `false` gets `true`.",
        summary="Inverting a boolean",
        parameters={"x": p_x},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_min = Parameter(description="New minimum value",
                      schema={
                          "type": "object",
                          "format": "float"
                      },
                      optional=False)
    p_max = Parameter(description="New maximum value",
                      schema={
                          "type": "object",
                          "format": "float"
                      },
                      optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {
        "data": {
            "from_node": "get_data_1"
        },
        "min": 1,
        "max": 255,
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"scale_minmax_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]
    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Scales the image values between specified min and max values.",
        summary="Rescale raster data based on interval",
        parameters={
            "data": p_data,
            "min": p_min,
            "max": p_max
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 11
0
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or a space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    p_mask = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or a space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    rv = ReturnValue(description="Masked EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {
        "data": {
            "from_node": "get_strds_data"
        },
        "mask": {
            "from_node": "get_mask_data"
        },
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"apply_mask_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Applies a mask to an EO dataset. "
        "Each pixel that is 0 or nodata in the mask is set to nodata. "
        "See also multilayer_mask.",
        summary="Apply a mask to an EO dataset.",
        parameters={
            "data": p_data,
            "mask": p_mask
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 12
0
def create_process_description():
    p_data = Parameter(description="An array of numbers.",
                       schema={
                               "type": "array",
                               "items": {
                                 "type": [
                                   "number",
                                   "null"
                                 ]
                               }
                       })
    p_nodata = Parameter(
        description="Indicates whether no-data values are ignored or not.",
        schema={
            "type": "boolean"},
        default=True,
        optional=True)

    rv = ReturnValue(description="The computed arithmetic mean.",
                     schema={
                             "type": [
                               "number",
                               "null"
                             ],
                     })

    # Example
    arguments = {
        "data": [
          1,
          0,
          3,
          2
        ]
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "mean_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="The arithmetic mean of an array of numbers is the quantity commonly called the average.",
        summary="Arithmetic mean (average)",
        parameters={
            "data": p_data,
            "ignore_nodata": p_nodata},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 13
0
def create_process_description():
    p_data = Parameter(description="Raster data cube",
                       schema={
                           "type": "object",
                           "subtype": "raster-cube"
                       },
                       optional=False)
    p_uprocess = Parameter(
        description=
        "Applies a unary process to each pixel value in the data cube. "
        "A unary process takes a single value and returns a single value.",
        schema={
            "type":
            "object",
            "subtype":
            "process-graph",
            "parameters": [{
                "name": "x",
                "description": "The value to process.",
                "schema": {
                    "description": "Any data type."
                }
            }]
        },
        optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {"data": {"from_node": "get_strds_data"}, "process": "null"}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"apply1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]
    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Applies a **unary** process which takes a single value "
        "such as `abs` or `sqrt` to each pixel value and returns "
        "a single new value for each pixel",
        summary="Applies a unary process to each pixel",
        parameters={
            "data": p_data,
            "process": p_uprocess
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="An array of numbers.",
                       schema={
                               "type": "array",
                               "items": {
                                 "type": [
                                   "number",
                                   "null"
                                 ]
                               }
                       })
    p_nodata = Parameter(
        description="Indicates whether no-data values are ignored or not.",
        schema={
            "type": "boolean"},
        default=True,
        optional=True)

    rv = ReturnValue(
        description="The computed sum of the sequence of numbers.",
        schema={
            "type": [
                "number",
                "null"],
             })

    # Example
    arguments = {
        "data": [
          -2,
          4,
          2.5
        ]
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "sum_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Sums up all elements in a sequential array of numbers and returns the computed sum.",
        summary="Compute the sum by adding up numbers",
        parameters={
            "data": p_data,
            "ignore_nodata": p_nodata},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="An array",
                       schema={
                                "type": "array",
                                "items": {
                                  "description": "Any data type is allowed."
                                }})
    p_index = Parameter(
        description="The zero-based index of the element to retrieve.",
        schema={
            "type": "integer"},
        optional=True)
    p_label = Parameter(description="The label of the element to retrieve.",
                        schema=[
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "string"
                                }
                              ],
                        optional=True)

    rv = ReturnValue(description="The value of the requested element.",
                     schema={
                             "description": "Any data type is allowed."})

    # Example
    arguments = {
        "data": {"from_node": "get_data_1"},
        "index": 0,
        "label": 0
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "array_element_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Returns the element with the specified index or label from the array.",
        summary="Get an element from an array",
        parameters={
            "data": p_data,
            "index": p_index,
            "label": p_label},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 16
0
def create_process_description():
    p_data = Parameter(description="An array of numbers.",
                       schema={
                               "type": "array",
                               "items": {
                                 "type": [
                                   "number",
                                   "null"
                                 ]
                               }
                       })
    p_nodata = Parameter(
        description="Indicates whether no-data values are ignored or not.",
        schema={
            "type": "boolean"},
        default=True,
        optional=True)

    rv = ReturnValue(description="The computed sample variance.",
                     schema={
                             "type": [
                               "number",
                               "null"
                             ],
                     })

    # Example
    arguments = {
        "data": [
          -1,
          1,
          3
        ]
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "variance_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Computes the sample variance of an array of numbers by calculating the square of the standard deviation (see ``sd()``).",
        summary="Variance",
        parameters={
            "data": p_data,
            "ignore_nodata": p_nodata},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(
        description="A raster data cube with two bands that have the common names red and nir assigned.",
        schema={
            "type": "object",
            "subtype": "raster-cube"},
        optional=False)
    p_nir = Parameter(
        description="The name of the NIR band. Defaults to the band that has the common name `nir` assigned.",
        schema={
            "type": "string",
            "subtype": "band-name"},
        optional=True)
    p_red = Parameter(
        description="The name of the red band. Defaults to the band that has the common name `red` assigned.",
        schema={
            "type": "string",
            "subtype": "band-name"},
        optional=True)

    rv = ReturnValue(description="Processed EO data.",
                     schema={"type": "object", "subtype": "raster-cube"})

    # Example
    arguments = {
        "data": {"from_node": "get_data"},
        "nir": "S2_8",
        "red": "S2_4"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "ndvi_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="The data parameter expects a raster data cube with two bands "
        "that have the common names red and nir assigned. The process returns "
        "a raster data cube with two bands being replaced with a new band "
        "that holds the computed values. ",
        summary="Computes the Normalized Difference Vegetation Index (NDVI). "
        "The NDVI is computed as (nir - red) / (nir + red).",
        parameters={
            "data": p_data,
            "nir": p_nir,
            "red": p_red},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    p_polygons = Parameter(
        description="URL to a publicly accessible polygon file readable by OGR",
        schema={"type": "string"},
        optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {
        "data": {
            "from_node": "get_b08_data"
        },
        "polygons":
        "https://storage.googleapis.com/graas-geodata/roi_openeo_use_case_2.geojson"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"zonal_statistics_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Compute the zonal statistics of a time series using a vector polygon. "
        "The following parameters are computed: "
        "mean, min, max, mean_of_abs, stddev, variance, "
        "coeff_var, sum, null_cells, cells",
        summary=
        "Compute the zonal statistics of a time series using a vector polygon.",
        parameters={
            "data": p_data,
            "polygons": p_polygons
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 19
0
def create_process_description():
    p_red = Parameter(
        description="Any openEO process object that returns a single space-time raster datasets "
        "that contains the RED band for EVI computation.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)

    p_nir = Parameter(
        description="Any openEO process object that returns a single space-time raster datasets "
        "that contains the NIR band for EVI computation.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)

    p_blue = Parameter(
        description="Any openEO process object that returns a single space-time raster datasets "
        "that contains the BLUE band for EVI computation.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)

    p_scale = Parameter(description="Scale factor to convert band values",
                        schema={"type": "object", "subtype": "float"},
                        optional=True)

    rv = ReturnValue(description="Processed EO data.",
                     schema={"type": "object", "subtype": "raster-cube"})

    # Example
    arguments = {
        "red": {"from_node": "get_red_data"},
        "nir": {"from_node": "get_nir_data"},
        "blue": {"from_node": "get_blue_data"},
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "evi_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Compute the EVI based on the red, nir, and blue bands of the input datasets.",
        summary="Compute the EVI based on the red, nir, and blue bands of the input datasets.",
        parameters={
            "red": p_red,
            "nir": p_nir,
            "blue": p_blue,
            "scale": p_scale},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_value = Parameter(description="A boolean value.",
                        schema={
                                "type": [
                                  "boolean",
                                  "null"
                                ]
                        })
    p_accept = Parameter(
        description="A value that is returned if the boolean value is `true`.",
        schema={
         "description": "Any data type is allowed."})
    p_reject = Parameter(
        description="A value that is returned if the boolean value is **not** `true`. Defaults to `null`.",
        schema={
            "description": "Any data type is allowed."},
        default=None,
        optional=True)

    rv = ReturnValue(
        description="Either the `accept` or `reject` argument depending on the given boolean value.",
        schema={
         "description": "Any data type is allowed."})

    # Example
    arguments = {
        "value": True,
        "accept": "A",
        "reject": "B"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "if_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="If the value passed is `true`, returns the value of the `accept` parameter, otherwise returns the value of the `reject` parameter.",
        summary="If-Then-Else conditional",
        parameters={
            "value": p_value,
            "accept": p_accept,
            "reject": p_reject},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(description="The minuend",
                    schema={
                               "type": [
                                 "number",
                                 "null"
                               ]
                       })
    p_y = Parameter(description="The subtrahend",
                    schema={
                               "type": [
                                 "number",
                                 "null"
                               ]
                       })

    rv = ReturnValue(description="The computed result.",
                     schema={
                             "type": [
                               "number",
                               "null"
                             ],
                     })

    # Example
    arguments = {
        "x": 5,
        "y": 2.5
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "subract_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Subtracts argument `y` from the argument `x` (*x - y*) and returns the computed result.",
        summary="Subtraction of two numbers",
        parameters={
            "x": p_x,
            "y": p_y},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_x = Parameter(description="The numerical base.",
                    schema={
                               "type": [
                                 "number",
                                 "null"
                               ]
                       })
    p_y = Parameter(description="The numerical exponent.",
                    schema={
                               "type": [
                                 "number",
                                 "null"
                               ]
                       })

    rv = ReturnValue(
        description="The computed value for `base` raised to the power of `p`.",
        schema={
            "type": [
                "number",
                "null"],
             })

    # Example
    arguments = {
        "x": 5,
        "y": 2.5
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "power_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Computes the exponentiation for the base `base` raised to the power of `p`.",
        summary="Exponentiation",
        parameters={
            "base": p_x,
            "p": p_y},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 23
0
def create_process_description():
    p_x = Parameter(description="First operand.",
                    schema={"description": "Any data type is allowed."})
    p_y = Parameter(description="Second operand.",
                    schema={"description": "Any data type is allowed."})
    p_delta = Parameter(
        description="Only applicable for comparing two numbers.",
        schema={
            "type": ["number", "null"],
        },
        default=None,
        optional=True)
    p_case = Parameter(
        description="Only applicable for comparing two strings.",
        schema={"type": "boolean"},
        default=None,
        optional=True)

    rv = ReturnValue(
        description=
        "Returns `true` if `x` is equal to `y`, `null` if any operand is `null`, otherwise `false`.",
        schema={"type": ["boolean", "null"]})

    # Example
    arguments = {"x": 1, "y": None}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"eq_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Compares whether `x` is strictly equal to `y`.",
        summary="Equal to comparison",
        parameters={
            "x": p_x,
            "y": p_y,
            "delta": p_delta,
            "case_sensitive": p_case
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 24
0
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_percentile = Parameter(description="The percentile to get from a "
                             "space-time raster dataset",
                             schema={
                                 "type": "object",
                                 "subtype": "float"
                             },
                             optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {"data": {"from_node": "get_strds_data"}, "percentile": "5"}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"percentile_time_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Reduce the time dimension of a space-time raster dataset "
        "by getting the percentile.",
        summary="Reduce the time dimension of a space-time raster dataset.",
        parameters={
            "data": p_data,
            "percentile": p_percentile
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_red = Parameter(
        description="Any openEO process object that returns raster dataset that should be used as "
        "the red channel in the resulting GRB image.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)
    p_green = Parameter(
        description="Any openEO process object that returns raster dataset that should be used as "
        "the green channel in the resulting GRB image.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)
    p_blue = Parameter(
        description="Any openEO process object that returns raster dataset that should be used as "
        "the blue channel in the resulting GRB image.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)

    rv = ReturnValue(description="Processed EO data.",
                     schema={"type": "object", "subtype": "raster-cube"})

    # Example
    arguments = {"red": {"from_node": "get_red_data"},
                 "green": {"from_node": "get_green_data"},
                 "blue": {"from_node": "get_blue_data"}}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "rgb_raster_exporter_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="This process exports three raster map layers as a single RGB image "
        "using the region specified upstream.",
        summary="Exports three RGB raster map layers using the region specified upstream.",
        parameters={
            "red": p_red,
            "green": p_green,
            "blur": p_blue},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="An array of numbers.",
                       schema={
                           "type": "array",
                           "items": {
                               "type": ["number", "null"]
                           }
                       })
    p_nodata = Parameter(
        description="Indicates whether no-data values are ignored or not.",
        schema={"type": "boolean"},
        default=True,
        optional=True)

    rv = ReturnValue(description="The computed statistical median.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"data": [1, 3, 3, 6, 7, 8, 9]}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"median_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "The statistical median of an array of numbers is the value separating the higher half from the lower half of the sorted data.",
        summary="Statistical median",
        parameters={
            "data": p_data,
            "ignore_nodata": p_nodata
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 27
0
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"},
        optional=False)
    p_format = Parameter(
        description="The format of the export. Default is GeotTiff format.",
        schema={
            "type": "string",
            "default": "GTiff"},
        optional=True)

    rv = ReturnValue(description="Processed EO data.",
                     schema={"type": "object", "subtype": "raster-cube"})

    # Example
    arguments = {"data": {"from_node": "get_b08_data"},
                 "format": "GTiff"}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "raster_exporter_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]
    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="This process exports an arbitrary number of raster map layers "
        "using the region specified upstream.",
        summary="Exports raster map layers using the region specified upstream.",
        parameters={
            "data": p_data,
            "format": p_format},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="A number.",
                       schema={"type": ["number", "null"]})
    p_min = Parameter(
        description=
        "Minimum value. If the value is lower than this value, the process will return the value of this parameter.",
        schema={"type": ["number", "null"]})
    p_max = Parameter(
        description=
        "Maximum value. If the value is greater than this value, the process will return the value of this parameter.",
        schema={"type": ["number", "null"]})

    rv = ReturnValue(description="The value clipped to the specified range.",
                     schema={
                         "type": ["number", "null"],
                     })

    # Example
    arguments = {"x": -5, "min": -1, "max": 1}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"clip_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Clips a number between specified minimum and maximum values.",
        summary="Clip a value between a minimum and a maximum",
        parameters={
            "x": p_data,
            "min": p_min,
            "max": p_max
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    rv = ReturnValue(description="Processed EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {
        "data": {
            "from_node": "get_data_1"
        },
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"bbox_from_raster_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Sets the computational bounding box for "
        "downstream computation from raster layer.",
        summary="Sets the computational bounding box for "
        "downstream computation from raster layer.",
        parameters={"data": p_data},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
Ejemplo n.º 30
0
def create_process_description():
    p_data = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or a space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)

    rv = ReturnValue(description="Multilayer mask as EO data.",
                     schema={
                         "type": "object",
                         "subtype": "raster-cube"
                     })

    # Example
    arguments = {"data": {"from_node": "get_strds_data"}}
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"multilayer_mask_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Creates a mask using several bands of an EO dataset. "
        "Each pixel that has nodata or invalid value in any of "
        "the layers/bands gets value 1, pixels that have valid "
        "values in all layers/bands get value 0.",
        summary="Create a multilayer mask from several raster datasets.",
        parameters={"data": p_data},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())