eodash_catalog 0.3.13__py3-none-any.whl → 0.3.19__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.
- eodash_catalog/__about__.py +1 -1
- eodash_catalog/endpoints.py +17 -25
- eodash_catalog/generate_indicators.py +8 -11
- eodash_catalog/stac_handling.py +29 -11
- eodash_catalog/utils.py +1 -0
- {eodash_catalog-0.3.13.dist-info → eodash_catalog-0.3.19.dist-info}/METADATA +1 -1
- eodash_catalog-0.3.19.dist-info/RECORD +14 -0
- eodash_catalog-0.3.13.dist-info/RECORD +0 -14
- {eodash_catalog-0.3.13.dist-info → eodash_catalog-0.3.19.dist-info}/WHEEL +0 -0
- {eodash_catalog-0.3.13.dist-info → eodash_catalog-0.3.19.dist-info}/entry_points.txt +0 -0
- {eodash_catalog-0.3.13.dist-info → eodash_catalog-0.3.19.dist-info}/licenses/LICENSE.txt +0 -0
eodash_catalog/__about__.py
CHANGED
eodash_catalog/endpoints.py
CHANGED
|
@@ -176,7 +176,7 @@ def handle_STAC_based_endpoint(
|
|
|
176
176
|
catalog, collection_config["Name"], collection_config, catalog_config, endpoint_config
|
|
177
177
|
)
|
|
178
178
|
for location in collection_config["Locations"]:
|
|
179
|
-
identifier = location.get("Identifier", uuid.uuid4())
|
|
179
|
+
identifier = location.get("Identifier", str(uuid.uuid4()))
|
|
180
180
|
collection = process_STACAPI_Endpoint(
|
|
181
181
|
catalog_config=catalog_config,
|
|
182
182
|
endpoint_config=endpoint_config,
|
|
@@ -397,6 +397,7 @@ def handle_collection_only(
|
|
|
397
397
|
properties={},
|
|
398
398
|
geometry=None,
|
|
399
399
|
datetime=dt,
|
|
400
|
+
assets={"dummy_asset": Asset(href="")},
|
|
400
401
|
)
|
|
401
402
|
link = collection.add_item(item)
|
|
402
403
|
link.extra_fields["datetime"] = format_datetime_to_isostring_zulu(dt)
|
|
@@ -994,12 +995,14 @@ def handle_WMS_endpoint(
|
|
|
994
995
|
# some endpoints allow "narrowed-down" capabilities per-layer, which we utilize to not
|
|
995
996
|
# have to process full service capabilities XML
|
|
996
997
|
capabilities_url = endpoint_config["EndPoint"]
|
|
997
|
-
spatial_extent,
|
|
998
|
+
spatial_extent, datetimes_retrieved = retrieveExtentFromWMSWMTS(
|
|
998
999
|
capabilities_url,
|
|
999
1000
|
endpoint_config["LayerId"],
|
|
1000
1001
|
version=endpoint_config.get("Version", "1.1.1"),
|
|
1001
1002
|
wmts=wmts,
|
|
1002
1003
|
)
|
|
1004
|
+
if datetimes_retrieved:
|
|
1005
|
+
datetimes = datetimes_retrieved
|
|
1003
1006
|
# optionally filter time results
|
|
1004
1007
|
if query := endpoint_config.get("Query"):
|
|
1005
1008
|
datetimes = filter_time_entries(datetimes, query)
|
|
@@ -1144,6 +1147,14 @@ def add_visualization_info(
|
|
|
1144
1147
|
"role": ["data"],
|
|
1145
1148
|
}
|
|
1146
1149
|
)
|
|
1150
|
+
if collection_config.get("EodashIdentifier") == "FNF":
|
|
1151
|
+
extra_fields.update(
|
|
1152
|
+
{
|
|
1153
|
+
"wms:layers": endpoint_config.get("LayerId", "").replace(
|
|
1154
|
+
"{time}", (datetimes is not None and str(datetimes[0].year)) or "2020"
|
|
1155
|
+
),
|
|
1156
|
+
}
|
|
1157
|
+
)
|
|
1147
1158
|
dimensions = {}
|
|
1148
1159
|
if dimensions_config := endpoint_config.get("Dimensions", {}):
|
|
1149
1160
|
for key, value in dimensions_config.items():
|
|
@@ -1217,28 +1228,6 @@ def add_visualization_info(
|
|
|
1217
1228
|
link,
|
|
1218
1229
|
)
|
|
1219
1230
|
stac_object.add_link(link)
|
|
1220
|
-
elif endpoint_config["Name"] == "JAXA_WMTS_PALSAR":
|
|
1221
|
-
target_url = "{}".format(endpoint_config.get("EndPoint"))
|
|
1222
|
-
# custom time just for this special case as a default for collection wmts
|
|
1223
|
-
time = None
|
|
1224
|
-
if datetimes is not None:
|
|
1225
|
-
time = datetimes[0]
|
|
1226
|
-
extra_fields.update(
|
|
1227
|
-
{
|
|
1228
|
-
"wmts:layer": endpoint_config.get("LayerId", "").replace(
|
|
1229
|
-
"{time}", (time and str(time.year)) or "2017"
|
|
1230
|
-
)
|
|
1231
|
-
}
|
|
1232
|
-
)
|
|
1233
|
-
stac_object.add_link(
|
|
1234
|
-
Link(
|
|
1235
|
-
rel="wmts",
|
|
1236
|
-
target=target_url,
|
|
1237
|
-
media_type="image/png",
|
|
1238
|
-
title="wmts capabilities",
|
|
1239
|
-
extra_fields=extra_fields,
|
|
1240
|
-
)
|
|
1241
|
-
)
|
|
1242
1231
|
elif endpoint_config["Name"] == "xcube":
|
|
1243
1232
|
if endpoint_config["Type"] == "zarr":
|
|
1244
1233
|
# either preset ColormapName of left as a template
|
|
@@ -1528,12 +1517,15 @@ def handle_vector_tile_source(
|
|
|
1528
1517
|
geometry=create_geometry_from_bbox(bbox),
|
|
1529
1518
|
datetime=dt,
|
|
1530
1519
|
extra_fields={},
|
|
1520
|
+
assets={"dummy_asset": Asset(href="")},
|
|
1531
1521
|
)
|
|
1532
1522
|
extra_fields_link = {}
|
|
1533
1523
|
add_authentication(item, time_entry["Url"], extra_fields_link)
|
|
1534
1524
|
# add mapbox vector tile link
|
|
1535
|
-
identifier = uuid.uuid4()
|
|
1525
|
+
identifier = str(uuid.uuid4())
|
|
1536
1526
|
extra_fields_link["key"] = identifier
|
|
1527
|
+
if vector_tile_id_property := endpoint_config.get("idProperty"):
|
|
1528
|
+
extra_fields_link["idProperty"] = vector_tile_id_property
|
|
1537
1529
|
link = Link(
|
|
1538
1530
|
rel="vector-tile",
|
|
1539
1531
|
target=time_entry["Url"],
|
|
@@ -302,17 +302,6 @@ def process_collection_file(
|
|
|
302
302
|
catalog,
|
|
303
303
|
options,
|
|
304
304
|
)
|
|
305
|
-
elif endpoint_config["Name"] == "JAXA_WMTS_PALSAR":
|
|
306
|
-
# somewhat one off creation of individual WMTS layers as individual items
|
|
307
|
-
collection = handle_WMS_endpoint(
|
|
308
|
-
catalog_config,
|
|
309
|
-
endpoint_config,
|
|
310
|
-
collection_config,
|
|
311
|
-
coll_path_rel_to_root_catalog,
|
|
312
|
-
catalog,
|
|
313
|
-
options,
|
|
314
|
-
wmts=True,
|
|
315
|
-
)
|
|
316
305
|
elif endpoint_config["Name"] == "Collection-only":
|
|
317
306
|
collection = handle_collection_only(
|
|
318
307
|
catalog_config, endpoint_config, collection_config, catalog
|
|
@@ -469,12 +458,20 @@ def add_to_catalog(
|
|
|
469
458
|
link.extra_fields["endpointtype"] = endpoint["Name"]
|
|
470
459
|
if collection_config.get("Subtitle"):
|
|
471
460
|
link.extra_fields["subtitle"] = collection_config["Subtitle"]
|
|
461
|
+
if collection_config.get("ShortDescription"):
|
|
462
|
+
link.extra_fields["shortdescription"] = collection_config["ShortDescription"]
|
|
472
463
|
link.extra_fields["title"] = collection.title
|
|
473
464
|
if collection_config.get("EodashIdentifier"):
|
|
474
465
|
link.extra_fields["code"] = collection_config["EodashIdentifier"]
|
|
475
466
|
link.extra_fields["id"] = collection_config["Name"]
|
|
476
467
|
if collection_config.get("Themes"):
|
|
477
468
|
link.extra_fields["themes"] = collection_config["Themes"]
|
|
469
|
+
if collection_config.get("Provider"):
|
|
470
|
+
# get all provider names
|
|
471
|
+
link.extra_fields["providers"] = [
|
|
472
|
+
provider.get("Name") or provider.get("Url")
|
|
473
|
+
for provider in collection_config["Provider"]
|
|
474
|
+
]
|
|
478
475
|
# Check for summaries and bubble up info
|
|
479
476
|
if disable:
|
|
480
477
|
link.extra_fields["roles"] = ["disable"]
|
eodash_catalog/stac_handling.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import uuid
|
|
2
2
|
from datetime import datetime, timezone
|
|
3
|
+
from urllib.parse import parse_qs, urlparse
|
|
3
4
|
|
|
4
5
|
import requests
|
|
5
6
|
import spdx_lookup as lookup
|
|
@@ -151,9 +152,11 @@ def create_web_map_link(
|
|
|
151
152
|
if layer_config.get("dimensions"):
|
|
152
153
|
extra_fields["wmts:dimensions"] = layer_config["dimensions"]
|
|
153
154
|
case "vector-tile":
|
|
154
|
-
identifier = uuid.uuid4()
|
|
155
|
+
identifier = str(uuid.uuid4())
|
|
155
156
|
extra_fields["key"] = identifier
|
|
156
157
|
media_type = "application/vnd.mapbox-vector-tile"
|
|
158
|
+
if vector_tile_id_property := layer_config.get("idProperty"):
|
|
159
|
+
extra_fields["idProperty"] = vector_tile_id_property
|
|
157
160
|
if ep_st := layer_config.get("Style"):
|
|
158
161
|
style_link = Link(
|
|
159
162
|
rel="style",
|
|
@@ -310,6 +313,10 @@ def add_collection_information(
|
|
|
310
313
|
|
|
311
314
|
if collection_config.get("Subtitle"):
|
|
312
315
|
collection.extra_fields["subtitle"] = collection_config["Subtitle"]
|
|
316
|
+
|
|
317
|
+
if collection_config.get("ShortDescription"):
|
|
318
|
+
collection.extra_fields["shortdescription"] = collection_config["ShortDescription"]
|
|
319
|
+
|
|
313
320
|
if collection_config.get("Legend"):
|
|
314
321
|
collection.add_asset(
|
|
315
322
|
"legend",
|
|
@@ -319,15 +326,26 @@ def add_collection_information(
|
|
|
319
326
|
roles=["metadata"],
|
|
320
327
|
),
|
|
321
328
|
)
|
|
322
|
-
if collection_config.get("
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
)
|
|
330
|
-
|
|
329
|
+
if stories := collection_config.get("Stories"):
|
|
330
|
+
for story in stories:
|
|
331
|
+
story_url = story.get("Url")
|
|
332
|
+
if not story_url.startswith("http"):
|
|
333
|
+
story_url = f'{catalog_config.get("stories_endpoint")}/{story_url}'
|
|
334
|
+
parsed_url = urlparse(story_url)
|
|
335
|
+
# check if it is URL with a query parameter id=story-identifier
|
|
336
|
+
if parsed_url.query and len(parse_qs(parsed_url.query).get("id")) > 0:
|
|
337
|
+
story_id = parse_qs(parsed_url.query).get("id")[0]
|
|
338
|
+
else:
|
|
339
|
+
story_id = parsed_url.path.rsplit("/")[-1].replace(".md", "").replace(".MD", "")
|
|
340
|
+
collection.add_asset(
|
|
341
|
+
story_id,
|
|
342
|
+
Asset(
|
|
343
|
+
title=story.get("Name"),
|
|
344
|
+
href=story_url,
|
|
345
|
+
media_type="text/markdown",
|
|
346
|
+
roles=["metadata", "story"],
|
|
347
|
+
),
|
|
348
|
+
)
|
|
331
349
|
if collection_config.get("Image"):
|
|
332
350
|
# Check if absolute URL or relative path
|
|
333
351
|
if collection_config["Image"].startswith("http"):
|
|
@@ -615,7 +633,7 @@ def add_projection_info(
|
|
|
615
633
|
|
|
616
634
|
|
|
617
635
|
def add_authentication(stac_object: Item | Collection | Catalog, url: str, extra_fields_link: dict):
|
|
618
|
-
if "
|
|
636
|
+
if "mapbox" in url:
|
|
619
637
|
# add authentication info
|
|
620
638
|
auth_extension = "https://stac-extensions.github.io/authentication/v1.1.0/schema.json"
|
|
621
639
|
if auth_extension not in stac_object.stac_extensions:
|
eodash_catalog/utils.py
CHANGED
|
@@ -328,6 +328,7 @@ def add_single_item_if_collection_empty(endpoint_config: dict, collection: Colle
|
|
|
328
328
|
datetime=datetime(1970, 1, 1, 0, 0, 0, tzinfo=pytztimezone("UTC")),
|
|
329
329
|
start_datetime=datetime(1970, 1, 1, 0, 0, 0, tzinfo=pytztimezone("UTC")),
|
|
330
330
|
end_datetime=datetime.now(tz=pytztimezone("UTC")),
|
|
331
|
+
assets={"dummy_asset": Asset(href="")},
|
|
331
332
|
)
|
|
332
333
|
collection.add_item(item)
|
|
333
334
|
if not endpoint_config.get("OverwriteBBox"):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.19
|
|
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=qIWI-3ueJKVVPg13d1ilZOLmlD1azsMIlFTHjYrX2nM,138
|
|
2
|
+
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
+
eodash_catalog/duration.py,sha256=TBG7v1lCpbYowADK5uJ2M8kPxsvQneFAFi1NIE26dy4,10754
|
|
4
|
+
eodash_catalog/endpoints.py,sha256=O2HwO5AjSVNd4LR7n6efucI2hF95hSe0egu9NNwqwPQ,65102
|
|
5
|
+
eodash_catalog/generate_indicators.py,sha256=Lg_80KAIBuhxOhwORYCbRB5nZ1LoP894miWlNxiQKPs,22862
|
|
6
|
+
eodash_catalog/sh_endpoint.py,sha256=l95NRh__AnpEZBhlzTaGVmBnyX00Sr7RRjwy114nroY,1323
|
|
7
|
+
eodash_catalog/stac_handling.py,sha256=jj0ksKc27hSXRJsxbtxQLWumNuywbW-y7eIOGsEewbg,28761
|
|
8
|
+
eodash_catalog/thumbnails.py,sha256=9tPnEdwDaScGCMHpDYXayCnAQYoG_E2oIiBFVGvqOz0,2372
|
|
9
|
+
eodash_catalog/utils.py,sha256=2ov62y3OkYX4x2-XpH73FBZ71ulC0ie9m0rSGkuNw4g,24082
|
|
10
|
+
eodash_catalog-0.3.19.dist-info/METADATA,sha256=dYCWFQINkRl1xNgguCowPI8cfiJXHJKNjjBdA21Lw9E,3020
|
|
11
|
+
eodash_catalog-0.3.19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
eodash_catalog-0.3.19.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
+
eodash_catalog-0.3.19.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
+
eodash_catalog-0.3.19.dist-info/RECORD,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
eodash_catalog/__about__.py,sha256=KH8aZKnX9omeGQR5vGzYS1G5xjoOtXnKNbSX5MLYiB0,138
|
|
2
|
-
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
-
eodash_catalog/duration.py,sha256=TBG7v1lCpbYowADK5uJ2M8kPxsvQneFAFi1NIE26dy4,10754
|
|
4
|
-
eodash_catalog/endpoints.py,sha256=veVjrpE1hA6gF8kDKFifex5fNBohgh6_wgP8y5lKzFo,65177
|
|
5
|
-
eodash_catalog/generate_indicators.py,sha256=djFmhrP_Nsnl1uC5Nd7CI4KbgRkDipUXAad0B2vC3lI,23002
|
|
6
|
-
eodash_catalog/sh_endpoint.py,sha256=l95NRh__AnpEZBhlzTaGVmBnyX00Sr7RRjwy114nroY,1323
|
|
7
|
-
eodash_catalog/stac_handling.py,sha256=lXMzAHT5L35cbVODQg141hDMRiswx6u6dWoEGy6s_T8,27797
|
|
8
|
-
eodash_catalog/thumbnails.py,sha256=9tPnEdwDaScGCMHpDYXayCnAQYoG_E2oIiBFVGvqOz0,2372
|
|
9
|
-
eodash_catalog/utils.py,sha256=Dv28AYksex7lcRi4f4N3UP5svpv_DIHcFOTRaxd5BKM,24030
|
|
10
|
-
eodash_catalog-0.3.13.dist-info/METADATA,sha256=NCDeupYhXX168cy-HEns40KoBIXGFhUs3KG4dTZf5I4,3020
|
|
11
|
-
eodash_catalog-0.3.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
-
eodash_catalog-0.3.13.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
-
eodash_catalog-0.3.13.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
-
eodash_catalog-0.3.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|