eodash_catalog 0.1.9__py3-none-any.whl → 0.1.11__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.

@@ -1,4 +1,4 @@
1
1
  # SPDX-FileCopyrightText: 2024-present Daniel Santillan <daniel.santillan@eox.at>
2
2
  #
3
3
  # SPDX-License-Identifier: MIT
4
- __version__ = "0.1.9"
4
+ __version__ = "0.1.11"
@@ -17,6 +17,7 @@ from eodash_catalog.sh_endpoint import get_SH_token
17
17
  from eodash_catalog.stac_handling import (
18
18
  add_collection_information,
19
19
  add_example_info,
20
+ add_process_info_child_collection,
20
21
  add_projection_info,
21
22
  get_collection_datetimes_from_config,
22
23
  get_or_create_collection,
@@ -174,7 +175,7 @@ def handle_STAC_based_endpoint(
174
175
  collection.description = location["Name"]
175
176
  # TODO: should we remove all assets from sub collections?
176
177
  link = root_collection.add_child(collection)
177
- latlng = f'{location["Point"][1]},{location["Point"][0]}'
178
+ latlng = f'{location["Point"][1]},{location["Point"][0]}'.strip()
178
179
  # Add extra properties we need
179
180
  link.extra_fields["id"] = location["Identifier"]
180
181
  link.extra_fields["latlng"] = latlng
@@ -182,6 +183,7 @@ def handle_STAC_based_endpoint(
182
183
  add_example_info(collection, collection_config, endpoint_config, catalog_config)
183
184
  # eodash v4 compatibility
184
185
  add_visualization_info(collection, collection_config, endpoint_config)
186
+ add_process_info_child_collection(collection, catalog_config, collection_config)
185
187
  if "OverwriteBBox" in location:
186
188
  collection.extent.spatial = SpatialExtent(
187
189
  [
@@ -208,7 +210,7 @@ def handle_STAC_based_endpoint(
208
210
  )
209
211
  # eodash v4 compatibility
210
212
  add_visualization_info(root_collection, collection_config, endpoint_config)
211
- add_collection_information(catalog_config, root_collection, collection_config)
213
+ add_collection_information(catalog_config, root_collection, collection_config, True)
212
214
  add_example_info(root_collection, collection_config, endpoint_config, catalog_config)
213
215
  return root_collection
214
216
 
@@ -406,7 +408,7 @@ def handle_SH_WMS_endpoint(
406
408
 
407
409
  link = root_collection.add_child(collection)
408
410
  # bubble up information we want to the link
409
- latlng = "{},{}".format(location["Point"][1], location["Point"][0])
411
+ latlng = "{},{}".format(location["Point"][1], location["Point"][0]).strip()
410
412
  link.extra_fields["id"] = location["Identifier"]
411
413
  link.extra_fields["latlng"] = latlng
412
414
  link.extra_fields["country"] = location["Country"]
@@ -416,6 +418,7 @@ def handle_SH_WMS_endpoint(
416
418
  else:
417
419
  LOGGER.warn(f"NO datetimes configured for collection: {collection_config['Name']}!")
418
420
  add_visualization_info(collection, collection_config, endpoint_config)
421
+ add_process_info_child_collection(collection, catalog_config, collection_config)
419
422
 
420
423
  root_collection.update_extent_from_items()
421
424
  # Add bbox extents from children
@@ -443,7 +446,7 @@ def handle_SH_WMS_endpoint(
443
446
  item_link = root_collection.add_item(item)
444
447
  item_link.extra_fields["datetime"] = format_datetime_to_isostring_zulu(dt)
445
448
  # eodash v4 compatibility
446
- add_collection_information(catalog_config, root_collection, collection_config)
449
+ add_collection_information(catalog_config, root_collection, collection_config, True)
447
450
  add_visualization_info(root_collection, collection_config, endpoint_config)
448
451
  return root_collection
449
452
 
@@ -178,7 +178,7 @@ def process_indicator_file(
178
178
  else:
179
179
  # we assume that collection files can also be loaded directly
180
180
  process_collection_file(catalog_config, file_path, parent_indicator, options)
181
- add_collection_information(catalog_config, parent_indicator, indicator_config)
181
+ add_collection_information(catalog_config, parent_indicator, indicator_config, True)
182
182
  if iter_len_at_least(parent_indicator.get_items(recursive=True), 1):
183
183
  parent_indicator.update_extent_from_items()
184
184
  # Add bbox extents from children
@@ -213,7 +213,10 @@ def add_example_info(
213
213
 
214
214
 
215
215
  def add_collection_information(
216
- catalog_config: dict, collection: Collection, collection_config: dict
216
+ catalog_config: dict,
217
+ collection: Collection,
218
+ collection_config: dict,
219
+ is_root_collection: bool = False,
217
220
  ) -> None:
218
221
  # Add metadata information
219
222
  # Check license identifier
@@ -322,7 +325,7 @@ def add_collection_information(
322
325
  f'{catalog_config["assets_endpoint"]}/' f'{collection_config["Image"]}'
323
326
  )
324
327
  # Add extra fields to collection if available
325
- add_extra_fields(collection, collection_config)
328
+ add_extra_fields(collection, collection_config, is_root_collection)
326
329
 
327
330
  if "References" in collection_config:
328
331
  generic_counter = 1
@@ -346,7 +349,29 @@ def add_collection_information(
346
349
 
347
350
 
348
351
  def add_process_info(collection: Collection, catalog_config: dict, collection_config: dict) -> None:
349
- if "Process" in collection_config:
352
+ if any(key in collection_config for key in ["Locations", "Subcollections"]):
353
+ # add the generic geodb-like selection process on the root collection instead of Processes
354
+ if "geodb_default_form" in catalog_config:
355
+ # adding default geodb-like map handling for Locations
356
+ collection.extra_fields["eodash:jsonform"] = get_full_url(
357
+ catalog_config["geodb_default_form"], catalog_config
358
+ )
359
+ # link a process definition for getting a collection with {{feature}} placeholder
360
+ sl = Link(
361
+ rel="service",
362
+ target="./" + collection.id + "/{{feature}}/collection.json",
363
+ media_type="application/json; profile=collection",
364
+ extra_fields={
365
+ "id": "locations",
366
+ "method": "GET",
367
+ "type": "application/json; profile=collection",
368
+ "endpoint": "STAC",
369
+ },
370
+ )
371
+ collection.add_link(sl)
372
+ # elif is intentional for cases when Process is defined on collection with Locations
373
+ # then we want to only add it to the "children", not the root
374
+ elif "Process" in collection_config:
350
375
  if "EndPoints" in collection_config["Process"]:
351
376
  for endpoint in collection_config["Process"]["EndPoints"]:
352
377
  collection.add_link(create_service_link(endpoint, catalog_config))
@@ -389,6 +414,24 @@ def add_process_info(collection: Collection, catalog_config: dict, collection_co
389
414
  )
390
415
 
391
416
 
417
+ def add_process_info_child_collection(
418
+ collection: Collection, catalog_config: dict, collection_config: dict
419
+ ) -> None:
420
+ # in case of locations, we add the process itself on a child collection
421
+ if "Process" in collection_config:
422
+ if "EndPoints" in collection_config["Process"]:
423
+ for endpoint in collection_config["Process"]["EndPoints"]:
424
+ collection.add_link(create_service_link(endpoint, catalog_config))
425
+ if "JsonForm" in collection_config["Process"]:
426
+ collection.extra_fields["eodash:jsonform"] = get_full_url(
427
+ collection_config["Process"]["JsonForm"], catalog_config
428
+ )
429
+ if "VegaDefinition" in collection_config["Process"]:
430
+ collection.extra_fields["eodash:vegadefinition"] = get_full_url(
431
+ collection_config["Process"]["VegaDefinition"], catalog_config
432
+ )
433
+
434
+
392
435
  def add_base_overlay_info(
393
436
  collection: Collection, catalog_config: dict, collection_config: dict
394
437
  ) -> None:
@@ -412,12 +455,16 @@ def add_base_overlay_info(
412
455
  collection.add_link(create_web_map_link(layer, role="overlay"))
413
456
 
414
457
 
415
- def add_extra_fields(stac_object: Collection | Link, collection_config: dict) -> None:
458
+ def add_extra_fields(
459
+ stac_object: Collection | Link, collection_config: dict, is_root_collection: bool = False
460
+ ) -> None:
416
461
  if "yAxis" in collection_config:
417
462
  stac_object.extra_fields["yAxis"] = collection_config["yAxis"]
418
463
  if "Themes" in collection_config:
419
464
  stac_object.extra_fields["themes"] = collection_config["Themes"]
420
- if "Locations" in collection_config or "Subcollections" in collection_config:
465
+ if (
466
+ "Locations" in collection_config or "Subcollections" in collection_config
467
+ ) and is_root_collection:
421
468
  stac_object.extra_fields["locations"] = True
422
469
  if "Tags" in collection_config:
423
470
  stac_object.extra_fields["tags"] = collection_config["Tags"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eodash_catalog
3
- Version: 0.1.9
3
+ Version: 0.1.11
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
@@ -18,26 +18,19 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
18
18
  Requires-Python: >=3.10
19
19
  Requires-Dist: click
20
20
  Requires-Dist: click<9
21
- Requires-Dist: lxml<5
22
- Requires-Dist: mergedeep
23
21
  Requires-Dist: oauthlib<3.3
24
22
  Requires-Dist: owslib
25
- Requires-Dist: pygeofilter[backend-native]==0.2.0
26
23
  Requires-Dist: pystac-client<1
27
24
  Requires-Dist: pystac[validation]<2
28
25
  Requires-Dist: python-dateutil<3
29
26
  Requires-Dist: python-dotenv<1.1.0
30
27
  Requires-Dist: pyyaml<7
31
- Requires-Dist: redis<4
32
28
  Requires-Dist: requests-oauthlib<1.3.2
33
29
  Requires-Dist: requests<3
34
30
  Requires-Dist: setuptools<71
35
31
  Requires-Dist: spdx-lookup<=0.3.3
36
32
  Requires-Dist: stac-geoparquet<=0.6.0
37
33
  Requires-Dist: structlog<22.0
38
- Requires-Dist: swiftspec==0.0.2
39
- Provides-Extra: dev
40
- Requires-Dist: pre-commit; extra == 'dev'
41
34
  Description-Content-Type: text/markdown
42
35
 
43
36
  # eodash_catalog
@@ -0,0 +1,14 @@
1
+ eodash_catalog/__about__.py,sha256=fI90LQc8z5n_qt4eI-DktK-SnSVpSxYIplfSQfDKvJ0,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=fQ3kaDCcdPypxrZzvAtWYqSt5nVq8cbCDOfH6BlbIc8,41835
5
+ eodash_catalog/generate_indicators.py,sha256=V2a6r3lS_BoZvwoywHFaT-gBu3INRp4E4zLZioD6ang,19493
6
+ eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
7
+ eodash_catalog/stac_handling.py,sha256=TuwJ6AOA-1aJglAFtWZmtimZO5_wvIkpU64XHcKI7rk,23254
8
+ eodash_catalog/thumbnails.py,sha256=qZDcpQe80ki6lEMKYdZtSnnHH0PUpcoXTvU9bYdPlzU,2260
9
+ eodash_catalog/utils.py,sha256=zZ4PT1h1lWCMvEIfg5Xlw4re86pwR40BX8jEDweiTJ0,16115
10
+ eodash_catalog-0.1.11.dist-info/METADATA,sha256=DKZxs6I-9CB0ASzmK_ypC8cKyLDSzhUmpsZ3fIjpCgg,3020
11
+ eodash_catalog-0.1.11.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ eodash_catalog-0.1.11.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
+ eodash_catalog-0.1.11.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
+ eodash_catalog-0.1.11.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- eodash_catalog/__about__.py,sha256=dai3IEzZp1p1kyDUiY5z5uR4Wscdqp-fRUkdtOJesKM,137
2
- eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
3
- eodash_catalog/duration.py,sha256=B6XOZfvNU7SuqpxuVtT1kNKODoOQJXDI6mocvA_U1ik,10816
4
- eodash_catalog/endpoints.py,sha256=kVD7pKo26wyuBaI457Z1IsDGLPd0IKKiYBE8d8h4RR4,41582
5
- eodash_catalog/generate_indicators.py,sha256=K3Jj7bsS6fd8y82fmHPYQ1j_4N72RGpeAIx6ZHuQ1AY,19487
6
- eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
7
- eodash_catalog/stac_handling.py,sha256=VWivB_bn9Qwh8GrDSpicCXzItroIHz4-w5SZTkueWLg,21079
8
- eodash_catalog/thumbnails.py,sha256=qZDcpQe80ki6lEMKYdZtSnnHH0PUpcoXTvU9bYdPlzU,2260
9
- eodash_catalog/utils.py,sha256=zZ4PT1h1lWCMvEIfg5Xlw4re86pwR40BX8jEDweiTJ0,16115
10
- eodash_catalog-0.1.9.dist-info/METADATA,sha256=q0NXSet4rVJG38MPU-yG0icHDaCxXl-douED8LTGkyE,3233
11
- eodash_catalog-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- eodash_catalog-0.1.9.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
- eodash_catalog-0.1.9.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
- eodash_catalog-0.1.9.dist-info/RECORD,,