-
Notifications
You must be signed in to change notification settings - Fork 2
Sentinel 1 Stats UDP ported to APEX #36
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
10a43db
Sentinel1 UDP generate file and json added
Pratichhya 24012a0
Algorithm Description
Pratichhya aa1b838
added generic json
Pratichhya c3239c8
benchmark example
Pratichhya 7307d77
addressed lint action failure
Pratichhya b14a006
updated process_id
Pratichhya 45da63c
typo
jdries 30d187c
fix unit test
HansVRP 6949259
review documentation
HansVRP 3d81c8c
review documentation
HansVRP a811e8b
review documentation
HansVRP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"id": "sentinel1_stats", | ||
"type": "Feature", | ||
"conformsTo": [ | ||
"http://www.opengis.net/spec/ogcapi-records-1/1.0/req/record-core" | ||
], | ||
"properties": { | ||
"created": "2024-10-03T00:00:00Z", | ||
"updated": "2024-10-03T00:00:00Z", | ||
"type": "apex_algorithm", | ||
"title": "Sentinel-1 statistics", | ||
"description": "A statistics algorithm for Sentinel-1 data, calculating the mean, median, minimum, and maximum values of the data.", | ||
"cost_estimate": 0.1, | ||
"cost_unit": "platform credits per km²", | ||
"keywords": [ | ||
"sentinel-1", | ||
"statistics" | ||
], | ||
"language": { | ||
"code": "en-US", | ||
"name": "English (United States)" | ||
}, | ||
"languages": [ | ||
{ | ||
"code": "en-US", | ||
"name": "English (United States)" | ||
} | ||
], | ||
"contacts": [ | ||
{ | ||
"name": "Pratichhya Sharma", | ||
"position": "Researcher", | ||
"organization": "VITO", | ||
"links": [ | ||
{ | ||
"href": "https://www.vito.be/", | ||
"rel": "about", | ||
"type": "text/html" | ||
}, | ||
{ | ||
"href": "https://github.com/pratichhya", | ||
"rel": "about", | ||
"type": "text/html" | ||
} | ||
], | ||
"contactInstructions": "Contact via VITO", | ||
"roles": [ | ||
"principal investigator" | ||
] | ||
}, | ||
{ | ||
"name": "VITO", | ||
"links": [ | ||
{ | ||
"href": "https://www.vito.be/", | ||
"rel": "about", | ||
"type": "text/html" | ||
} | ||
], | ||
"contactInstructions": "SEE WEBSITE", | ||
"roles": [ | ||
"processor" | ||
] | ||
} | ||
], | ||
"themes": [ | ||
{ | ||
"concepts": [ | ||
{ | ||
"id": "Active Remote Sensing" | ||
}, | ||
{ | ||
"id": "Sentinel-1 GRD" | ||
} | ||
], | ||
"scheme": "https://gcmd.earthdata.nasa.gov/kms/concept/c8fe757b-b530-4d67-a553-e4903f4430a5" | ||
} | ||
], | ||
"formats": [ | ||
"GeoTiff", | ||
"netCDF" | ||
], | ||
"license": "CC-BY-4.0" | ||
}, | ||
"linkTemplates": [], | ||
"links": [ | ||
{ | ||
"rel": "openeo-process", | ||
"type": "application/json", | ||
"title": "openEO Process Definition", | ||
"href": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/openeo_udp/sentinel1_stats/sentinel1_stats.json" | ||
}, | ||
{ | ||
"rel": "service", | ||
"type": "application/json", | ||
"title": "CDSE openEO federation", | ||
"href": "https://openeofed.dataspace.copernicus.eu" | ||
}, | ||
{ | ||
"rel": "example", | ||
"type": "application/json", | ||
"title": "Example output", | ||
"href": "https://s3.waw3-1.cloudferro.com/swift/v1/APEx-examples/sentinel_1/s1_stats.nc" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
algorithm_catalog/sentinel1_stats/sentinel1_stats_description.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Description | ||
|
||
This algorithm derives temporal statistics from the Sentinel-1 GRD collection for the selected spatial- and temporal extent of interest. In order to callibrate the SAR backscatter signal, `sigma0-ellipsoid` has been applied within this workflow. | ||
|
||
|
||
# Performance characteristics | ||
The algorithm was evaluated for a spatial extent of 20x20km, for a temporal period of 3 months. The total cost for the performed evaluation was equal to 4 credits, thereby highlighting the efficiency of the underlying algorithm. | ||
|
||
|
||
|
||
# Examples | ||
|
||
Below we show the derived minimum and maximum values for both VV and VH bands, calculated for the 20x20 km2 area of interest. | ||
|
||
 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[ | ||
{ | ||
"id": "sentinel1_stats", | ||
"type": "openeo", | ||
"description": "Sentinel 1 statistics example", | ||
"backend": "openeofed.dataspace.copernicus.eu", | ||
"process_graph": { | ||
"s1stats1": { | ||
"process_id": "sentinel1_stats", | ||
"namespace": "https://raw.githubusercontent.com/ESA-APEx/apex_algorithms/refs/heads/S1_stats/openeo_udp/sentinel1_stats/sentinel1_stats.json", | ||
"arguments": { | ||
"spatial_extent": { | ||
"east": 8.92, | ||
"north": 44.45, | ||
"south": 44.4, | ||
"west": 8.82 | ||
}, | ||
"temporal_extent": [ | ||
"2023-05-01", | ||
"2023-07-30" | ||
] | ||
}, | ||
"result": true | ||
} | ||
} | ||
} | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Calculate S1 SAR stats (min, max, mean, sd, q10, q50, q90). | ||
|
||
This service can cost an approximate of 3-5 credits per sq km. | ||
This cost is based on resource consumption only and added-value cost has not been included. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
import json | ||
from pathlib import Path | ||
|
||
import openeo | ||
from openeo.api.process import Parameter | ||
from openeo.rest.udp import build_process_dict | ||
from openeo.processes import array_create, array_concat | ||
|
||
|
||
def generate() -> dict: | ||
# TODO: use/inject dummy connection instead of concrete one? (See cdse_marketplace_services) | ||
connection = openeo.connect("openeofed.dataspace.copernicus.eu") | ||
|
||
# define parameters | ||
spatial_extent = Parameter.bounding_box( | ||
name="spatial_extent", | ||
default={"west": 8.82, "south": 44.40, "east": 8.92, "north": 44.45}, | ||
) | ||
temporal_extent = Parameter.temporal_interval( | ||
name="temporal_extent", default=["2023-05-01", "2023-07-30"] | ||
) | ||
|
||
# load collection | ||
s1_raw = connection.load_collection( | ||
collection_id="SENTINEL1_GRD", | ||
temporal_extent=temporal_extent, | ||
spatial_extent=spatial_extent, | ||
bands=["VH", "VV"], | ||
HansVRP marked this conversation as resolved.
Show resolved
Hide resolved
|
||
) | ||
|
||
# apply back scatter filtering | ||
s1_raw = s1_raw.sar_backscatter(coefficient="sigma0-ellipsoid") | ||
|
||
# calculate stats | ||
s1_stats = s1_raw.apply_dimension( | ||
process=lambda data: array_concat( | ||
array1=array_create([data.min(), data.max(), data.mean(), data.sd()]), | ||
array2=data.quantiles([0.1, 0.5, 0.9]), | ||
), | ||
dimension="t", | ||
target_dimension="bands", | ||
) | ||
|
||
# rename the generated bands | ||
s1_stats = s1_stats.rename_labels( | ||
"bands", | ||
[ | ||
f"{b}_{s}" | ||
for b in s1_stats.metadata.band_names | ||
for s in ["min", "max", "mean", "sd", "q10", "q50", "q90"] | ||
], | ||
) | ||
|
||
return build_process_dict( | ||
process_graph=s1_stats, | ||
process_id="sentinel1_stats", | ||
summary="Calculate Sentinel-1 SAR stats", | ||
description=(Path(__file__).parent / "README.md").read_text(), | ||
parameters=[ | ||
spatial_extent, | ||
temporal_extent | ||
], | ||
returns=None, # TODO | ||
categories=None, # TODO | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
# TODO: how to enforce a useful order of top-level keys? | ||
# save the generated process to a file | ||
with open(Path(__file__).parent / "sentinel1_stats.json", "w") as f: | ||
json.dump(generate(), f, indent=2) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.