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_poly = Parameter(description="One or more polygons used for filtering",
                       schema={
                           "anyOf": [{
                               "type": "object",
                               "subtype": "geojson"
                           }, {
                               "type": "object",
                               "subtype": "vector-cube"
                           }]
                       },
                       optional=False)
    p_value = Parameter(
        description="The value used to replace non-zero and `true` values with",
        schema={
            "type": "object",
            "subtype": "string"
        },
        optional=True)
    p_inside = Parameter(
        description=
        "If set to `true` all pixels for which the point at the pixel center "
        "**does** intersect with any polygon are replaced",
        schema={"type": "boolean"},
        optional=True)

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

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Limits the data cube over the spatial dimensions to the specified polygons.\n\nThe filter retains "
        "a pixel in the data cube if the point at the pixel center intersects with at least one of the polygons (as  "
        "defined in the Simple Features standard by the OGC).",
        summary="Spatial filter using polygons",
        parameters={
            "data": p_data,
            "mask": p_poly,
            "replacement": p_value,
            "inside": p_inside
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data1 = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_data2 = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    # the overlap_resolver is not supported by us
    p_resolver = Parameter(
        description=
        "A reduction operator that resolves the conflict if the data overlaps",
        schema={
            "type":
            "object",
            "subtype":
            "process-graph",
            "parameters": [{
                "name": "x",
                "description": "The first value.",
                "schema": {
                    "description": "Any data type."
                }
            }, {
                "name": "y",
                "description": "The second value.",
                "schema": {
                    "description": "Any data type."
                }
            }, {
                "name": "context",
                "description": "Additional data passed by the user.",
                "schema": {
                    "description": "Any data type."
                },
                "required": False,
                "default": "null"
            }]
        },
        optional=True)

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

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "The data cubes have to be compatible. A merge is the inverse of a split if there is no overlap.",
        summary="Merging two data cubes",
        parameters={
            "cube1": p_data1,
            "cube2": p_data2,
            "overlap_resolver": p_resolver
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
예제 #3
0
def create_process_description():

    p_data = Parameter(
        description="The collection identifier.",
        schema={
            "type": "string",
            "subtype": "collection-id",
            "pattern": "^[A-Za-z0-9_\\-\\.~/]+$",
            "examples": [
                "nc_spm_08.landsat.raster.lsat5_1987_10",
                "nc_spm_08.PERMANENT.vector.lakes",
                "ECAD.PERMANENT.strds.temperature_1950_2017_yearly"]})
    p_spatial = Parameter(description="Limits the data to load from the collection to the specified bounding box or polygons.\n\n"
                          "The coordinate reference system of the bounding box must be specified as [EPSG](http://www.epsg.org) code or [PROJ](https://proj4.org) definition.",
                          schema=[{
                           "title": "Bounding Box",
                           "type": "object",
                           "subtype": "bounding-box",
                           "required": [
                                  "west",
                                  "south",
                                  "east",
                                  "north"
                                  ],
                           "properties": {
                                  "west": {
                                    "description": "West (lower left corner, coordinate axis 1).",
                                    "type": "number"
                                  },
                                  "south": {
                                    "description": "South (lower left corner, coordinate axis 2).",
                                    "type": "number"
                                  },
                                  "east": {
                                    "description": "East (upper right corner, coordinate axis 1).",
                                    "type": "number"
                                  },
                                  "north": {
                                    "description": "North (upper right corner, coordinate axis 2).",
                                    "type": "number"
                                  },
                                  "base": {
                                    "description": "Base (optional, lower left corner, coordinate axis 3).",
                                    "type": [
                                      "number",
                                      "null"
                                    ],
                                    "default": "null"
                                  },
                                  "height": {
                                    "description": "Height (optional, upper right corner, coordinate axis 3).",
                                    "type": [
                                      "number",
                                      "null"
                                    ],
                                    "default": "null"
                                  },
                                  "crs": {
                                    "description": "Coordinate reference system of the extent, specified as as [EPSG code](http://www.epsg-registry.org/), [WKT2 (ISO 19162) string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html) or [PROJ definition (deprecated)](https://proj.org/usage/quickstart.html). Defaults to `4326` (EPSG code 4326) unless the client explicitly requests a different coordinate reference system.",
                                    "schema": {
                                      "anyOf": [
                                        {
                                          "title": "EPSG Code",
                                          "type": "integer",
                                          "subtype": "epsg-code",
                                          "examples": [
                                            7099
                                          ]
                                        },
                                        {
                                          "title": "WKT2",
                                          "type": "string",
                                          "subtype": "wkt2-definition"
                                        },
                                        {
                                          "title": "PROJ definition",
                                          "type": "string",
                                          "subtype": "proj-definition",
                                          "deprecated": "true"
                                        }
                                      ],
                                      "default": 4326
                                    }
                                  }
                                }
                           },
                           {
                           "title": "GeoJSON",
                           "type": "object",
                           "subtype": "geojson"
                           }
                          ],
                          optional=False)
    p_temporal = Parameter(description="Limits the data to load from the collection to the specified left-closed temporal interval. Applies to all temporal dimensions if there are multiple of them. Left-closed temporal interval, i.e. an array with exactly two elements:\n\n1. The first element is the start of the date and/or time interval. The specified instance in time is **included** in the interval.\n2. The second element is the end of the date and/or time interval. The specified instance in time is **excluded** from the interval.\n\nThe specified temporal strings follow [RFC 3339](https://tools.ietf.org/html/rfc3339). Although [RFC 3339 prohibits the hour to be '24'](https://tools.ietf.org/html/rfc3339#section-5.7), **this process allows the value '24' for the hour** of an end time in order to make it possible that left-closed time intervals can fully cover the day.\n\nAlso supports open intervals by setting one of the boundaries to `null`, but never both.",
                           schema={"type": "array",
                                   "subtype": "temporal-interval",
                                   "minItems": 2,
                                   "maxItems": 2,
                                   "items": {
                                     "anyOf": [{
                                      "type": "string",
                                      "format": "date-time",
                                      "subtype": "date-time"
                                      },
                                      {
                                      "type": "string",
                                      "format": "date",
                                      "subtype": "date"
                                      },
                                      {
                                      "type": "string",
                                      "subtype": "time"
                                      },
                                      {
                                      "type": "null"
                                      }
                                      ]
                                      },
                                   "examples": [
                                      [
                                        "2015-01-01",
                                        "2016-01-01"
                                      ],
                                      [
                                        "12:00:00Z",
                                        "24:00:00Z"
                                      ]
                                   ]
                                   },
                           optional=False)

    p_bands = Parameter(
        description="Only adds the specified bands into the data cube so that bands that don't match the list of band names are not available. Applies to all dimensions of type `bands` if there are multiple of them.\n\nThe order of the specified array defines the order of the bands in the data cube.",
        schema=[
            {
                "type": "array",
                "items": {
                    "type": "string",
                    "subtype": "band-name"}}])
    p_properties = Parameter(
        description="Limits the data by metadata properties to include only data in the data cube which all given expressions return `true` for (AND operation).\n\nSpecify key-value-pairs with the keys being the name of the metadata property, which can be retrieved with the openEO Data Discovery for Collections. The values must be expressions to be evaluated against the collection metadata, see the example.\n\n**Note:** Back-ends may not pass the actual value to the expressions, but pass a proprietary index or a placeholder so that they can use the expressions to query against another data source. So debugging on the callback parameter `value` may lead to unexpected results.",
        experimental=True,
        optional=True,
        schema=[
            {
                "type": "object",
                "additionalProperties": {
                    "type": "object",
                    "subtype": "process-graph",
                    "parameters": [
                        {
                            "name": "value",
                            "description": "The property value to be checked against.",
                            "schema": {
                             "description": "Any data type."}}]}}])

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

    # Example
    arguments = {"id": "latlong_wgs84.modis_ndvi_global.strds.ndvi_16_5600m",
                 "spatial_extent": {
                     "west": 16.1,
                     "east": 16.6,
                     "north": 48.6,
                     "south": 47.2
                     },
                 "temporal_extent": [
                     "2018-01-01",
                     "2019-01-01"
                 ],
                 }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "load_strds_collection": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Loads a collection from the current back-end by its id and "
        "returns it as processable data cube.",
        summary="Load a collection",
        parameters={
            "id": p_data,
            "spatial_extent": p_spatial,
            "temporal_extent": p_temporal,
            "bands": p_bands,
            "properties": p_properties},
        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_geometries = Parameter(
        description=
        "Geometries as GeoJSON on which the aggregation will be based.",
        schema={
            "type": "object",
            "subtype": "geojson"
        },
        optional=False)
    p_reducer = Parameter(
        description="A reducer to be applied on all values of each geometry.",
        schema={
            "type":
            "object",
            "subtype":
            "process-graph",
            "parameters": [{
                "name": "data",
                "description": "An array with elements of any type.",
                "schema": {
                    "type": "array",
                    "items": {
                        "description": "Any data type."
                    }
                }
            }, {
                "name": "context",
                "description": "Additional data passed by the user.",
                "schema": {
                    "description": "Any data type."
                },
                "optional": "true",
                "default": "null"
            }]
        },
        optional=False)
    p_target_dimension = Parameter(
        description=
        "The new dimension name to be used for storing the results. Defaults to `result`.",
        schema={"type": "string"},
        optional=True)
    p_context = Parameter(
        description="Additional data to be passed to the reducer.",
        schema={"description": "Any data type."},
        optional=True)

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

    # Example
    arguments = {
        "data": {
            "from_node": "get_b08_data"
        },
        "geometries":
        "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={"aggregate_spatial_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Aggregates statistics for one or more geometries (e.g. zonal statistics for polygons) over the spatial dimensions.",
        summary="Zonal statistics for geometries.",
        parameters={
            "data": p_data,
            "geometries": p_geometries,
            "reducer": p_reducer,
            "target_dimension": p_target_dimension,
            "context": p_context
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
예제 #5
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_extent = Parameter(
        description=
        "Left-closed temporal interval, i.e. an array with exactly two elements:\n\n1. The first element is the start of the date and/or time interval. The specified instance in time is **included** in the interval.\n2. The second element is the end of the date and/or time interval. The specified instance in time is **excluded** from the interval.\n\nThe specified temporal strings follow [RFC 3339](https://tools.ietf.org/html/rfc3339). Although [RFC 3339 prohibits the hour to be '24'](https://tools.ietf.org/html/rfc3339#section-5.7), **this process allows the value '24' for the hour** of an end time in order to make it possible that left-closed time intervals can fully cover the day.\n\nAlso supports open intervals by setting one of the boundaries to `null`, but never both.",
        schema={
            "type":
            "array",
            "subtype":
            "temporal-interval",
            "minItems":
            2,
            "maxItems":
            2,
            "items": {
                "anyOf": [{
                    "type": "string",
                    "format": "date-time",
                    "subtype": "date-time"
                }, {
                    "type": "string",
                    "format": "date",
                    "subtype": "date"
                }, {
                    "type": "null"
                }]
            },
            "examples": [["2015-01-01T00:00:00Z", "2016-01-01T00:00:00Z"],
                         ["2015-01-01", "2016-01-01"]]
        },
        optional=False)

    p_dim = Parameter(
        description=
        "The temporal dimension to filter on. If the dimension is not set or is set to `null`, the data cube is expected to only have one temporal dimension. Fails with a `TooManyDimensions` error if it has more dimensions. Fails with a `DimensionNotAvailable` error if the specified dimension does not exist.\n\n**Note:** The default dimensions a data cube provides are described in the collection's metadata field `cube:dimensions`.",
        schema={
            "type": ["string", "null"],
            "default": "null"
        })

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

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Limits the data cube to the specified interval of dates and/or times.",
        summary="Temporal filter for a date and/or time interval",
        parameters={
            "data": p_data,
            "extent": p_extent,
            "dimension": p_dim
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(
        description=
        "The data to be passed to the UDF as array or raster data cube.",
        schema=[{
            "title": "Raster data cube",
            "type": "object",
            "subtype": "raster-cube"
        }, {
            "title": "Array",
            "type": "array",
            "minItems": 1,
            "items": {
                "description": "Any data type."
            }
        }, {
            "title": "Single Value",
            "description": "A single value of any data type."
        }],
        optional=False)
    p_udf = Parameter(
        description=
        "Either source code, an absolute URL or a path to an UDF script.",
        schema=[{
            "description": "URI to an UDF",
            "type": "string",
            "format": "uri",
            "subtype": "uri"
        }, {
            "description": "Path to an UDF uploaded to the server.",
            "type": "string",
            "subtype": "file-path"
        }, {
            "description": "Source code as string",
            "type": "string",
            "subtype": "udf-code"
        }],
        optional=False)

    p_runtime = Parameter(
        description="An UDF runtime identifier available at the back-end.",
        schema={
            "type": "string",
            "subtype": "udf-runtime"
        },
        optional=False)

    p_version = Parameter(
        description="An UDF runtime version. If set to `null`, "
        "the default runtime version specified for each runtime is used.",
        schema=[{
            "type": "string",
            "subtype": "udf-runtime-version"
        }, {
            "title": "Default runtime version",
            "type": "null"
        }],
        optional=True)

    p_context = Parameter(
        description="Additional data such as configuration options "
        "that should be passed to the UDF.",
        schema={"type": "object"},
        optional=True)

    rv = ReturnValue(
        description="The data processed by the UDF. Returns a raster data cube "
        "if a raster data cube was passed for `data`. If an array was "
        "passed for `data`, the returned value is defined by the context "
        "and is exactly what the UDF returned.",
        schema=[{
            "title": "Raster data cube",
            "type": "object",
            "subtype": "raster-cube"
        }, {
            "title": "Any",
            "description": "Any data type."
        }])

    # Example
    arguments = {
        "data": {
            "from_node": "get_strds_data"
        },
        "udf": "some source code"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"run_udf1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]
    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Runs an UDF in one of the supported runtime environments.",
        summary="Run an UDF",
        parameters={
            "data": p_data,
            "udf": p_udf,
            "runtime": p_runtime,
            "version": p_version,
            "context": p_context
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="The data cube.",
                       schema={
                           "type": "object",
                           "subtype": "raster-cube"
                       },
                       optional=False)

    p_dim = Parameter(
        description="The name of the dimension to rename the labels for.",
        schema={"type": "string"},
        optional=False)

    p_tgt = Parameter(
        description=
        "The new names for the labels. The dimension labels in the data cube are expected to be enumerated, if the parameter `target` is not specified. If a target dimension label already exists in the data cube, a `LabelExists` error is thrown.",
        schema={
            "type": "array",
            "items": {
                "anyOf": [{
                    "type": "number"
                }, {
                    "type": "string"
                }]
            }
        },
        optional=False)

    p_src = Parameter(
        description=
        "The names of the labels as they are currently in the data cube. The array defines an unsorted and potentially incomplete list of labels that should be renamed to the names available in the corresponding array elements in the parameter `target`. If one of the source dimension labels doesn't exist, a `LabelNotAvailable` error is thrown. By default, the array is empty so that the dimension labels in the data cube are expected to be enumerated.",
        schema={
            "type": "array",
            "items": {
                "anyOf": [{
                    "type": "number"
                }, {
                    "type": "string"
                }]
            }
        },
        optional=True)

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

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Limits the data cube to the specified interval of dates and/or times.",
        summary="Temporal filter for a date and/or time interval",
        parameters={
            "data": p_data,
            "dimension": p_dim,
            "target": p_tgt,
            "source": p_src
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
예제 #8
0
def create_process_description():
    # see
    # https://github.com/Open-EO/openeo-processes/blob/master/resample_cube_spatial.json

    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_target = Parameter(
        description="Any openEO process object that returns a raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_method = Parameter(description="The resampling method to use",
                         schema={"type": "string"},
                         optional=False)

    p_method.enum = [
        "near", "bilinear", "cubic", "lanczos", "average", "mode", "max",
        "min", "med", "q1", "q3"
    ]

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

    # Example
    arguments = {
        "data": {
            "from_node": "get_strds_data_1"
        },
        "target": {
            "from_node": "get_data_2"
        },
        "method": "average"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"resample_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Resample the spatial dimensions (x,y) from a source data cube "
        "to a target data cube and return the results as a new data cube.",
        summary="Spatially resample a space-time raster dataset.",
        parameters={
            "data": p_data,
            "target": p_target,
            "method": p_method
        },
        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="Minimum allowed value",
                      schema={
                          "type": "object",
                          "subtype": "float"
                      },
                      optional=False)
    p_max = Parameter(description="Maximum allowed value",
                      schema={
                          "type": "object",
                          "subtype": "float"
                      },
                      optional=False)

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

    examples = {
        "mask_invalid_values_1": {
            "process_id": PROCESS_NAME,
            "arguments": {
                "data": {
                    "from_node": "get_data_1"
                },
                "min": 1,
                "max": 150,
            }
        }
    }

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description=
        "Drops observations from raster data or raster time series data "
        " that are outside of the specified interval.",
        summary="Filter raster based data on the specified interval",
        parameters={
            "data": 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 "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_nf = Parameter(description="The number of frequencies to use",
                     schema={
                         "type": "object",
                         "subtype": "integer"
                     },
                     optional=False)
    p_dod = Parameter(description="Degree of over-determination",
                      schema={
                          "type": "object",
                          "subtype": "integer"
                      },
                      optional=True)
    p_fet = Parameter(
        description="Fit error tolerance when filtering outliers",
        schema={
            "type": "object",
            "subtype": "float"
        },
        optional=True)
    p_rangelo = Parameter(description="Ignore values below this limit",
                          schema={
                              "type": "object",
                              "subtype": "float"
                          },
                          optional=True)
    p_rangehi = Parameter(description="Ignore values above this limit",
                          schema={
                              "type": "object",
                              "subtype": "float"
                          },
                          optional=True)
    p_rejlo = Parameter(description="Reject low outliers",
                        schema={
                            "type": "object",
                            "subtype": "boolean"
                        },
                        optional=True)
    p_rejhi = Parameter(description="Reject high outliers",
                        schema={
                            "type": "object",
                            "subtype": "boolean"
                        },
                        optional=True)

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

    # Example
    arguments = {
        "data": {
            "from_node": "get_strds_data"
        },
        "nf": 6,
        "dod": 2,
        "fet": 0.1,
        "range_low": -0.3,
        "range_high": 0.9,
        "reject_low": "true"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"hants_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Apply Harmonic Analysis of Time-Series (HANTS) "
        "to a space-time raster dataset.",
        summary="Apply HANTS to a space-time raster dataset.",
        parameters={
            "data": p_data,
            "nf": p_nf,
            "dod": p_dod,
            "fet": p_fet,
            "range_low": p_rangelo,
            "range_high": p_rangehi,
            "reject_low": p_rejlo,
            "reject_high": p_rejhi
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
예제 #11
0
def create_process_description():
    p_a = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $a in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_b = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $b in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_c = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $c in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_d = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $d in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_e = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $e in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_f = Parameter(
        description="Any openEO process object that returns a single space-time raster "
        "datasets identified as $f in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=True)

    p_result = Parameter(
        description="Any openEO process object that returns a single space-time raster datasets "
        "identified as RESULT in the t.rast.algebra expression.", schema={
            "type": "object", "subtype": "raster-cube"}, optional=False)

    p_expression = Parameter(
        description="The t.rast.algebra expression",
        schema={
            "type": "string",
            "examples": ["$result = ($a + $b / ($a - $b))"]},
        optional=False)

    bn = Parameter(
        description="Basename of the new generated raster datasets in the resulting "
        "space-time raster datasets",
        schema={
            "type": "string",
            "examples": ["ndvi_base"]},
        optional=False)

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

    # Example
    arguments = {
        "a": {"from_node": "get_a_data"},
        "b": {"from_node": "get_b_data"},
        "result": "ndvi",
        "basename": "ndvi_base",
        "expression": "$result = ($a + $b / ($a - $b))"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(
        title="title",
        description="description",
        process_graph={
            "t_rast_algebra_1": node})
    examples = [
        ProcessExample(
            title="Simple example",
            description="Simple example",
            process_graph=graph)]

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Use a t.rast.algebra expression to compute a new space-time raster "
        "dataset from up to 6 existing space-time raster datasets.",
        summary="Apply a t.rast.algebra expression with up to 6 space-time raster datasets.",
        parameters={
            "a": p_a,
            "b": p_b,
            "c": p_c,
            "d": p_d,
            "e": p_e,
            "f": p_f,
            "result": p_result,
            "expression": p_expression,
            "basename": bn},
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
def create_process_description():
    p_data = Parameter(description="A data cube with bands.",
                       schema={
                           "type": "object",
                           "subtype": "raster-cube"
                       },
                       optional=False)

    p_bands = Parameter(
        description="A list of band names. "
        "Either the unique band name or one of the common band names.",
        schema={
            "type": "array",
            "items": {
                "type": "string",
                "subtype": "band-name"
            }
        },
        optional=True)

    p_wavelengths = Parameter(
        description=
        "A list of sub-lists with each sub-list consisting of two elements. "
        "The first element is the minimum wavelength and the second element "
        "is the maximum wavelength. Wavelengths are specified in micrometres (μm).",
        schema={
            "type": "array",
            "items": {
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": {
                    "type": "number"
                },
                "examples": [[[0.45, 0.5], [0.6, 0.7]]]
            }
        },
        optional=True)

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

    # Example
    arguments = {"data": {"from_node": "get_data_1"}, "bands": ["red", "nir"]}

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Filters the bands in the data cube so that bands that "
        "don't match any of the criteria are dropped from the data cube.",
        summary="Filter the bands by name",
        parameters={
            "data": p_data,
            "bands": p_bands,
            "wavelengths": p_wavelengths
        },
        returns=rv,
        examples=examples)

    return json.loads(pd.to_json())
예제 #13
0
def create_process_description():
    p_data = Parameter(description="Raster data cube",
                       schema={
                           "type": "object",
                           "subtype": "raster-cube"
                       },
                       optional=False)
    p_reducer = Parameter(
        description="A reducer to apply on the specified dimension.",
        schema={
            "type":
            "object",
            "subtype":
            "process-graph",
            "parameters": [{
                "name": "data",
                "description": "A labeled array with elements of any type.",
                "schema": {
                    "type": "array",
                    "subtype": "labeled-array",
                    "items": {
                        "description": "Any data type."
                    }
                }
            }, {
                "name": "context",
                "description": "Additional data passed by the user.",
                "schema": {
                    "description": "Any data type."
                }
            }]
        },
        optional=False)

    p_dimension = Parameter(
        description="The name of the dimension over which to reduce.",
        schema={"type": "string"},
        optional=False)

    p_context = Parameter(
        description="Additional data to be passed to the reducer.",
        schema={
            "description": "Any data type.",
            "default": "null"
        },
        optional=True)

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

    # Example
    arguments = {
        "data": {
            "from_node": "get_strds_data"
        },
        "dimension": "spatial",
        "reducer": "null"
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"reduce1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]
    pd = ProcessDescription(id=PROCESS_NAME,
                            description="Reduce",
                            summary="Reduce",
                            parameters={
                                "data": p_data,
                                "reducer": p_reducer,
                                "dimension": p_dimension,
                                "context": p_context,
                            },
                            returns=rv,
                            examples=examples)

    return json.loads(pd.to_json())
예제 #14
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_extent = Parameter(
        description=
        "A bounding box, which may include a vertical axis (see `base` and `height`).\n\n"
        "The coordinate reference system of the extent must be specified as "
        "[EPSG](http://www.epsg.org) code or [PROJ](https://proj4.org) definition.",
        schema={
            "type": "object",
            "subtype": "bounding-box",
            "required": ["west", "south", "east", "north"],
            "properties": {
                "west": {
                    "description":
                    "West (lower left corner, coordinate axis 1).",
                    "type": "number"
                },
                "south": {
                    "description":
                    "South (lower left corner, coordinate axis 2).",
                    "type": "number"
                },
                "east": {
                    "description":
                    "East (upper right corner, coordinate axis 1).",
                    "type": "number"
                },
                "north": {
                    "description":
                    "North (upper right corner, coordinate axis 2).",
                    "type": "number"
                },
                "base": {
                    "description":
                    "Base (optional, lower left corner, coordinate axis 3).",
                    "type": ["number", "null"],
                    "default": "null"
                },
                "height": {
                    "description":
                    "Height (optional, upper right corner, coordinate axis 3).",
                    "type": ["number", "null"],
                    "default": "null"
                },
                "crs": {
                    "description":
                    "Coordinate reference system of the extent, specified as as [EPSG code](http://www.epsg-registry.org/), [WKT2 (ISO 19162) string](http://docs.opengeospatial.org/is/18-010r7/18-010r7.html) or [PROJ definition (deprecated)](https://proj.org/usage/quickstart.html). Defaults to `4326` (EPSG code 4326) unless the client explicitly requests a different coordinate reference system.",
                    "schema": {
                        "anyOf": [{
                            "title": "EPSG Code",
                            "type": "integer",
                            "subtype": "epsg-code",
                            "examples": [7099]
                        }, {
                            "title": "WKT2",
                            "type": "string",
                            "subtype": "wkt2-definition"
                        }, {
                            "title": "PROJ definition",
                            "type": "string",
                            "subtype": "proj-definition",
                            "deprecated": True
                        }],
                        "default":
                        4326
                    }
                }
            }
        },
        optional=False)

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

    # Example
    arguments = {
        "data": {
            "from_node": "get_data_1"
        },
        "extent": {
            "north": 51.00226308446294,
            "crs": "EPSG:4326",
            "west": 3.057030657924054,
            "east": 3.058236553549667,
            "south": 50.99958367677388
        },
    }
    node = ProcessGraphNode(process_id=PROCESS_NAME, arguments=arguments)
    graph = ProcessGraph(title="title",
                         description="description",
                         process_graph={"filter_bbox_1": node})
    examples = [
        ProcessExample(title="Simple example",
                       description="Simple example",
                       process_graph=graph)
    ]

    pd = ProcessDescription(id=PROCESS_NAME,
                            description="Spatial filter using a bounding box",
                            summary="Spatial filter using a bounding box",
                            parameters={
                                "data": p_data,
                                "extent": p_extent
                            },
                            returns=rv,
                            examples=examples)

    return json.loads(pd.to_json())
예제 #15
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())
예제 #16
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_mask = Parameter(
        description="Any openEO process object that returns raster datasets "
        "or space-time raster dataset",
        schema={
            "type": "object",
            "subtype": "raster-cube"
        },
        optional=False)
    p_value = Parameter(
        description="The value used to replace non-zero and `true` values with",
        schema={
            "type": "object",
            "subtype": "string"
        },
        optional=True)

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

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

    pd = ProcessDescription(
        id=PROCESS_NAME,
        description="Applies a mask to a raster data cube "
        " replacing pixels in data that are not null in mask with the new value.",
        summary="Applies a mask to a raster data cube",
        parameters={
            "data": p_data,
            "mask": p_mask,
            "replacement": p_value
        },
        returns=rv,
        examples=[examples])

    return json.loads(pd.to_json())