Add config
Browse files- .gitignore +1 -1
- app.py +12 -0
.gitignore
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
.venv/
|
| 2 |
.idea/
|
| 3 |
__pycache__/
|
| 4 |
-
*.pyc
|
|
|
|
| 1 |
.venv/
|
| 2 |
.idea/
|
| 3 |
__pycache__/
|
| 4 |
+
*.pyc
|
app.py
CHANGED
|
@@ -17,6 +17,9 @@ from worldcereal.job import INFERENCE_JOB_OPTIONS, create_embeddings_process_gra
|
|
| 17 |
from openeo_gfmap import TemporalContext, BoundingBoxExtent
|
| 18 |
from worldcereal.parameters import EmbeddingsParameters
|
| 19 |
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
crop_classes = {
|
| 22 |
"tuz": "#32cd32",
|
|
@@ -133,6 +136,15 @@ def run_openeo_job(lat, lon, size_km=1.0):
|
|
| 133 |
Runs WorldCereal job for a small box around lat/lon.
|
| 134 |
Returns path to downloaded tif or None.
|
| 135 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
try:
|
| 137 |
offset = (size_km / 111) / 2
|
| 138 |
west, east = lon - offset, lon + offset
|
|
|
|
| 17 |
from openeo_gfmap import TemporalContext, BoundingBoxExtent
|
| 18 |
from worldcereal.parameters import EmbeddingsParameters
|
| 19 |
|
| 20 |
+
import openeo
|
| 21 |
+
import os
|
| 22 |
+
|
| 23 |
|
| 24 |
crop_classes = {
|
| 25 |
"tuz": "#32cd32",
|
|
|
|
| 136 |
Runs WorldCereal job for a small box around lat/lon.
|
| 137 |
Returns path to downloaded tif or None.
|
| 138 |
"""
|
| 139 |
+
con = openeo.connect("https://openeo.dataspace.copernicus.eu")
|
| 140 |
+
|
| 141 |
+
refresh_token = os.environ.get("OPENEO_REFRESH_TOKEN")
|
| 142 |
+
|
| 143 |
+
if refresh_token:
|
| 144 |
+
con.authenticate_oidc_refresh_token(refresh_token=refresh_token)
|
| 145 |
+
else:
|
| 146 |
+
con.authenticate_oidc()
|
| 147 |
+
|
| 148 |
try:
|
| 149 |
offset = (size_km / 111) / 2
|
| 150 |
west, east = lon - offset, lon + offset
|