eodash_catalog 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of eodash_catalog might be problematic. Click here for more details.
- eodash_catalog/__about__.py +1 -1
- eodash_catalog/endpoints.py +250 -173
- eodash_catalog/generate_indicators.py +105 -74
- eodash_catalog/sh_endpoint.py +3 -1
- eodash_catalog/stac_handling.py +127 -101
- eodash_catalog/thumbnails.py +14 -12
- eodash_catalog/utils.py +14 -12
- {eodash_catalog-0.0.11.dist-info → eodash_catalog-0.0.12.dist-info}/METADATA +1 -1
- eodash_catalog-0.0.12.dist-info/RECORD +14 -0
- eodash_catalog-0.0.11.dist-info/RECORD +0 -14
- {eodash_catalog-0.0.11.dist-info → eodash_catalog-0.0.12.dist-info}/WHEEL +0 -0
- {eodash_catalog-0.0.11.dist-info → eodash_catalog-0.0.12.dist-info}/entry_points.txt +0 -0
- {eodash_catalog-0.0.11.dist-info → eodash_catalog-0.0.12.dist-info}/licenses/LICENSE.txt +0 -0
eodash_catalog/stac_handling.py
CHANGED
|
@@ -19,15 +19,19 @@ from yaml.loader import SafeLoader
|
|
|
19
19
|
from eodash_catalog.utils import generateDateIsostringsFromInterval
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def
|
|
23
|
-
catalog: Catalog,
|
|
24
|
-
|
|
22
|
+
def get_or_create_collection(
|
|
23
|
+
catalog: Catalog,
|
|
24
|
+
collection_id: str,
|
|
25
|
+
collection_config: dict,
|
|
26
|
+
catalog_config: dict,
|
|
27
|
+
endpoint_config: dict,
|
|
28
|
+
) -> Collection:
|
|
25
29
|
# Check if collection already in catalog
|
|
26
30
|
for collection in catalog.get_collections():
|
|
27
31
|
if collection.id == collection_id:
|
|
28
|
-
return collection
|
|
32
|
+
return collection
|
|
29
33
|
# If none found create a new one
|
|
30
|
-
spatial_extent =
|
|
34
|
+
spatial_extent = endpoint_config.get("OverwriteBBox", [-180.0, -90.0, 180.0, 90.0])
|
|
31
35
|
|
|
32
36
|
spatial_extent = SpatialExtent(
|
|
33
37
|
[
|
|
@@ -36,51 +40,51 @@ def get_or_create_collection_and_times(
|
|
|
36
40
|
)
|
|
37
41
|
times: list[str] = []
|
|
38
42
|
temporal_extent = TemporalExtent([[datetime.now(), None]])
|
|
39
|
-
if
|
|
40
|
-
if
|
|
41
|
-
times = list(
|
|
43
|
+
if endpoint_config and endpoint_config.get("Type") == "OverwriteTimes":
|
|
44
|
+
if endpoint_config.get("Times"):
|
|
45
|
+
times = list(endpoint_config.get("Times", []))
|
|
42
46
|
times_datetimes = sorted([parser.isoparse(time) for time in times])
|
|
43
47
|
temporal_extent = TemporalExtent([[times_datetimes[0], times_datetimes[-1]]])
|
|
44
|
-
elif
|
|
45
|
-
start =
|
|
46
|
-
end =
|
|
47
|
-
timedelta_config =
|
|
48
|
+
elif endpoint_config.get("DateTimeInterval"):
|
|
49
|
+
start = endpoint_config["DateTimeInterval"].get("Start", "2020-09-01T00:00:00")
|
|
50
|
+
end = endpoint_config["DateTimeInterval"].get("End", "2020-10-01T00:00:00")
|
|
51
|
+
timedelta_config = endpoint_config["DateTimeInterval"].get("Timedelta", {"days": 1})
|
|
48
52
|
times = generateDateIsostringsFromInterval(start, end, timedelta_config)
|
|
49
53
|
times_datetimes = sorted([parser.isoparse(time) for time in times])
|
|
50
54
|
temporal_extent = TemporalExtent([[times_datetimes[0], times_datetimes[-1]]])
|
|
51
55
|
extent = Extent(spatial=spatial_extent, temporal=temporal_extent)
|
|
52
56
|
|
|
53
57
|
# Check if description is link to markdown file
|
|
54
|
-
if "Description" in
|
|
55
|
-
description =
|
|
58
|
+
if "Description" in collection_config:
|
|
59
|
+
description = collection_config["Description"]
|
|
56
60
|
if description.endswith((".md", ".MD")):
|
|
57
61
|
if description.startswith("http"):
|
|
58
62
|
# if full absolute path is defined
|
|
59
63
|
response = requests.get(description)
|
|
60
64
|
if response.status_code == 200:
|
|
61
65
|
description = response.text
|
|
62
|
-
elif "Subtitle" in
|
|
66
|
+
elif "Subtitle" in collection_config:
|
|
63
67
|
print("WARNING: Markdown file could not be fetched")
|
|
64
|
-
description =
|
|
68
|
+
description = collection_config["Subtitle"]
|
|
65
69
|
else:
|
|
66
70
|
# relative path to assets was given
|
|
67
|
-
response = requests.get(f"{
|
|
71
|
+
response = requests.get(f"{catalog_config["assets_endpoint"]}/{description}")
|
|
68
72
|
if response.status_code == 200:
|
|
69
73
|
description = response.text
|
|
70
|
-
elif "Subtitle" in
|
|
74
|
+
elif "Subtitle" in collection_config:
|
|
71
75
|
print("WARNING: Markdown file could not be fetched")
|
|
72
|
-
description =
|
|
73
|
-
elif "Subtitle" in
|
|
76
|
+
description = collection_config["Subtitle"]
|
|
77
|
+
elif "Subtitle" in collection_config:
|
|
74
78
|
# Try to use at least subtitle to fill some information
|
|
75
|
-
description =
|
|
79
|
+
description = collection_config["Subtitle"]
|
|
76
80
|
|
|
77
81
|
collection = Collection(
|
|
78
82
|
id=collection_id,
|
|
79
|
-
title=
|
|
83
|
+
title=collection_config["Title"],
|
|
80
84
|
description=description,
|
|
81
85
|
extent=extent,
|
|
82
86
|
)
|
|
83
|
-
return
|
|
87
|
+
return collection
|
|
84
88
|
|
|
85
89
|
|
|
86
90
|
def create_web_map_link(layer: dict, role: str) -> Link:
|
|
@@ -117,16 +121,19 @@ def create_web_map_link(layer: dict, role: str) -> Link:
|
|
|
117
121
|
|
|
118
122
|
|
|
119
123
|
def add_example_info(
|
|
120
|
-
stac_object: Collection | Catalog,
|
|
124
|
+
stac_object: Collection | Catalog,
|
|
125
|
+
collection_config: dict,
|
|
126
|
+
endpoint_config: dict,
|
|
127
|
+
catalog_config: dict,
|
|
121
128
|
) -> None:
|
|
122
|
-
if "Services" in
|
|
123
|
-
for service in
|
|
129
|
+
if "Services" in collection_config:
|
|
130
|
+
for service in collection_config["Services"]:
|
|
124
131
|
if service["Name"] == "Statistical API":
|
|
125
132
|
service_type = service.get("Type", "byoc")
|
|
126
133
|
stac_object.add_link(
|
|
127
134
|
Link(
|
|
128
135
|
rel="example",
|
|
129
|
-
target="{}/{}".format(
|
|
136
|
+
target="{}/{}".format(catalog_config["assets_endpoint"], service["Script"]),
|
|
130
137
|
title="evalscript",
|
|
131
138
|
media_type="application/javascript",
|
|
132
139
|
extra_fields={
|
|
@@ -161,13 +168,13 @@ def add_example_info(
|
|
|
161
168
|
},
|
|
162
169
|
)
|
|
163
170
|
)
|
|
164
|
-
elif "Resources" in
|
|
165
|
-
for service in
|
|
171
|
+
elif "Resources" in collection_config:
|
|
172
|
+
for service in collection_config["Resources"]:
|
|
166
173
|
if service.get("Name") == "xcube":
|
|
167
174
|
target_url = "{}/timeseries/{}/{}?aggMethods=median".format(
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
175
|
+
endpoint_config["EndPoint"],
|
|
176
|
+
endpoint_config["DatacubeId"],
|
|
177
|
+
endpoint_config["Variable"],
|
|
171
178
|
)
|
|
172
179
|
stac_object.add_link(
|
|
173
180
|
Link(
|
|
@@ -183,25 +190,27 @@ def add_example_info(
|
|
|
183
190
|
)
|
|
184
191
|
|
|
185
192
|
|
|
186
|
-
def add_collection_information(
|
|
193
|
+
def add_collection_information(
|
|
194
|
+
catalog_config: dict, collection: Collection, collection_config: dict
|
|
195
|
+
) -> None:
|
|
187
196
|
# Add metadata information
|
|
188
197
|
# Check license identifier
|
|
189
|
-
if "License" in
|
|
198
|
+
if "License" in collection_config:
|
|
190
199
|
# Check if list was provided
|
|
191
|
-
if isinstance(
|
|
192
|
-
if len(
|
|
200
|
+
if isinstance(collection_config["License"], list):
|
|
201
|
+
if len(collection_config["License"]) == 1:
|
|
193
202
|
collection.license = "proprietary"
|
|
194
203
|
link = Link(
|
|
195
204
|
rel="license",
|
|
196
|
-
target=
|
|
197
|
-
media_type=(
|
|
205
|
+
target=collection_config["License"][0]["Url"],
|
|
206
|
+
media_type=(collection_config["License"][0].get("Type", "text/html")),
|
|
198
207
|
)
|
|
199
|
-
if "Title" in
|
|
200
|
-
link.title =
|
|
208
|
+
if "Title" in collection_config["License"][0]:
|
|
209
|
+
link.title = collection_config["License"][0]["Title"]
|
|
201
210
|
collection.links.append(link)
|
|
202
|
-
elif len(
|
|
211
|
+
elif len(collection_config["License"]) > 1:
|
|
203
212
|
collection.license = "various"
|
|
204
|
-
for license_entry in
|
|
213
|
+
for license_entry in collection_config["License"]:
|
|
205
214
|
link = Link(
|
|
206
215
|
rel="license",
|
|
207
216
|
target=license_entry["Url"],
|
|
@@ -213,7 +222,7 @@ def add_collection_information(config: dict, collection: Collection, data: dict)
|
|
|
213
222
|
link.title = license_entry["Title"]
|
|
214
223
|
collection.links.append(link)
|
|
215
224
|
else:
|
|
216
|
-
license_data = lookup.by_id(
|
|
225
|
+
license_data = lookup.by_id(collection_config["License"])
|
|
217
226
|
if license_data is not None:
|
|
218
227
|
collection.license = license_data.id
|
|
219
228
|
if license_data.sources:
|
|
@@ -234,65 +243,65 @@ def add_collection_information(config: dict, collection: Collection, data: dict)
|
|
|
234
243
|
# print("WARNING: No license was provided, falling back to proprietary")
|
|
235
244
|
pass
|
|
236
245
|
|
|
237
|
-
if "Provider" in
|
|
246
|
+
if "Provider" in collection_config:
|
|
238
247
|
try:
|
|
239
248
|
collection.providers = [
|
|
240
249
|
Provider(
|
|
241
250
|
# convert information to lower case
|
|
242
251
|
**{k.lower(): v for k, v in provider.items()}
|
|
243
252
|
)
|
|
244
|
-
for provider in
|
|
253
|
+
for provider in collection_config["Provider"]
|
|
245
254
|
]
|
|
246
255
|
except Exception:
|
|
247
256
|
print(f"WARNING: Issue creating provider information for collection: {collection.id}")
|
|
248
257
|
|
|
249
|
-
if "Citation" in
|
|
250
|
-
if "DOI" in
|
|
251
|
-
collection.extra_fields["sci:doi"] =
|
|
252
|
-
if "Citation" in
|
|
253
|
-
collection.extra_fields["sci:citation"] =
|
|
254
|
-
if "Publication" in
|
|
258
|
+
if "Citation" in collection_config:
|
|
259
|
+
if "DOI" in collection_config["Citation"]:
|
|
260
|
+
collection.extra_fields["sci:doi"] = collection_config["Citation"]["DOI"]
|
|
261
|
+
if "Citation" in collection_config["Citation"]:
|
|
262
|
+
collection.extra_fields["sci:citation"] = collection_config["Citation"]["Citation"]
|
|
263
|
+
if "Publication" in collection_config["Citation"]:
|
|
255
264
|
collection.extra_fields["sci:publications"] = [
|
|
256
265
|
# convert keys to lower case
|
|
257
266
|
{k.lower(): v for k, v in publication.items()}
|
|
258
|
-
for publication in
|
|
267
|
+
for publication in collection_config["Citation"]["Publication"]
|
|
259
268
|
]
|
|
260
269
|
|
|
261
|
-
if "Subtitle" in
|
|
262
|
-
collection.extra_fields["subtitle"] =
|
|
263
|
-
if "Legend" in
|
|
270
|
+
if "Subtitle" in collection_config:
|
|
271
|
+
collection.extra_fields["subtitle"] = collection_config["Subtitle"]
|
|
272
|
+
if "Legend" in collection_config:
|
|
264
273
|
collection.add_asset(
|
|
265
274
|
"legend",
|
|
266
275
|
Asset(
|
|
267
|
-
href=f"{
|
|
276
|
+
href=f"{catalog_config["assets_endpoint"]}/{collection_config["Legend"]}",
|
|
268
277
|
media_type="image/png",
|
|
269
278
|
roles=["metadata"],
|
|
270
279
|
),
|
|
271
280
|
)
|
|
272
|
-
if "Story" in
|
|
281
|
+
if "Story" in collection_config:
|
|
273
282
|
collection.add_asset(
|
|
274
283
|
"story",
|
|
275
284
|
Asset(
|
|
276
|
-
href=f"{
|
|
285
|
+
href=f"{catalog_config["assets_endpoint"]}/{collection_config["Story"]}",
|
|
277
286
|
media_type="text/markdown",
|
|
278
287
|
roles=["metadata"],
|
|
279
288
|
),
|
|
280
289
|
)
|
|
281
|
-
if "Image" in
|
|
290
|
+
if "Image" in collection_config:
|
|
282
291
|
collection.add_asset(
|
|
283
292
|
"thumbnail",
|
|
284
293
|
Asset(
|
|
285
|
-
href=f"{
|
|
294
|
+
href=f"{catalog_config["assets_endpoint"]}/{collection_config["Image"]}",
|
|
286
295
|
media_type="image/png",
|
|
287
296
|
roles=["thumbnail"],
|
|
288
297
|
),
|
|
289
298
|
)
|
|
290
299
|
# Add extra fields to collection if available
|
|
291
|
-
add_extra_fields(collection,
|
|
300
|
+
add_extra_fields(collection, collection_config)
|
|
292
301
|
|
|
293
|
-
if "References" in
|
|
302
|
+
if "References" in collection_config:
|
|
294
303
|
generic_counter = 1
|
|
295
|
-
for ref in
|
|
304
|
+
for ref in collection_config["References"]:
|
|
296
305
|
if "Key" in ref:
|
|
297
306
|
key = ref["Key"]
|
|
298
307
|
else:
|
|
@@ -309,56 +318,73 @@ def add_collection_information(config: dict, collection: Collection, data: dict)
|
|
|
309
318
|
)
|
|
310
319
|
|
|
311
320
|
|
|
312
|
-
def add_base_overlay_info(
|
|
321
|
+
def add_base_overlay_info(
|
|
322
|
+
collection: Collection, catalog_config: dict, collection_config: dict
|
|
323
|
+
) -> None:
|
|
313
324
|
# check if default base layers defined
|
|
314
|
-
if "default_base_layers" in
|
|
315
|
-
with open(f"{
|
|
325
|
+
if "default_base_layers" in catalog_config:
|
|
326
|
+
with open(f"{catalog_config["default_base_layers"]}.yaml") as f:
|
|
316
327
|
base_layers = yaml.load(f, Loader=SafeLoader)
|
|
317
328
|
for layer in base_layers:
|
|
318
329
|
collection.add_link(create_web_map_link(layer, role="baselayer"))
|
|
319
330
|
# check if default overlay layers defined
|
|
320
|
-
if "default_overlay_layers" in
|
|
321
|
-
with open("{}.yaml".format(
|
|
331
|
+
if "default_overlay_layers" in catalog_config:
|
|
332
|
+
with open("{}.yaml".format(catalog_config["default_overlay_layers"])) as f:
|
|
322
333
|
overlay_layers = yaml.load(f, Loader=SafeLoader)
|
|
323
334
|
for layer in overlay_layers:
|
|
324
335
|
collection.add_link(create_web_map_link(layer, role="overlay"))
|
|
325
|
-
if "BaseLayers" in
|
|
326
|
-
for layer in
|
|
336
|
+
if "BaseLayers" in collection_config:
|
|
337
|
+
for layer in collection_config["BaseLayers"]:
|
|
327
338
|
collection.add_link(create_web_map_link(layer, role="baselayer"))
|
|
328
|
-
if "OverlayLayers" in
|
|
329
|
-
for layer in
|
|
339
|
+
if "OverlayLayers" in collection_config:
|
|
340
|
+
for layer in collection_config["OverlayLayers"]:
|
|
330
341
|
collection.add_link(create_web_map_link(layer, role="overlay"))
|
|
331
342
|
# TODO: possibility to overwrite default base and overlay layers
|
|
332
343
|
|
|
333
344
|
|
|
334
|
-
def add_extra_fields(stac_object: Collection | Catalog | Link,
|
|
335
|
-
if "yAxis" in
|
|
336
|
-
stac_object.extra_fields["yAxis"] =
|
|
337
|
-
if "Themes" in
|
|
338
|
-
stac_object.extra_fields["themes"] =
|
|
339
|
-
if "Locations" in
|
|
345
|
+
def add_extra_fields(stac_object: Collection | Catalog | Link, collection_config: dict) -> None:
|
|
346
|
+
if "yAxis" in collection_config:
|
|
347
|
+
stac_object.extra_fields["yAxis"] = collection_config["yAxis"]
|
|
348
|
+
if "Themes" in collection_config:
|
|
349
|
+
stac_object.extra_fields["themes"] = collection_config["Themes"]
|
|
350
|
+
if "Locations" in collection_config or "Subcollections" in collection_config:
|
|
340
351
|
stac_object.extra_fields["locations"] = True
|
|
341
|
-
if "Tags" in
|
|
342
|
-
stac_object.extra_fields["tags"] =
|
|
343
|
-
if "Satellite" in
|
|
344
|
-
stac_object.extra_fields["satellite"] =
|
|
345
|
-
if "Sensor" in
|
|
346
|
-
stac_object.extra_fields["sensor"] =
|
|
347
|
-
if "Agency" in
|
|
348
|
-
stac_object.extra_fields["agency"] =
|
|
349
|
-
if "yAxis" in
|
|
350
|
-
stac_object.extra_fields["yAxis"] =
|
|
351
|
-
if "EodashIdentifier" in
|
|
352
|
-
stac_object.extra_fields["subcode"] =
|
|
353
|
-
if "DataSource" in
|
|
354
|
-
if "Spaceborne" in
|
|
355
|
-
if "Sensor" in
|
|
356
|
-
stac_object.extra_fields["sensor"] =
|
|
357
|
-
|
|
358
|
-
stac_object.extra_fields["satellite"] = data["DataSource"]["Spaceborne"][
|
|
359
|
-
"Satellite"
|
|
352
|
+
if "Tags" in collection_config:
|
|
353
|
+
stac_object.extra_fields["tags"] = collection_config["Tags"]
|
|
354
|
+
if "Satellite" in collection_config:
|
|
355
|
+
stac_object.extra_fields["satellite"] = collection_config["Satellite"]
|
|
356
|
+
if "Sensor" in collection_config:
|
|
357
|
+
stac_object.extra_fields["sensor"] = collection_config["Sensor"]
|
|
358
|
+
if "Agency" in collection_config:
|
|
359
|
+
stac_object.extra_fields["agency"] = collection_config["Agency"]
|
|
360
|
+
if "yAxis" in collection_config:
|
|
361
|
+
stac_object.extra_fields["yAxis"] = collection_config["yAxis"]
|
|
362
|
+
if "EodashIdentifier" in collection_config:
|
|
363
|
+
stac_object.extra_fields["subcode"] = collection_config["EodashIdentifier"]
|
|
364
|
+
if "DataSource" in collection_config:
|
|
365
|
+
if "Spaceborne" in collection_config["DataSource"]:
|
|
366
|
+
if "Sensor" in collection_config["DataSource"]["Spaceborne"]:
|
|
367
|
+
stac_object.extra_fields["sensor"] = collection_config["DataSource"]["Spaceborne"][
|
|
368
|
+
"Sensor"
|
|
360
369
|
]
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
370
|
+
if "Satellite" in collection_config["DataSource"]["Spaceborne"]:
|
|
371
|
+
stac_object.extra_fields["satellite"] = collection_config["DataSource"][
|
|
372
|
+
"Spaceborne"
|
|
373
|
+
]["Satellite"]
|
|
374
|
+
if "InSitu" in collection_config["DataSource"]:
|
|
375
|
+
stac_object.extra_fields["insituSources"] = collection_config["DataSource"]["InSitu"]
|
|
376
|
+
if "Other" in collection_config["DataSource"]:
|
|
377
|
+
stac_object.extra_fields["otherSources"] = collection_config["DataSource"]["Other"]
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def get_collection_times_from_config(endpoint_config: dict) -> list[str]:
|
|
381
|
+
times: list[str] = []
|
|
382
|
+
if endpoint_config and endpoint_config.get("Type") == "OverwriteTimes":
|
|
383
|
+
if endpoint_config.get("Times"):
|
|
384
|
+
times = list(endpoint_config.get("Times", []))
|
|
385
|
+
elif endpoint_config.get("DateTimeInterval"):
|
|
386
|
+
start = endpoint_config["DateTimeInterval"].get("Start", "2020-09-01T00:00:00")
|
|
387
|
+
end = endpoint_config["DateTimeInterval"].get("End", "2020-10-01T00:00:00")
|
|
388
|
+
timedelta_config = endpoint_config["DateTimeInterval"].get("Timedelta", {"days": 1})
|
|
389
|
+
times = generateDateIsostringsFromInterval(start, end, timedelta_config)
|
|
390
|
+
return times
|
eodash_catalog/thumbnails.py
CHANGED
|
@@ -10,8 +10,10 @@ from pystac import (
|
|
|
10
10
|
from eodash_catalog.utils import generate_veda_cog_link
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
def fetch_and_save_thumbnail(
|
|
14
|
-
collection_path = "../thumbnails/{}_{}/".format(
|
|
13
|
+
def fetch_and_save_thumbnail(collection_config: dict, url: str) -> None:
|
|
14
|
+
collection_path = "../thumbnails/{}_{}/".format(
|
|
15
|
+
collection_config["EodashIdentifier"], collection_config["Name"]
|
|
16
|
+
)
|
|
15
17
|
Path(collection_path).mkdir(parents=True, exist_ok=True)
|
|
16
18
|
image_path = f"{collection_path}/thumbnail.png"
|
|
17
19
|
if not os.path.exists(image_path):
|
|
@@ -22,15 +24,15 @@ def fetch_and_save_thumbnail(data: dict, url: str) -> None:
|
|
|
22
24
|
|
|
23
25
|
def generate_thumbnail(
|
|
24
26
|
stac_object: Item,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
collection_config: dict,
|
|
28
|
+
endpoint_config: dict,
|
|
27
29
|
file_url: str = "",
|
|
28
30
|
time: str | None = None,
|
|
29
31
|
) -> None:
|
|
30
|
-
if
|
|
32
|
+
if endpoint_config["Name"] == "Sentinel Hub" or endpoint_config["Name"] == "WMS":
|
|
31
33
|
instanceId = os.getenv("SH_INSTANCE_ID")
|
|
32
|
-
if "InstanceId" in
|
|
33
|
-
instanceId =
|
|
34
|
+
if "InstanceId" in endpoint_config:
|
|
35
|
+
instanceId = endpoint_config["InstanceId"]
|
|
34
36
|
# Build example url
|
|
35
37
|
wms_config = (
|
|
36
38
|
"REQUEST=GetMap&SERVICE=WMS&VERSION=1.3.0&FORMAT=image/png&STYLES=&TRANSPARENT=true"
|
|
@@ -47,13 +49,13 @@ def generate_thumbnail(
|
|
|
47
49
|
url = "https://services.sentinel-hub.com/ogc/wms/{}?{}&layers={}&time={}&{}".format(
|
|
48
50
|
instanceId,
|
|
49
51
|
wms_config,
|
|
50
|
-
|
|
52
|
+
endpoint_config["LayerId"],
|
|
51
53
|
time,
|
|
52
54
|
output_format,
|
|
53
55
|
)
|
|
54
|
-
fetch_and_save_thumbnail(
|
|
55
|
-
elif
|
|
56
|
-
target_url = generate_veda_cog_link(
|
|
56
|
+
fetch_and_save_thumbnail(collection_config, url)
|
|
57
|
+
elif endpoint_config["Name"] == "VEDA":
|
|
58
|
+
target_url = generate_veda_cog_link(endpoint_config, file_url)
|
|
57
59
|
# set to get 0/0/0 tile
|
|
58
60
|
url = re.sub(r"\{.\}", "0", target_url)
|
|
59
|
-
fetch_and_save_thumbnail(
|
|
61
|
+
fetch_and_save_thumbnail(collection_config, url)
|
eodash_catalog/utils.py
CHANGED
|
@@ -177,30 +177,32 @@ def iter_len_at_least(i, n: int) -> int:
|
|
|
177
177
|
return sum(1 for _ in zip(range(n), i, strict=False)) == n
|
|
178
178
|
|
|
179
179
|
|
|
180
|
-
def generate_veda_cog_link(
|
|
180
|
+
def generate_veda_cog_link(endpoint_config: dict, file_url: str | None) -> str:
|
|
181
181
|
bidx = ""
|
|
182
|
-
if "Bidx" in
|
|
182
|
+
if "Bidx" in endpoint_config:
|
|
183
183
|
# Check if an array was provided
|
|
184
|
-
if hasattr(
|
|
185
|
-
for band in
|
|
184
|
+
if hasattr(endpoint_config["Bidx"], "__len__"):
|
|
185
|
+
for band in endpoint_config["Bidx"]:
|
|
186
186
|
bidx = bidx + f"&bidx={band}"
|
|
187
187
|
else:
|
|
188
|
-
bidx = "&bidx={}".format(
|
|
188
|
+
bidx = "&bidx={}".format(endpoint_config["Bidx"])
|
|
189
189
|
|
|
190
190
|
colormap = ""
|
|
191
|
-
if "Colormap" in
|
|
192
|
-
colormap = "&colormap={}".format(
|
|
191
|
+
if "Colormap" in endpoint_config:
|
|
192
|
+
colormap = "&colormap={}".format(endpoint_config["Colormap"])
|
|
193
193
|
# TODO: For now we assume a already urlparsed colormap definition
|
|
194
194
|
# it could be nice to allow a json and better convert it on the fly
|
|
195
|
-
# colormap = "&colormap=%s"%(urllib.parse.quote(str(
|
|
195
|
+
# colormap = "&colormap=%s"%(urllib.parse.quote(str(endpoint_config["Colormap"])))
|
|
196
196
|
|
|
197
197
|
colormap_name = ""
|
|
198
|
-
if "ColormapName" in
|
|
199
|
-
colormap_name = "&colormap_name={}".format(
|
|
198
|
+
if "ColormapName" in endpoint_config:
|
|
199
|
+
colormap_name = "&colormap_name={}".format(endpoint_config["ColormapName"])
|
|
200
200
|
|
|
201
201
|
rescale = ""
|
|
202
|
-
if "Rescale" in
|
|
203
|
-
rescale = "&rescale={},{}".format(
|
|
202
|
+
if "Rescale" in endpoint_config:
|
|
203
|
+
rescale = "&rescale={},{}".format(
|
|
204
|
+
endpoint_config["Rescale"][0], endpoint_config["Rescale"][1]
|
|
205
|
+
)
|
|
204
206
|
|
|
205
207
|
file_url = f"url={file_url}&" if file_url else ""
|
|
206
208
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.12
|
|
4
4
|
Summary: This package is intended to help create a compatible STAC catalog for the eodash dashboard client. It supports configuration of multiple endpoint types for information extraction.
|
|
5
5
|
Project-URL: Documentation, https://github.com/eodash/eodash_catalog#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/eodash/eodash_catalog/issues
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
eodash_catalog/__about__.py,sha256=yEv4frNTeX9AbT5lO3thIJjP9R5pEQJ0AzODE6sN9tI,138
|
|
2
|
+
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
+
eodash_catalog/duration.py,sha256=B6XOZfvNU7SuqpxuVtT1kNKODoOQJXDI6mocvA_U1ik,10816
|
|
4
|
+
eodash_catalog/endpoints.py,sha256=o0m0dMmfvZ2ybRnHW-am4g4vjoQhFMNbnQ_xI2kE_D8,30658
|
|
5
|
+
eodash_catalog/generate_indicators.py,sha256=aTh7RHhUVfDjaWNH4GYiLuzC7Z8fQEfJGfckdkjwFOs,18454
|
|
6
|
+
eodash_catalog/sh_endpoint.py,sha256=vELooJwk269v1DNnOzb32vil96vL_SRCio8UBlx10N0,618
|
|
7
|
+
eodash_catalog/stac_handling.py,sha256=uHsAR-H3Js2pDOcIw2ApTUWAuSApnLkpjf0OUBHQ7_Q,16637
|
|
8
|
+
eodash_catalog/thumbnails.py,sha256=31Wk38oNQDxfhSUbMLBpHuZFhsR8v_7luYr65XQtDf0,2213
|
|
9
|
+
eodash_catalog/utils.py,sha256=JnXrXtq3bOmECPlSn86Mz35sDTOkgptz87lrISfE1Uo,7968
|
|
10
|
+
eodash_catalog-0.0.12.dist-info/METADATA,sha256=1kYgr6SXzhIj2nE-EsoRwpw-bMJVYdz_sVLLCaZzT08,3203
|
|
11
|
+
eodash_catalog-0.0.12.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
12
|
+
eodash_catalog-0.0.12.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
+
eodash_catalog-0.0.12.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
+
eodash_catalog-0.0.12.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
eodash_catalog/__about__.py,sha256=Zuvv0AbtNybzWIAcoTcWpq2fDAxHl6M_njE7M-xUEzM,138
|
|
2
|
-
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
-
eodash_catalog/duration.py,sha256=B6XOZfvNU7SuqpxuVtT1kNKODoOQJXDI6mocvA_U1ik,10816
|
|
4
|
-
eodash_catalog/endpoints.py,sha256=VMs7A7gN9S9brb7k8RAmzS0DCYLzRC65If4xMg60bK8,26886
|
|
5
|
-
eodash_catalog/generate_indicators.py,sha256=-otR-RzlJQPyi6M7CkuTF39dm6ZHIpb-BRUeZ1GK_vQ,17132
|
|
6
|
-
eodash_catalog/sh_endpoint.py,sha256=41Tcnvq6-S8mLZaauW0RdA4kZB8ay4Zsa40euRg_IRM,589
|
|
7
|
-
eodash_catalog/stac_handling.py,sha256=_kBr9ES9XgmsONW2Q7PoL9k0QcmwZC5lhFl6l6AUwXk,14645
|
|
8
|
-
eodash_catalog/thumbnails.py,sha256=SliAEgch7_LjgZcto30Ae39sWZ9T8DoNznwDsGoSolg,2065
|
|
9
|
-
eodash_catalog/utils.py,sha256=KSsKvSQ5vxhMYPFFt_d7KYkC5YclzI2M6K1Vw0Lnkes,7855
|
|
10
|
-
eodash_catalog-0.0.11.dist-info/METADATA,sha256=ShVpKo7eFOCIJ4tMBPY96-Ve4OmzXwn25JPV9PrSrbw,3203
|
|
11
|
-
eodash_catalog-0.0.11.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
12
|
-
eodash_catalog-0.0.11.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
-
eodash_catalog-0.0.11.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
-
eodash_catalog-0.0.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|