Load the required libraries:
import openeo
import logging
import geojson
Connecting and authentication is explained here:
https://docs.terrascope.be/#/Developers/WebServices/OpenEO/OpenEO?id=logging-in
session = openeo.connect("openeo-dev.vito.be").authenticate_oidc("egi")
"summary": "CropCalendar code used to automatically predict harvest dates", "description": "CropCalendar harvest date prediction for all given input geometries. Only one harvest date (the first observed) is predicted within the given time_range. Therefore, for harvest date prediction over a longer period just subidivde the time_range into smaller parts. The required input is a loaded geojson file (featurecollection) or the path (on Public Terrascope drive) to the geojson file. The returned output is the original geojson file with an additional property, which contains the predicted harvest dates. In case no harvest date could be predicted for a specific geometry, a nodata value will be assigned to that field. Restriction: The input geometries should be 10m inwards buffered fromm its boundaries, otherwise the harvest date prediction reliability might drop",
Required parameters:
e.g. "2019-05-06", "2021-04-30" 2. "gjson_path" (optional):"Path to a geojson file" e.g. "/data/users/Public/herdem/geoms.gjson"
You have to use either parameter 2 or 3
time_range = "2019-05-06", "2019-10-30"
gjson_path = "geoms.gjson"
with open("geoms.gjson") as f:
gjson = geojson.load(f)
Create datacube in case the gjson path will be used for running the process
calendar = session.datacube_from_process("CropCalendar", namespace="vito", time_range=time_range ,gjson = gjson)
Create datacube in case the loaded geojson object will be used for running the process (in case you don't have a Terrascope Public drive)
#calendar = session.datacube_from_process("CropCalendar", namespace="vito", time_range=time_range ,gjson = gjson)
calendar.graph
job = calendar.execute_batch("harvest_prediction", out_format="json") #harvest_prediction will be stored at the same location as your notebook is stored.