Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/examples'
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed May 29, 2019
2 parents 154cb5b + deac62f commit cee65f7
Show file tree
Hide file tree
Showing 6 changed files with 423 additions and 0 deletions.
10 changes: 10 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Examples

This folder contains process graphs that show how the openEO processes work in practice.

* [NDVI-UC1: Deriving maximum NDVI measurements over pixel time series](ndvi-uc1/README.md)
* [ZONAL-UC3: Compute time series of zonal (regional) statistics over user-specified polygons](zonal-uc3/README.md)
* [EVI: Deriving minimum EVI measurements over pixel time series](evi/README.md)

Please feel encouraged to add your owns via Pull Requests!

134 changes: 134 additions & 0 deletions examples/evi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# EVI (Enhanced Vegetation Index)

This example derives minimum EVI measurements over pixel time series of Sentinel 2 imagery. The EVI is defined as follows: `(2.5 * (nir - red)) / ((nir + 6.0 * red - 7.5 * blue) + 1.0)`

The process graph could be visualized as follows:

![Graph visualization](visual.png)

This process graph is meant to be used as batch job or can be lazy evaluated. It returns a GeoTiff file with the computed results.

This process graph assumes the dataset is called `Sentinel-2`. The temporal extent covered is January 2018 and bands `B02` (blue), `B04` (red) and `B08` (nir) are used for the computation. Please note that the order of the bands in `get_collection` is important as they are requested by their order (index) in the callback.

## Process Graph

```json
{
"dc": {
"process_id": "load_collection",
"process_description": "Loading the data; The order of the specified bands is important for the following reduce operation.",
"arguments": {
"id": "Sentinel-2",
"spatial_extent": {
"west": 16.1,
"east": 16.6,
"north": 48.6,
"south": 47.2
},
"temporal_extent": ["2018-01-01", "2018-02-01"],
"bands": ["B08", "B04", "B02"]
}
},
"evi": {
"process_id": "reduce",
"process_description": "Compute the EVI. Formula: 2.5 * (NIR - RED) / (1 + NIR + 6*RED + -7.5*BLUE)",
"arguments": {
"data": {"from_node": "dc"},
"dimension": "spectral",
"reducer": {
"callback": {
"nir": {
"process_id": "array_element",
"arguments": {
"data": {"from_argument": "data"},
"index": 0
}
},
"red": {
"process_id": "array_element",
"arguments": {
"data": {"from_argument": "data"},
"index": 1
}
},
"blue": {
"process_id": "array_element",
"arguments": {
"data": {"from_argument": "data"},
"index": 2
}
},
"sub": {
"process_id": "subtract",
"arguments": {
"data": [{"from_node": "nir"}, {"from_node": "red"}]
}
},
"p1": {
"process_id": "product",
"arguments": {
"data": [6, {"from_node": "red"}]
}
},
"p2": {
"process_id": "product",
"arguments": {
"data": [-7.5, {"from_node": "blue"}]
}
},
"sum": {
"process_id": "sum",
"arguments": {
"data": [1, {"from_node": "nir"}, {"from_node": "p1"}, {"from_node": "p2"}]
}
},
"div": {
"process_id": "divide",
"arguments": {
"data": [{"from_node": "sub"}, {"from_node": "sum"}]
}
},
"p3": {
"process_id": "product",
"arguments": {
"data": [2.5, {"from_node": "div"}]
},
"result": true
}
}
}
}
},
"mintime": {
"process_id": "reduce",
"process_description": "Compute a minimum time composite by reducing the temporal dimension",
"arguments": {
"data": {"from_node": "evi"},
"dimension": "temporal",
"reducer": {
"callback": {
"min": {
"process_id": "min",
"arguments": {
"data": {"from_argument": "data"}
},
"result": true
}
}
}
}
},
"save": {
"process_id": "save_result",
"arguments": {
"data": {"from_node": "mintime"},
"format": "GTiff"
},
"result": true
}
}
```

## Result

TBD
Binary file added examples/evi/visual.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
165 changes: 165 additions & 0 deletions examples/ndvi-uc1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# NDVI (POC Use Case 1)

This example derives maximum NDVI measurements over pixel time series of Sentinel 2 imagery.

This process graph is meant to be used as secondary web service. If you want to run it as a batch job, you'd need to store the results to a file with the `save_result` process.

This process graph assumes the dataset is called `Sentinel-2`. It receives the spatial extent for the data to compute from the secondary web service as variables in `spatial_extent_west`, `spatial_extent_east` etc. The temporal extent covered is January 2018.

Process Graph #1 computes the NDVI based on the common band names in the metadata. If these entries are not available, you'd need to switch the process to `normalized_difference` in combination with `filter_bands` to manually specify the red and nir bands. This is shown in Process Graph #2.

## Process Graphs

### #1

```json
{
"loadco1": {
"process_id": "load_collection",
"arguments": {
"id": "Sentinel-2",
"spatial_extent": {
"west": {
"variable_id": "spatial_extent_west"
},
"east": {
"variable_id": "spatial_extent_east"
},
"north": {
"variable_id": "spatial_extent_north"
},
"south": {
"variable_id": "spatial_extent_south"
}
},
"temporal_extent": [
"2018-01-01",
"2018-02-01"
]
}
},
"ndvi1": {
"process_id": "ndvi",
"arguments": {
"data": {
"from_node": "loadco1"
}
}
},
"reduce1": {
"process_id": "reduce",
"arguments": {
"data": {
"from_node": "ndvi1"
},
"dimension": "temporal",
"reducer": {
"callback": {
"max1": {
"process_id": "max",
"arguments": {
"data": {
"from_argument": "data"
}
},
"result": true
}
}
}
},
"result": true
}
}
```

### #2

```json
{
"load_collection": {
"arguments": {
"id": "Sentinel-2",
"spatial_extent": {
"west": {
"variable_id": "spatial_extent_west"
},
"east": {
"variable_id": "spatial_extent_east"
},
"north": {
"variable_id": "spatial_extent_north"
},
"south": {
"variable_id": "spatial_extent_south"
}
},
"temporal_extent": [
"2018-01-01",
"2018-02-01"
]
},
"process_id": "load_collection"
},
"b1": {
"arguments": {
"data": {
"from_node": "load_collection"
},
"bands": [
"B4"
]
},
"process_id": "filter_bands"
},
"b2": {
"arguments": {
"data": {
"from_node": "load_collection"
},
"bands": [
"B8"
]
},
"process_id": "filter_bands"
},
"normalized_difference": {
"arguments": {
"band1": {
"from_node": "b1"
},
"band2": {
"from_node": "b2"
}
},
"process_id": "normalized_difference"
},
"reduce": {
"arguments": {
"data": {
"from_node": "normalized_difference"
},
"dimension": "temporal",
"reducer": {
"callback": {
"max": {
"arguments": {
"data": {
"from_argument": "data"
}
},
"process_id": "max",
"result": true
}
}
}
},
"process_id": "reduce"
}
}
```

## Result

Executing this process graph on Google Earth Engine gives the following exemplary results for a user-defined area:

![Resulting Image](gee-result.png)
Binary file added examples/ndvi-uc1/gee-result.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cee65f7

Please sign in to comment.