eodash_catalog 0.1.3__tar.gz → 0.1.4__tar.gz

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.
Files changed (33) hide show
  1. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.bumpversion.cfg +1 -1
  2. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/PKG-INFO +4 -3
  3. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/__about__.py +1 -1
  4. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/generate_indicators.py +3 -0
  5. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/stac_handling.py +63 -2
  6. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/utils.py +7 -0
  7. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.github/workflows/ci.yml +0 -0
  8. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.github/workflows/python-publish.yml +0 -0
  9. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.gitignore +0 -0
  10. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.vscode/extensions.json +0 -0
  11. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/.vscode/settings.json +0 -0
  12. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/LICENSE.txt +0 -0
  13. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/README.md +0 -0
  14. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/pyproject.toml +0 -0
  15. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/requirements.txt +0 -0
  16. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/ruff.toml +0 -0
  17. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/__init__.py +0 -0
  18. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/duration.py +0 -0
  19. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/endpoints.py +0 -0
  20. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/sh_endpoint.py +0 -0
  21. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/src/eodash_catalog/thumbnails.py +0 -0
  22. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/__init__.py +0 -0
  23. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/test-data/regional_forecast.json +0 -0
  24. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/test_generate.py +0 -0
  25. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-catalogs/testing.yaml +0 -0
  26. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-collections/test_CROPOMAT1.yaml +0 -0
  27. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-collections/test_see_solar_energy.yaml +0 -0
  28. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-collections/test_tif_demo_1.yaml +0 -0
  29. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-collections/test_tif_demo_2.yaml +0 -0
  30. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-collections/test_wms_no_time.yaml +0 -0
  31. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-indicators/test_indicator.yaml +0 -0
  32. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-layers/baselayers.yaml +0 -0
  33. {eodash_catalog-0.1.3 → eodash_catalog-0.1.4}/tests/testing-layers/overlays.yaml +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.1.3
2
+ current_version = 0.1.4
3
3
  commit = True
4
4
  tag = True
5
5
  parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)\.(?P<build>\d+))?
@@ -1,12 +1,13 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: eodash_catalog
3
- Version: 0.1.3
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: MIT
9
+ License-Expression: MIT
10
+ License-File: LICENSE.txt
10
11
  Classifier: Development Status :: 4 - Beta
11
12
  Classifier: Programming Language :: Python
12
13
  Classifier: Programming Language :: Python :: 3.10
@@ -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.3"
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
  )
@@ -191,6 +192,7 @@ def process_indicator_file(
191
192
  parent_indicator.extent.spatial.bboxes.append(c_child.extent.spatial.bboxes[0])
192
193
  # extract collection information and add it to summary indicator level
193
194
  extract_indicator_info(parent_indicator)
195
+ add_process_info(parent_indicator, catalog_config, indicator_config)
194
196
  # add baselayer and overview information to indicator collection
195
197
  add_base_overlay_info(parent_indicator, catalog_config, indicator_config)
196
198
  add_to_catalog(parent_indicator, catalog, {}, indicator_config)
@@ -339,6 +341,7 @@ def process_collection_file(
339
341
  parent_collection.add_links(links)
340
342
 
341
343
  add_collection_information(catalog_config, parent_collection, collection_config)
344
+ add_process_info(catalog_config, parent_collection, collection_config)
342
345
  parent_collection.update_extent_from_items()
343
346
  # Add bbox extents from children
344
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],
@@ -299,8 +320,7 @@ def add_collection_information(
299
320
  )
300
321
  # Bubble up thumbnail to extra fields
301
322
  collection.extra_fields["thumbnail"] = (
302
- f'{catalog_config["assets_endpoint"]}/'
303
- f'{collection_config["Image"]}'
323
+ f'{catalog_config["assets_endpoint"]}/' f'{collection_config["Image"]}'
304
324
  )
305
325
  # Add extra fields to collection if available
306
326
  add_extra_fields(collection, collection_config)
@@ -326,6 +346,47 @@ def add_collection_information(
326
346
  collection.extra_fields["eox:colorlegend"] = collection_config["Colorlegend"]
327
347
 
328
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
+
329
390
  def add_base_overlay_info(
330
391
  collection: Collection, catalog_config: dict, collection_config: dict
331
392
  ) -> None:
@@ -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}'
File without changes
File without changes