Skip to content

Commit 8368b07

Browse files
committed
Add openEO example
1 parent 1004639 commit 8368b07

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,47 @@ rqatrend(y, 0.5, 10, 1)
2424
# -0.12493604680482838
2525
```
2626

27+
Use in openEO:
28+
29+
```python
30+
import openeo
31+
connection = openeo.connect("https://openeo.eodc.eu")
32+
33+
cube_in = connection.load_collection(
34+
"SENTINEL1_SIG0_20M",
35+
spatial_extent={"west": 16.06, "south": 48.06, "east": 16.65, "north": 48.35},
36+
temporal_extent=["2023-01-01", "2024-01-01"],
37+
bands=["VV"]
38+
)
39+
40+
rqatrend = openeo.UDF(
41+
"""
42+
# /// script
43+
# dependencies = [
44+
# "xarray",
45+
# "rqadeforestation @ git+https://github.com/EarthyScience/RQADeforestation.py",
46+
# ]
47+
# ///
48+
49+
import xarray as xr
50+
from rqadeforestation import rqatrend
51+
52+
def apply_datacube(cube: xr.DataArray, context: dict) -> xr.DataArray:
53+
res_np = rqatrend(cube.to_numpy(), 0.5, 10, 1)
54+
res_xr = xr.DataArray(res_np)
55+
return res_xr
56+
"""
57+
)
58+
59+
cube_out = cube_in.apply(process=rqatrend)
60+
result = cube_out.save_result("GTiff")
61+
62+
connection.authenticate_oidc()
63+
job = result.create_job()
64+
job.start_and_wait()
65+
job.get_results().download_files("output")
66+
```
67+
2768
## Motivation
2869

2970
Analyzing high resolution sattelite images at global scale requires to optimize the execution efficiency.

0 commit comments

Comments
 (0)