eodash_catalog 0.1.2__py3-none-any.whl → 0.1.4__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.2"
4
+ __version__ = "0.1.4"
@@ -33,6 +33,7 @@ from eodash_catalog.stac_handling import (
33
33
  add_base_overlay_info,
34
34
  add_collection_information,
35
35
  add_extra_fields,
36
+ add_process_info,
36
37
  add_projection_info,
37
38
  get_or_create_collection,
38
39
  )
@@ -133,6 +134,7 @@ def extract_indicator_info(parent_collection: Collection):
133
134
  "sensor",
134
135
  "cities",
135
136
  "countries",
137
+ "thumbnail",
136
138
  ]
137
139
  summaries: dict[str, Any] = {}
138
140
  for key in to_extract:
@@ -190,6 +192,7 @@ def process_indicator_file(
190
192
  parent_indicator.extent.spatial.bboxes.append(c_child.extent.spatial.bboxes[0])
191
193
  # extract collection information and add it to summary indicator level
192
194
  extract_indicator_info(parent_indicator)
195
+ add_process_info(parent_indicator, catalog_config, indicator_config)
193
196
  # add baselayer and overview information to indicator collection
194
197
  add_base_overlay_info(parent_indicator, catalog_config, indicator_config)
195
198
  add_to_catalog(parent_indicator, catalog, {}, indicator_config)
@@ -338,6 +341,7 @@ def process_collection_file(
338
341
  parent_collection.add_links(links)
339
342
 
340
343
  add_collection_information(catalog_config, parent_collection, collection_config)
344
+ add_process_info(catalog_config, parent_collection, collection_config)
341
345
  parent_collection.update_extent_from_items()
342
346
  # Add bbox extents from children
343
347
  for c_child in parent_collection.get_children():
@@ -19,6 +19,7 @@ from yaml.loader import SafeLoader
19
19
 
20
20
  from eodash_catalog.utils import (
21
21
  generateDatetimesFromInterval,
22
+ get_full_url,
22
23
  parse_datestring_to_tz_aware_datetime,
23
24
  )
24
25
 
@@ -85,6 +86,26 @@ def get_or_create_collection(
85
86
  return collection
86
87
 
87
88
 
89
+ def create_service_link(endpoint_config: dict, catalog_config: dict) -> Link:
90
+ extra_fields = {
91
+ "id": endpoint_config["Identifier"],
92
+ "method": endpoint_config.get("Method", "GET"),
93
+ }
94
+ if "EndPoint" in endpoint_config:
95
+ extra_fields["endpoint"] = endpoint_config["EndPoint"]
96
+ if "Body" in endpoint_config:
97
+ extra_fields["body"] = get_full_url(endpoint_config["Body"], catalog_config)
98
+ if "Flatstyle" in endpoint_config:
99
+ extra_fields["eox:flatstyle"] = get_full_url(endpoint_config["Flatstyle"], catalog_config)
100
+ sl = Link(
101
+ rel="service",
102
+ target=endpoint_config["Url"],
103
+ media_type=endpoint_config["Type"],
104
+ extra_fields=extra_fields,
105
+ )
106
+ return sl
107
+
108
+
88
109
  def create_web_map_link(layer_config: dict, role: str) -> Link:
89
110
  extra_fields = {
90
111
  "roles": [role],
@@ -297,6 +318,10 @@ def add_collection_information(
297
318
  roles=["thumbnail"],
298
319
  ),
299
320
  )
321
+ # Bubble up thumbnail to extra fields
322
+ collection.extra_fields["thumbnail"] = (
323
+ f'{catalog_config["assets_endpoint"]}/' f'{collection_config["Image"]}'
324
+ )
300
325
  # Add extra fields to collection if available
301
326
  add_extra_fields(collection, collection_config)
302
327
 
@@ -321,6 +346,47 @@ def add_collection_information(
321
346
  collection.extra_fields["eox:colorlegend"] = collection_config["Colorlegend"]
322
347
 
323
348
 
349
+ def add_process_info(collection: Collection, catalog_config: dict, collection_config: dict) -> None:
350
+ if "Process" in collection_config:
351
+ if "EndPoints" in collection_config["Process"]:
352
+ for endpoint in collection_config["Process"]["EndPoints"]:
353
+ collection.add_link(create_service_link(endpoint, catalog_config))
354
+ if "JsonForm" in collection_config["Process"]:
355
+ collection.extra_fields["eodash:jsonform"] = get_full_url(
356
+ collection_config["Process"]["JsonForm"], catalog_config
357
+ )
358
+ if "VegaDefinition" in collection_config["Process"]:
359
+ collection.extra_fields["eodash:vegadefinition"] = get_full_url(
360
+ collection_config["Process"]["VegaDefinition"], catalog_config
361
+ )
362
+ elif "Resources" in collection_config:
363
+ # see if geodb resource configured use defaults if available
364
+ for resource in collection_config["Resources"]:
365
+ if resource["Name"] == "GeoDB":
366
+ if "geodb_default_form" in catalog_config:
367
+ collection.extra_fields["eodash:jsonform"] = get_full_url(
368
+ catalog_config["geodb_default_form"], catalog_config
369
+ )
370
+ if "geodb_default_vega" in catalog_config:
371
+ collection.extra_fields["eodash:vegadefinition"] = get_full_url(
372
+ catalog_config["geodb_default_vega"], catalog_config
373
+ )
374
+ query_string = "?aoi_id=eq.{{feature}}&select=site_name,city,color_code,time,aoi,measurement_value,indicator_value,reference_time,eo_sensor,reference_value,input_data" # noqa: E501
375
+ collection.add_link(
376
+ Link(
377
+ rel="service",
378
+ target="{}{}{}".format(
379
+ resource["EndPoint"], resource["Database"], query_string
380
+ ),
381
+ media_type="application/json",
382
+ extra_fields={
383
+ "method": "GET",
384
+ "id": resource["CollectionId"],
385
+ },
386
+ )
387
+ )
388
+
389
+
324
390
  def add_base_overlay_info(
325
391
  collection: Collection, catalog_config: dict, collection_config: dict
326
392
  ) -> None:
eodash_catalog/utils.py CHANGED
@@ -385,3 +385,10 @@ def format_datetime_to_isostring_zulu(datetime_obj: datetime) -> str:
385
385
  # we rather convert it to Zulu based string in order for various clients
386
386
  # to understand it better (WMS)
387
387
  return (datetime_obj.replace(microsecond=0).isoformat()).replace("+00:00", "Z")
388
+
389
+
390
+ def get_full_url(url: str, catalog_config) -> str:
391
+ if url.startswith("http"):
392
+ return url
393
+ else:
394
+ return f'{catalog_config["assets_endpoint"]}{url}'
@@ -1,11 +1,13 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: eodash_catalog
3
- Version: 0.1.2
3
+ Version: 0.1.4
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
7
7
  Project-URL: Source, https://github.com/eodash/eodash_catalog
8
8
  Author-email: Daniel Santillan <daniel.santillan@eox.at>
9
+ License-Expression: MIT
10
+ License-File: LICENSE.txt
9
11
  Classifier: Development Status :: 4 - Beta
10
12
  Classifier: Programming Language :: Python
11
13
  Classifier: Programming Language :: Python :: 3.10
@@ -0,0 +1,14 @@
1
+ eodash_catalog/__about__.py,sha256=P1ShxwW1CZr0NUt4KTnwsWD3v9V3cCfeD7VudT4AudY,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=RfjwEz9Yo4X1zWnwPC-xqhSy_OphazKv5Edruf8pBOU,40821
5
+ eodash_catalog/generate_indicators.py,sha256=GSWkfpkqqdMNiL3pC7Wp3_nqllBsfbt9OM7VQUq2UiE,20246
6
+ eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
7
+ eodash_catalog/stac_handling.py,sha256=l_ZdMnVZjZpfDy0hDbnAW3tqrG9wHuwnKnC5d_9A0bQ,21120
8
+ eodash_catalog/thumbnails.py,sha256=qZDcpQe80ki6lEMKYdZtSnnHH0PUpcoXTvU9bYdPlzU,2260
9
+ eodash_catalog/utils.py,sha256=QhZeMXRC1uvE3VzC3T_nMi9hn_3RR05s5rkzs8tCeQc,13866
10
+ eodash_catalog-0.1.4.dist-info/METADATA,sha256=K0pNrgeghOTe5g0qYG7bKXEkBjSZXMPiG2GYJrVkqOQ,3195
11
+ eodash_catalog-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ eodash_catalog-0.1.4.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
+ eodash_catalog-0.1.4.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
+ eodash_catalog-0.1.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.1
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,14 +0,0 @@
1
- eodash_catalog/__about__.py,sha256=xxN_mdQRHN7wMMbG4vXy6B60NVtQdsz2olBY5mugW70,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=RfjwEz9Yo4X1zWnwPC-xqhSy_OphazKv5Edruf8pBOU,40821
5
- eodash_catalog/generate_indicators.py,sha256=qZRjwBoonvfkq-P3UCyfaowW0wq335q4ZgWAwcAGGP4,20043
6
- eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
7
- eodash_catalog/stac_handling.py,sha256=RGnU8gR-envUVXs0em6uwUJbYHq_wyrR1gq6s1JLNrk,17957
8
- eodash_catalog/thumbnails.py,sha256=qZDcpQe80ki6lEMKYdZtSnnHH0PUpcoXTvU9bYdPlzU,2260
9
- eodash_catalog/utils.py,sha256=mPyt74jEaL0CgyxjnnxW3spomoC8WIfIHi0oCS39d_E,13694
10
- eodash_catalog-0.1.2.dist-info/METADATA,sha256=qX-tll6EDMBeas--94-PB3ZWPFEzLAgQX3wbWRjnSVU,3145
11
- eodash_catalog-0.1.2.dist-info/WHEEL,sha256=3U_NnUcV_1B1kPkYaPzN-irRckL5VW_lytn0ytO_kRY,87
12
- eodash_catalog-0.1.2.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
- eodash_catalog-0.1.2.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
- eodash_catalog-0.1.2.dist-info/RECORD,,