Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cropsar_px process migration #78

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
151 changes: 151 additions & 0 deletions algorithm_catalog/cropsar_px.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
"id": "cropsar_px",
"type": "Feature",
"conformsTo": [
"http://www.opengis.net/spec/ogcapi-records-1/1.0/req/record-core"
],
"geometry": null,
"properties": {
"created": "2024-10-03T00:00:00Z",
"updated": "2024-10-03T00:00:00Z",
"type": "apex_algorithm",
"title": "Cloud-free monitoring using Sentinel satellites",
"description": "The `CropSAR_px` process produces Sentinel-2 data cloud-free with a regularity of five-day intervals. \nIn the current version of the service, the output types supported include:\n\n- NDVI\n- FAPAR\n- FCOVER\n\n> The 'startdate' parameter corresponds to the date of the first image in the result. \n> From this start date, a new image will be generated every five days up to, or beyond, the specified end date.\n\n## Usage\n\nThe following example demonstrates how the 'CropSAR_px' process can be executed using an OpenEO batch job. \nThis batch job produces a netCDF file containing the results. \nAdditionally, the `GeoTIFF` format can be specified to yield separate files for each date. \n\n> Note that generating multiple GeoTIFF files as output is a unique feature available only in a batch job.\n\nBy default, the output variable is set to NDVI.\nHowever, by supplying one of the supported values listed above to the output parameter, a different result can be obtained.",
"cost_estimate": 50,
"cost_unit": "platform credits per km²",
"keywords": [
"agriculture",
"crops"
],
"language": {
"code": "en-US",
"name": "English (United States)"
},
"languages": [
{
"code": "en-US",
"name": "English (United States)"
}
],
"contacts": [
{
"name": "Stijn Caerts",
"position": "Researcher",
"organization": "VITO",
"links": [
{
"href": "https://www.vito.be/",
"rel": "about",
"type": "text/html"
}
],
"contactInstructions": "Contact via VITO",
"roles": [
"principal investigator"
]
},
{
"name": "Bram Janssen",
"position": "Researcher",
"organization": "VITO",
"links": [
{
"href": "https://www.vito.be/",
"rel": "about",
"type": "text/html"
}
],
"contactInstructions": "Contact via VITO",
"roles": [
"service provider"
]
},
{
"name": "Pratichhya Sharma",
"position": "Researcher",
"organization": "VITO",
"links": [
{
"href": "https://www.vito.be/",
"rel": "about",
"type": "text/html"
}
],
"contactInstructions": "Contact via VITO",
"roles": [
"service provider"
]
},
{
"name": "VITO",
"links": [
{
"href": "https://www.vito.be/",
"rel": "about",
"type": "text/html"
}
],
"contactInstructions": "SEE WEBSITE",
"roles": [
"processor"
]
}
],
"themes": [
{
"concepts": [
{
"id": "Leaf Area Index (LAI)"
},
{
"id": "Fraction of Absorbed Photosynthetic Active Radiation (fAPAR)"
},
{
"id": "Fraction of Vegetation Coverage (fCOVER)"
},
{
"id": "Sentinel-2 MSI"
},
{
"id": "Canopy Water Content (CWC)"
},
{
"id": "Canopy Chlorophyll Content (CCC)"
}
],
"scheme": "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/sciencekeywords"
}
],
"formats": [
{
"name": "GeoTiff"
}
],
"license": "other"
},
"linkTemplates": [],
"links": [
{
"rel": "openeo-process",
"type": "application/json",
"title": "openEO Process Definition",
"href": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/3215de22eded7c87c46122f073d15c7258af26b4/openeo_udp/cropsar_px/cropsar_px.json"
},
{
"rel": "service",
"type": "application/json",
"title": "CDSE openEO federation",
"href": "https://openeofed.dataspace.copernicus.eu"
},
{
"rel": "license",
"href": "https://apex.esa.int/license"
},
{
"rel": "example",
"type": "application/json",
"title": "Example output",
"href": "https://s3.waw3-1.cloudferro.com/swift/v1/apex-examples/cropsar_px/cropsar_px.nc"
}
]
}
49 changes: 49 additions & 0 deletions benchmark_scenarios/cropsar_px.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[
{
"id": "cropsar_px",
"type": "openeo",
"description": "Calculating FAPAR using Cropsar service available in Copernicus Data Space Ecosystem",
"backend": "openeofed.dataspace.copernicus.eu",
"process_graph": {
"cropsarpx1": {
"arguments": {
"enddate": "2021-01-20",
"output": "NDVI",
"spatial_extent": {
"coordinates": [
[
[
5.178303838475193,
51.252856237848164
],
[
5.178003609252369,
51.25109194151486
],
[
5.179280940922463,
51.25103833409551
],
[
5.179565949577788,
51.25278555186941
],
[
5.178303838475193,
51.252856237848164
]
]
],
"type": "Polygon"
},
"startdate": "2021-01-01"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the documentation:

Temporal filtering
For openEO processes that support arbitrary temporal ranges, we recommend using temporal_extent as the name of parameter to ensure consistency with other openEO processes, such as load_collection.

Many cases also require a time range with a fixed length. In such a case, you can allow to specify only the start or end date, and use the date_shift process to construct the second date in the temporal interval, ensuring a fixed length. This avoids faulty user input.
https://esa-apex.github.io/apex_documentation/guides/udp_writer_guide.html

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, however, in this case, it takes the start and end date separately and has date_shift implemented in the source code itself. So in that scenario I chose to go ahead with the date schema itself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, do make sure it is well documented

},
"namespace": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/3215de22eded7c87c46122f073d15c7258af26b4/openeo_udp/cropsar_px/cropsar_px.json",
"process_id": "cropsar_px"
}
},
"reference_data": {
"cropsar_px.nx": "https://s3.waw3-1.cloudferro.com/swift/v1/apex-examples/cropsar_px/cropsar_px.nc"
}
}
]
88 changes: 88 additions & 0 deletions openeo_udp/cropsar_px/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# CropSAR_px

## Description

The `CropSAR_px` process produces Sentinel-2 data cloud-free with a regularity of five-day intervals.
In the current version of the service, the output types supported include:

- NDVI
- FAPAR
- FCOVER

> The 'startdate' parameter corresponds to the date of the first image in the result.
> From this start date, a new image will be generated every five days up to, or beyond, the specified end date.

## Usage

The following example demonstrates how the 'CropSAR_px' process can be executed using an OpenEO batch job.
This batch job produces a netCDF file containing the results.
Additionally, the `GeoTIFF` format can be specified to yield separate files for each date.

```python

import openeo
connection = openeo.connect("openeofed.dataspace.copernicus.eu").authenticate_oidc()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accoring to the documentation:

We recommend including these sections:

Description: A short description of what the algorithm does.
Performance characteristics: Information on the computational efficiency of the algorithm. Include a relative cost if available.
Examples: One or more examples of the algorithm in action, using images or plots to show a typical result. Point to a STAC metadata file with an actual output asset to give users full insight into what is generated.
Literature references: If your algorithm is based on scientific literature, provide references to the relevant publications.
Known limitations: Any known limitations of the algorithm, such as the type of data it works best with, or the size of the area it can process efficiently.
Known artifacts: Use images and plots to clearly show any known artifacts that the algorithm may produce. This helps users to understand what to expect from the algorithm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted

spat_ext = {
"coordinates": [
[
[
5.178303838475193,
51.252856237848164
],
[
5.178003609252369,
51.25109194151486
],
[
5.179280940922463,
51.25103833409551
],
[
5.179565949577788,
51.25278555186941
],
[
5.178303838475193,
51.252856237848164
]
]
],
"type": "Polygon"
}

startdate = "2021-01-01"
enddate = "2021-01-20"
cropsarpx_id = 'cropsar_px'
namespace = "REPLACE_WITH_NAMESPACE"

cropsarpx = connection.datacube_from_process(
process_id=cropsarpx_id,
namespace=namespace,
spatial_extent=spat_ext,
startdate=startdate,
enddate=enddate,
output="NDVI"
)

cropsarpx.execute_batch('results/cropsar_px_290125.nc', title=f'cropsar_px', job_options={
"executor-memory": "2G",
"executor-memoryOverhead": "500m",
"python-memory": "3G"
})

```

## Parameters

The `CropSAR_px` process requires the following parameters:

- `startdate` (string): The start date of the time series.
- `enddate` (string): The end date of the time series.
- `spatial_extent` (dict): The spatial extent of the area of interest.
- `output` (string): The output type of the process. The supported output types are `NDVI`, `FAPAR`, and `FCOVER`.

When compared with few others processes shared in this repository, the `CropSAR_px` process require temporal extent to be defined using `startdate` and `enddate` parameters. It is due to the nature of the CropSAR_px workflow, which performs the date-shift of 90 days preceeding the start date and postceeding the end date.


Refer to this [blog post](https://blog.vito.be/remotesensing/cropsar2023) for more information on how to run batch jobs.
Loading