Skip to content

Commit

Permalink
Update examples, docs, tests and deps.
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Jun 26, 2020
1 parent 8ab4a4f commit 1e2f008
Show file tree
Hide file tree
Showing 15 changed files with 1,281 additions and 1,313 deletions.
132 changes: 19 additions & 113 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ If you are interested in using openEO together with Google Earth Engine, [expres

## Demo

* The most recent version (openEO API v1.0.0) is running at https://earthengine.openeo.org/v1.0
* The previous stable version (openEO API v0.4.2) is running at https://earthengine.openeo.org/v0.4
The demo instance is running at https://earthengine.openeo.org (supporting openEO API versions 0.4 and 1.0)

Multiple user accounts are available to be used (`group1`, `group2`, ... until `group15`), each with password `test123`.
Several user accounts are available to be used (`group1`, `group2`, ...), each with password `test123`.

## Setting up an instance

Expand All @@ -38,134 +37,41 @@ The server needs to authenticate with a [service accounts](https://developers.go

More information about authentication can be found in the [Earth Engine documentation](https://developers.google.com/earth-engine/app_engine_intro).

### Starting up the server
#v## Starting up the server

After configuration, the server can be started. Run `npm run start` to start the server.
After configuration, the server can be started. Run `npm run start` to start the server.

After finishing work, you can stop the server by running `npm run stop`.

## Usage

For both the demo servers or your own instance you can use the [openEO API](https://open-eo.github.io/openeo-api/apireference/index.html) to communicate with Google Earth Engine.

An exemplary process graph to create an on-demand XYZ web-service looks like this:

```
{
"load_collection": {
"arguments": {
"id": "COPERNICUS/S2",
"temporal_extent": ["2018-04-30", "2018-06-26"],
"spatial_extent": {
"west": -2.763447,
"south": 43.040791,
"east": -1.120991,
"north": 43.838489
},
"bands": ["B8", "B4"]
},
"process_id": "load_collection"
},
"b1": {
"arguments": {
"data": {"from_node": "load_collection"},
"bands": ["B8"]
},
"process_id": "filter_bands"
},
"b2": {
"arguments": {
"data": {"from_node": "load_collection"},
"bands": ["B4"]
},
"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": "t",
"reducer": {
"process_graph": {
"max": {
"arguments": {
"data": {"from_parameter": "data"}
},
"process_id": "max",
"result": true
}
}
}
},
"process_id": "reduce"
},
"linear_scaling": {
"arguments": {
"data": {"from_node": "reduce"},
"process": {
"process_graph": {
"lsr": {
"arguments": {
"x": {"from_parameter": "x"},
"inputMin": -1,
"inputMax": 1,
"outputMin": 0,
"outputMax": 255
},
"process_id": "linear_scale_range",
"result": true
}
}
}
},
"process_id": "apply"
},
"save_result": {
"arguments": {
"data": {"from_node": "linear_scaling"},
"format": "png"
},
"process_id": "save_result",
"result": true
}
}
```
An exemplary process to create an on-demand XYZ web-service looks like this: [sample-processgraph.json](tests/data/sample-processgraph.json)

This translates into the following [Google Earth Engine Playground](https://code.earthengine.google.com/) script:

```
// load_collection
var img = ee.ImageCollection("COPERNICUS/S2");
img = img.filterDate("2018-04-30", "2018-06-26");
var geom = ee.Geometry.Rectangle([-2.763447,43.040791,-1.120991,43.838489], "EPSG:4326");
img = img.filterBounds(geom);
var col = ee.ImageCollection("COPERNICUS/S2");
col = col.filterDate("2018-01-01", "2018-01-31");
// filter_bands (2x)
var band1 = img.select(["B8"]);
var band2 = img.select(["B4"]);
// normalized_difference
var combined = band1.combine(band2);
img = combined.map(function(image) {
var normalizedDifference = image.normalizedDifference().rename("normalized_difference");
return image.addBands(normalizedDifference).select("normalized_difference");
});
col = col.select(["B4", "B8"]);
// reduce with callback max
img = img.reduce('max');
// reduce over bands with callback normalized_difference
col = col.map(function(image) {
var red = image.select("B4");
var nir = image.select("B8");
return nir.subtract(red).divide(nir.add(red));
});
// apply linear scaling
var numerator = img.subtract(-1);
var ratio = numerator.divide(1 - -1);
img = ratio.multiply(255 - 0).add(0);
// reduce over time with callback max
var img = col.reduce('max');
// save_result
// Either download data with img.getDownloadURL() or show it in in the playground with:
Map.addLayer(img);
```

**[Further documentation](docs/README.md) can be found in the [docs/](docs/) directory, but is currently work in progress.**
**[Further documentation](docs/README.md) and more examples can be found in the [docs/](docs/) directory, but it is work in progress.**
188 changes: 95 additions & 93 deletions docs/era5-monthly-anomalies.json
Original file line number Diff line number Diff line change
@@ -1,105 +1,107 @@
{
"load": {
"process_id": "load_collection",
"description": "Load ERA5 monthly 2m air temperature from 1979 to 2019",
"arguments": {
"id": "ECMWF/ERA5/MONTHLY",
"spatial_extent": null,
"temporal_extent": ["1979-01-01","2020-01-01"],
"bands": ["mean_2m_air_temperature"]
}
},
"convert": {
"process_id": "apply",
"description": "Convert temperature from K to degree celsius",
"arguments": {
"data": {"from_node": "load"},
"process": {
"process_graph": {
"k_to_degC": {
"process_id": "subtract",
"arguments": {
"x": {"from_parameter": "x"},
"y": 273.15
},
"result": true
"process_graph": {
"load": {
"process_id": "load_collection",
"description": "Load ERA5 monthly 2m air temperature from 1979 to 2019",
"arguments": {
"id": "ECMWF/ERA5/MONTHLY",
"spatial_extent": null,
"temporal_extent": ["1979-01-01","2020-01-01"],
"bands": ["mean_2m_air_temperature"]
}
},
"convert": {
"process_id": "apply",
"description": "Convert temperature from K to degree celsius",
"arguments": {
"data": {"from_node": "load"},
"process": {
"process_graph": {
"k_to_degC": {
"process_id": "subtract",
"arguments": {
"x": {"from_parameter": "x"},
"y": 273.15
},
"result": true
}
}
}
}
}
},
"normals": {
"process_id": "climatological_normal",
"description": "Create the climatological period normals.",
"arguments": {
"data": {"from_node": "convert"},
"period": "monthly"
}
},
"anomaly": {
"process_id": "anomaly",
"description": "For each month in the time-series, calculate the anomaly",
"arguments": {
"data": {"from_node": "convert"},
"normals": {"from_node": "normals"},
"period": "monthly"
}
},
"reduce": {
"process_id": "reduce_dimension",
"description": "Reduce to first month - for visualization purposes only",
"arguments": {
"data": {"from_node": "anomaly"},
"reducer": {
"process_graph": {
"first": {
"process_id": "first",
"arguments": {
"data": {
"from_parameter": "data"
}
},
"result": true
},
"normals": {
"process_id": "climatological_normal",
"description": "Create the climatological period normals.",
"arguments": {
"data": {"from_node": "convert"},
"period": "monthly"
}
},
"anomaly": {
"process_id": "anomaly",
"description": "For each month in the time-series, calculate the anomaly",
"arguments": {
"data": {"from_node": "convert"},
"normals": {"from_node": "normals"},
"period": "monthly"
}
},
"reduce": {
"process_id": "reduce_dimension",
"description": "Reduce to first month - for visualization purposes only",
"arguments": {
"data": {"from_node": "anomaly"},
"reducer": {
"process_graph": {
"first": {
"process_id": "first",
"arguments": {
"data": {
"from_parameter": "data"
}
},
"result": true
}
}
}
},
"dimension": "t"
}
},
"stretch": {
"process_id": "apply",
"description": "Stretch range from -1 / 1 to 0 / 255 for PNG visualization.",
"arguments": {
"data": {"from_node": "reduce"},
"process": {
"process_graph": {
"linear_scale_range": {
"process_id": "linear_scale_range",
"arguments": {
"x": {
"from_parameter": "x"
},
"dimension": "t"
}
},
"stretch": {
"process_id": "apply",
"description": "Stretch range from -1 / 1 to 0 / 255 for PNG visualization.",
"arguments": {
"data": {"from_node": "reduce"},
"process": {
"process_graph": {
"linear_scale_range": {
"process_id": "linear_scale_range",
"arguments": {
"x": {
"from_parameter": "x"
},
"inputMin": -10,
"inputMax": 10,
"outputMax": 255
},
"inputMin": -10,
"inputMax": 10,
"outputMax": 255
},
"result": true
"result": true
}
}
}
}
}
},
"save": {
"process_id": "save_result",
"arguments": {
"data": {
"from_node": "stretch"
},
"format": "PNG",
"options": {
"palette": ["#2166AC","#4393C3","#92C5DE","#D1E5F0","#F7F7F7","#FDDBC7","#F4A582","#D6604D","#B2182B"]
}
},
"result": true
"save": {
"process_id": "save_result",
"arguments": {
"data": {
"from_node": "stretch"
},
"format": "PNG",
"options": {
"palette": ["#2166AC","#4393C3","#92C5DE","#D1E5F0","#F7F7F7","#FDDBC7","#F4A582","#D6604D","#B2182B"]
}
},
"result": true
}
}
}
Loading

0 comments on commit 1e2f008

Please sign in to comment.