Skip to content

Commit 0a7bd1d

Browse files
Fix for if collection links are used.
1 parent fdcd45a commit 0a7bd1d

9 files changed

Lines changed: 609 additions & 2 deletions

openeo_driver/util/stac_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,11 @@ def recurse(item_path: Union[str, Path]) -> list:
106106
href = robust_urljoin(item_path, href)
107107

108108
if "rel" in link and (link["rel"] == "child" or link["rel"] == "item"):
109-
all_files.extend(get_files_from_stac_catalog(href, include_metadata))
110-
else:
109+
all_files.extend(recurse(href))
110+
elif ("rel" not in link) or (link["rel"] != "collection"):
111111
all_files.append(href)
112+
else:
113+
pass
112114
return all_files
113115

114116
return_files = recurse(catalog_path)
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"assets": {
3+
"1b442790-2231-4dd1-b9f4-d3550a512cd1_2023-06-06T00:00:00Z_openEO": {
4+
"bands": [
5+
{
6+
"name": "B04",
7+
"statistics": {
8+
"maximum": 1774.0,
9+
"mean": 380.50094473311,
10+
"minimum": 171.0,
11+
"stddev": 176.19790726983,
12+
"valid_percent": 85.92
13+
}
14+
},
15+
{
16+
"name": "B03",
17+
"statistics": {
18+
"maximum": 1470.0,
19+
"mean": 592.27586206896,
20+
"minimum": 282.0,
21+
"stddev": 138.20284171799,
22+
"valid_percent": 85.92
23+
}
24+
},
25+
{
26+
"name": "B02",
27+
"statistics": {
28+
"maximum": 1190.0,
29+
"mean": 412.22508266415,
30+
"minimum": 270.0,
31+
"stddev": 103.22080164099,
32+
"valid_percent": 85.92
33+
}
34+
}
35+
],
36+
"href": "./openEO_2023-06-06Z.tif",
37+
"proj:bbox": [
38+
644530.0,
39+
5675740.0,
40+
645300.0,
41+
5676380.0
42+
],
43+
"proj:code": "EPSG:32631",
44+
"proj:epsg": 32631,
45+
"proj:shape": [
46+
64,
47+
77
48+
],
49+
"roles": [
50+
"data"
51+
],
52+
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-06Z.tif",
53+
"type": "image/tiff; application=geotiff"
54+
}
55+
},
56+
"bbox": [
57+
5.069386757303357,
58+
51.214543255519786,
59+
5.080663210429039,
60+
51.22048989375812
61+
],
62+
"collection": "j-2606111953054049bc2368898439491e",
63+
"epsg": 32631,
64+
"geometry": {
65+
"coordinates": [
66+
[
67+
[
68+
5.0804038775948115,
69+
51.214543255519786
70+
],
71+
[
72+
5.080663210429039,
73+
51.22029444279013
74+
],
75+
[
76+
5.069644719194295,
77+
51.22048989375812
78+
],
79+
[
80+
5.069386757303357,
81+
51.21473866656907
82+
],
83+
[
84+
5.0804038775948115,
85+
51.214543255519786
86+
]
87+
]
88+
],
89+
"type": "Polygon"
90+
},
91+
"id": "1b442790-2231-4dd1-b9f4-d3550a512cd1_2023-06-06T00:00:00Z",
92+
"links": [
93+
{
94+
"href": "./collection.json",
95+
"rel": "collection",
96+
"type": "application/json"
97+
}
98+
],
99+
"properties": {
100+
"datetime": "2023-06-06T00:00:00Z",
101+
"proj:code": "EPSG:32631",
102+
"proj:epsg": 32631
103+
},
104+
"stac_extensions": [
105+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
106+
"https://stac-extensions.github.io/file/v2.1.0/schema.json",
107+
"https://stac-extensions.github.io/projection/v1.2.0/schema.json"
108+
],
109+
"stac_version": "1.1.0",
110+
"type": "Feature"
111+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
{
2+
"assets": {
3+
"75625346-7e28-433f-9918-8318369ff7ad_2023-06-01T00:00:00Z_openEO": {
4+
"bands": [
5+
{
6+
"name": "B04",
7+
"statistics": {
8+
"maximum": 1766.0,
9+
"mean": 401.07085498347,
10+
"minimum": 180.0,
11+
"stddev": 162.43588375276,
12+
"valid_percent": 85.92
13+
}
14+
},
15+
{
16+
"name": "B03",
17+
"statistics": {
18+
"maximum": 1336.0,
19+
"mean": 598.11572980633,
20+
"minimum": 278.0,
21+
"stddev": 133.74416960473,
22+
"valid_percent": 85.92
23+
}
24+
},
25+
{
26+
"name": "B02",
27+
"statistics": {
28+
"maximum": 1072.0,
29+
"mean": 368.17264997638,
30+
"minimum": 216.0,
31+
"stddev": 99.2670146459,
32+
"valid_percent": 85.92
33+
}
34+
}
35+
],
36+
"href": "./openEO_2023-06-01Z.tif",
37+
"proj:bbox": [
38+
644530.0,
39+
5675740.0,
40+
645300.0,
41+
5676380.0
42+
],
43+
"proj:code": "EPSG:32631",
44+
"proj:epsg": 32631,
45+
"proj:shape": [
46+
64,
47+
77
48+
],
49+
"roles": [
50+
"data"
51+
],
52+
"title": "s3://openeo-data-dev-waw4-1/batch_jobs/j-2606111953054049bc2368898439491e/openEO_2023-06-01Z.tif",
53+
"type": "image/tiff; application=geotiff"
54+
}
55+
},
56+
"bbox": [
57+
5.069386757303357,
58+
51.214543255519786,
59+
5.080663210429039,
60+
51.22048989375812
61+
],
62+
"collection": "j-2606111953054049bc2368898439491e",
63+
"epsg": 32631,
64+
"geometry": {
65+
"coordinates": [
66+
[
67+
[
68+
5.0804038775948115,
69+
51.214543255519786
70+
],
71+
[
72+
5.080663210429039,
73+
51.22029444279013
74+
],
75+
[
76+
5.069644719194295,
77+
51.22048989375812
78+
],
79+
[
80+
5.069386757303357,
81+
51.21473866656907
82+
],
83+
[
84+
5.0804038775948115,
85+
51.214543255519786
86+
]
87+
]
88+
],
89+
"type": "Polygon"
90+
},
91+
"id": "75625346-7e28-433f-9918-8318369ff7ad_2023-06-01T00:00:00Z",
92+
"links": [
93+
{
94+
"href": "./collection.json",
95+
"rel": "collection",
96+
"type": "application/json"
97+
}
98+
],
99+
"properties": {
100+
"datetime": "2023-06-01T00:00:00Z",
101+
"proj:code": "EPSG:32631",
102+
"proj:epsg": 32631
103+
},
104+
"stac_extensions": [
105+
"https://stac-extensions.github.io/eo/v1.1.0/schema.json",
106+
"https://stac-extensions.github.io/file/v2.1.0/schema.json",
107+
"https://stac-extensions.github.io/projection/v1.2.0/schema.json"
108+
],
109+
"stac_version": "1.1.0",
110+
"type": "Feature"
111+
}

0 commit comments

Comments
 (0)