Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invert mask #110

Merged
merged 7 commits into from
Jan 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `any`
- `array_find`
- `drop_dimension`
- `mask_polygon`
- `load_uploaded_files`
- `rename_labels`
- Added further examples
Expand All @@ -26,8 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `aggregate_polygon`: The data cube implicitly gets restricted to the bounds of the polygons as if `filter_polygon` would have been used beforehand. [#101](https://github.com/Open-EO/openeo-processes/issues/101)
- `clip`: Works on a single value instead on arrays (replaced parameter `data` with `x`). [#75](https://github.com/Open-EO/openeo-processes/issues/75)
- `debug`: Replaced with a completely new definition. [#82](https://github.com/Open-EO/openeo-processes/issues/71), [API#100](https://github.com/Open-EO/openeo-api/issues/100), [API#214](https://github.com/Open-EO/openeo-api/issues/214)
- `filter_bands`: Merged parameters `bands` and `common_names`. [#77]( https://github.com/Open-EO/openeo-processes/issues/77)
- `load_collection`: Parameter `bands` accepts common band names. [#77]( https://github.com/Open-EO/openeo-processes/issues/77)
- `filter_bands`: Merged parameters `bands` and `common_names`. [#77](https://github.com/Open-EO/openeo-processes/issues/77)
- `load_collection`: Parameter `bands` accepts common band names. [#77](https://github.com/Open-EO/openeo-processes/issues/77)
- `ndvi` and `normalized_difference`: Rewrite of the processes with a completely new behavior. [#60](https://github.com/Open-EO/openeo-processes/issues/60)
- `resample_spatial`: Default value of parameter `align` changed from `lower-left` to `upper-left`. [#61](https://github.com/Open-EO/openeo-processes/issues/61)
- The following operations work on two values instead on a sequence of values: `and`, `divide`, `multiply`, `or`, `subtract`, `xor`. [#85](https://github.com/Open-EO/openeo-processes/issues/85)
Expand All @@ -37,9 +38,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `filter_bbox`, `load_collection`, `resample_spatial`: PROJ definitions are deprecated in favor of EPSG codes, WKT2 and PROJJSON. [#58](https://github.com/Open-EO/openeo-processes/issues/58)

### Removed
- `reduce`: The `null` (no-operation) reducer has been removed. Use the process `drop_dimension` instead. [#57](https://github.com/Open-EO/openeo-processes/issues/57)
- The following operations don't support `ignore_nodata` any longer: `and`, `divide`, `multiply`, `or`, `subtract`, `xor`. [#85](https://github.com/Open-EO/openeo-processes/issues/85)
- `aggregate_polygon`: Doesn't allow returning a GeoJSON any longer.
- `mask`: The mask parameter doesn't accept vectors (polygons) any longer. Use process `mask_polygon` instead. [#110](https://github.com/Open-EO/openeo-processes/issues/110)
- `reduce`: The `null` (no-operation) reducer has been removed. Use the process `drop_dimension` instead. [#57](https://github.com/Open-EO/openeo-processes/issues/57)
- Removed processes:
- `find_collections`: Use `load_collection` and manual data discovery through the clients. [API#52](https://github.com/Open-EO/openeo-api/issues/52)
- `output`: Use `debug` instead.
Expand Down
35 changes: 9 additions & 26 deletions mask.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "mask",
"summary": "Apply a mask",
"description": "Applies a mask to a raster data cube. A mask can either be specified as:\n\n* **Raster data cube** for which parallel pixels among `data` and `mask` are compared and those pixels in `data` are replaced, which are non-zero (for numbers) or `true` (for boolean values) in `mask`.\n* **GeoJSON or vector data cube** containing one or more polygons. All pixels for which the point at the pixel center intersects with the corresponding polygon (as defined in the Simple Features standard by the OGC) are replaced.\n\nThe pixel values are replaced with the value specified for `replacement`, which defaults to `null` (no data). No data values will be left untouched by the masking operation.",
"summary": "Apply a raster mask",
"description": "Applies a mask to a raster data cube. To apply a vector mask use ``mask_polygon()``.\n\nA mask is a raster data cube for which parallel pixels among `data` and `mask` are compared and those pixels in `data` are replaced which are non-zero (for numbers) or `true` (for boolean values). The pixel values are replaced with the value specified for `replacement`, which defaults to `null` (no data).",
"categories": [
"masks"
],
Expand All @@ -20,25 +20,15 @@
"required": true
},
"mask": {
"description": "Either a raster data cube, a GeoJSON object or a vector data cube.\n\nFor **raster data cubes**, both data cubes must be compatible so that every pixel in `data` has a parallel element in `mask`.\n\nFor **GeoJSON** the provided types can be one of the following:\n\n* A `Polygon` geometry,\n* a `GeometryCollection` containing Polygons,\n* a `Feature` with a `Polygon` geometry or\n* a `FeatureCollection` containing `Feature`s with a `Polygon` geometry.",
"schema": [
{
"type": "object",
"subtype": "geojson"
},
{
"type": "object",
"subtype": "vector-cube"
},
{
"type": "object",
"subtype": "raster-cube"
}
],
"description": "A mask as raster data cube. Every pixel in `data` must have a parallel element in `mask`.",
"schema": {
"type": "object",
"subtype": "raster-cube"
},
"required": true
},
"replacement": {
"description": "The value used to replace non-zero and `true` values with.",
"description": "The value used to replace masked values with.",
"schema": {
"type": [
"number",
Expand All @@ -56,12 +46,5 @@
"type": "object",
"subtype": "raster-cube"
}
},
"links": [
{
"href": "http://www.opengeospatial.org/standards/sfa",
"rel": "about",
"title": "Simple Features standard by the OGC"
}
]
}
}
71 changes: 71 additions & 0 deletions mask_polygon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"id": "mask_polygon",
"summary": "Apply a polygon mask",
"description": "Applies a polygon mask to a raster data cube. To apply a raster mask use ``mask()``.\n\nAll pixels for which the point at the pixel center **does not** intersect with any polygon (as defined in the Simple Features standard by the OGC) are replaced. This behaviour can be inverted by setting the parameter `inside` to `true`.\n\nThe pixel values are replaced with the value specified for `replacement`, which defaults to `null` (no data). No data values in `data` will be left untouched by the masking operation.",
"categories": [
"masks"
],
"parameter_order": [
"data",
"mask",
"replacement",
"inside"
],
"parameters": {
"data": {
"description": "A raster data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
},
"required": true
},
"mask": {
"description": "A GeoJSON object or a vector data cube containing a polygon. The provided feature types can be one of the following:\n\n* A `Polygon` geometry,\n* a `GeometryCollection` containing Polygons,\n* a `Feature` with a `Polygon` geometry or\n* a `FeatureCollection` containing `Feature`s with a `Polygon` geometry.",
"schema": [
{
"type": "object",
"subtype": "geojson"
},
{
"type": "object",
"subtype": "vector-cube"
}
],
"required": true
},
"replacement": {
"description": "The value used to replace masked values with.",
"schema": {
"type": [
"number",
"boolean",
"string",
"null"
]
},
"default": null
},
"inside": {
"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"
},
"default": false
}
},
"returns": {
"description": "The masked raster data cube.",
"schema": {
"type": "object",
"subtype": "raster-cube"
}
},
"links": [
{
"href": "http://www.opengeospatial.org/standards/sfa",
"rel": "about",
"title": "Simple Features standard by the OGC"
}
]
}