eodash_catalog 0.3.3__tar.gz → 0.3.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.

Potentially problematic release.


This version of eodash_catalog might be problematic. Click here for more details.

Files changed (50) hide show
  1. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.bumpversion.cfg +1 -1
  2. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/Dockerfile +1 -1
  3. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/PKG-INFO +1 -1
  4. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/__about__.py +1 -1
  5. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/endpoints.py +157 -2
  6. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/generate_indicators.py +10 -0
  7. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/utils.py +0 -1
  8. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.dockerignore +0 -0
  9. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.github/workflows/ci.yml +0 -0
  10. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.github/workflows/python-publish.yml +0 -0
  11. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.gitignore +0 -0
  12. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.vscode/extensions.json +0 -0
  13. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/.vscode/settings.json +0 -0
  14. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/LICENSE.txt +0 -0
  15. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/README.md +0 -0
  16. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/pyproject.toml +0 -0
  17. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/requirements.txt +0 -0
  18. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/ruff.toml +0 -0
  19. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/__init__.py +0 -0
  20. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/duration.py +0 -0
  21. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/sh_endpoint.py +0 -0
  22. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/stac_handling.py +0 -0
  23. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/src/eodash_catalog/thumbnails.py +0 -0
  24. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/__init__.py +0 -0
  25. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/test-data/regional_forecast.json +0 -0
  26. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/test_generate.py +0 -0
  27. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/test_geoparquet.py +0 -0
  28. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-catalogs/testing-json.json +0 -0
  29. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-catalogs/testing.yaml +0 -0
  30. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_CROPOMAT1.yaml +0 -0
  31. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_cmems.json +0 -0
  32. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_cog.json +0 -0
  33. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_geodb.yaml +0 -0
  34. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_geodb_locations.yaml +0 -0
  35. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_geojson.yaml +0 -0
  36. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_locations_processing.json +0 -0
  37. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_process.yaml +0 -0
  38. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_projection.json +0 -0
  39. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_see_solar_energy.yaml +0 -0
  40. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_sh_wms.json +0 -0
  41. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_sh_wms_locations.json +0 -0
  42. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_tif_demo_1.yaml +0 -0
  43. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_tif_demo_1_json.json +0 -0
  44. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_tif_demo_2.yaml +0 -0
  45. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_veda.json +0 -0
  46. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_veda_tiles.json +0 -0
  47. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-collections/test_wms_no_time.yaml +0 -0
  48. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-indicators/test_indicator.yaml +0 -0
  49. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-layers/baselayers.yaml +0 -0
  50. {eodash_catalog-0.3.3 → eodash_catalog-0.3.4}/tests/testing-layers/overlays.yaml +0 -0
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 0.3.3
2
+ current_version = 0.3.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+))?
@@ -29,4 +29,4 @@ RUN eodash_catalog --help
29
29
 
30
30
  CMD ["eodash_catalog"]
31
31
 
32
- LABEL version="0.3.3"
32
+ LABEL version="0.3.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eodash_catalog
3
- Version: 0.3.3
3
+ Version: 0.3.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
@@ -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.3.3"
4
+ __version__ = "0.3.4"
@@ -538,6 +538,120 @@ def handle_rasdaman_endpoint(
538
538
  # add_example_info(collection, collection_config, endpoint_config, catalog_config)
539
539
  return collection
540
540
 
541
+ def handle_GeoDB_Features_endpoint(
542
+ catalog_config: dict,
543
+ endpoint_config: dict,
544
+ collection_config: dict,
545
+ coll_path_rel_to_root_catalog: str,
546
+ catalog: Catalog,
547
+ options: Options,
548
+ ) -> Collection:
549
+
550
+ # ID of collection is data["Name"] instead of CollectionId to be able to
551
+ # create more STAC collections from one geoDB table
552
+ collection = get_or_create_collection(
553
+ catalog, collection_config["Name"], collection_config, catalog_config, endpoint_config
554
+ )
555
+ coll_path_rel_to_root_catalog = f'{coll_path_rel_to_root_catalog}/{collection_config["Name"]}'
556
+ select = f'?select={endpoint_config["TimeParameter"]}'
557
+ url = (
558
+ endpoint_config["EndPoint"]
559
+ + endpoint_config["Database"]
560
+ + "_{}".format(endpoint_config["CollectionId"])
561
+ + select
562
+ )
563
+ response = json.loads(requests.get(url).text)
564
+ # Use aggregation value to group datetime results
565
+ aggregation = endpoint_config.get("Aggregation", "day")
566
+ unique_datetimes = set()
567
+ for value in response:
568
+ time_object = datetime.fromisoformat(value[endpoint_config["TimeParameter"]])
569
+ match aggregation:
570
+ case "hour":
571
+ unique_datetimes.add(
572
+ datetime(
573
+ time_object.year,
574
+ time_object.month,
575
+ time_object.day,
576
+ time_object.hour,
577
+ )
578
+ )
579
+ case "day":
580
+ unique_datetimes.add(
581
+ datetime(time_object.year, time_object.month, time_object.day).date()
582
+ )
583
+ case "month":
584
+ unique_datetimes.add(
585
+ datetime(time_object.year, time_object.month, 1).date()
586
+ )
587
+ case "year":
588
+ unique_datetimes.add(
589
+ datetime(time_object.year, 1, 1).date()
590
+ )
591
+ case _:
592
+ # default to day
593
+ unique_datetimes.add(
594
+ datetime(time_object.year, time_object.month, time_object.day).date()
595
+ )
596
+ # go over unique datetimes and create items
597
+ items = []
598
+ for dt in sorted(unique_datetimes):
599
+ item_datetime = dt if isinstance(dt, datetime) else datetime(dt.year, dt.month, dt.day)
600
+ matching_string = ""
601
+ match aggregation:
602
+ case "hour":
603
+ matching_string = item_datetime.strftime("%Y-%m-%dT%H:00:00Z")
604
+ case "day":
605
+ matching_string = item_datetime.strftime("%Y-%m-%d")
606
+ case "month":
607
+ matching_string = item_datetime.strftime("%Y-%m")
608
+ case "year":
609
+ matching_string = item_datetime.strftime("%Y")
610
+ updated_query = endpoint_config["Query"].replace("{{date_time}}", matching_string)
611
+ assets = {
612
+ "geodbfeatures": Asset(
613
+ href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['CollectionId']}?{updated_query}",
614
+ media_type="application/geodb+json",
615
+ roles=["data"],
616
+ )}
617
+ item = Item(
618
+ id=format_datetime_to_isostring_zulu(item_datetime),
619
+ bbox=endpoint_config.get("OverwriteBBox", [-180, -90, 180, 90]),
620
+ properties={},
621
+ geometry=create_geometry_from_bbox(
622
+ endpoint_config.get("OverwriteBBox", [-180, -90, 180, 90])
623
+ ),
624
+ datetime=item_datetime,
625
+ stac_extensions=[],
626
+ assets=assets,
627
+ )
628
+ # add eodash style visualization info if Style has been provided
629
+ if endpoint_config.get("Style"):
630
+ ep_st = endpoint_config.get("Style")
631
+ style_link = Link(
632
+ rel="style",
633
+ target=ep_st
634
+ if ep_st.startswith("http")
635
+ else f"{catalog_config['assets_endpoint']}/{ep_st}",
636
+ media_type="text/vector-styles",
637
+ extra_fields={
638
+ "asset:keys": list(assets),
639
+ },
640
+ )
641
+ item.add_link(style_link)
642
+ add_projection_info(endpoint_config, item)
643
+ items.append(item)
644
+
645
+ save_items(
646
+ collection,
647
+ items,
648
+ options.outputpath,
649
+ catalog_config["id"],
650
+ f"{coll_path_rel_to_root_catalog}/{collection.id}",
651
+ options.gp,
652
+ )
653
+ return collection
654
+
541
655
 
542
656
  def handle_GeoDB_endpoint(
543
657
  catalog_config: dict,
@@ -605,7 +719,10 @@ def handle_GeoDB_endpoint(
605
719
  locations_collection = get_or_create_collection(
606
720
  collection, key, sc_config, catalog_config, endpoint_config
607
721
  )
608
- if input_data:
722
+ # check if input data is none
723
+ if input_data is None:
724
+ input_data = []
725
+ if len(input_data) > 0 or endpoint_config.get("FeatureCollection"):
609
726
  items = []
610
727
  for v in values:
611
728
  # add items based on inputData fields for each time step available in values
@@ -636,14 +753,36 @@ def handle_GeoDB_endpoint(
636
753
  bbox = shapely_geometry.bounds
637
754
  else:
638
755
  geometry = create_geometry_from_bbox(bbox)
756
+
757
+ assets = {"dummy_asset": Asset(href="")}
758
+ if endpoint_config.get("FeatureCollection"):
759
+ assets["geodbfeatures"] = Asset(
760
+ href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['FeatureCollection']}?aoi_id=eq.{v['aoi_id']}&time=eq.{v['time']}",
761
+ media_type="application/geodb+json",
762
+ roles=["data"],
763
+ )
639
764
  item = Item(
640
765
  id=v["time"],
641
766
  bbox=bbox,
642
767
  properties={},
643
768
  geometry=geometry,
644
769
  datetime=time_object,
645
- assets={"dummy_asset": Asset(href="")},
770
+ assets=assets,
646
771
  )
772
+ # make sure to also add Style link if FeatureCollection and Style has been provided
773
+ if endpoint_config.get("FeatureCollection") and endpoint_config.get("Style"):
774
+ ep_st = endpoint_config.get("Style")
775
+ style_link = Link(
776
+ rel="style",
777
+ target=ep_st
778
+ if ep_st.startswith("http")
779
+ else f"{catalog_config['assets_endpoint']}/{ep_st}",
780
+ media_type="text/vector-styles",
781
+ extra_fields={
782
+ "asset:keys": list(assets),
783
+ },
784
+ )
785
+ item.add_link(style_link)
647
786
  if first_match:
648
787
  match first_match["Type"]:
649
788
  case "WMS":
@@ -707,6 +846,22 @@ def handle_GeoDB_endpoint(
707
846
  )
708
847
  item.add_link(link)
709
848
  items.append(item)
849
+ elif endpoint_config.get("FeatureCollection"):
850
+ # no input data match found, just add the item with asset only
851
+ assets["geodbfeatures"] = Asset(
852
+ href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['FeatureCollection']}?aoi_id=eq.{v['aoi_id']}&time=eq.{v['time']}",
853
+ media_type="application/geodb+json",
854
+ roles=["data"],
855
+ )
856
+ item = Item(
857
+ id=v["time"],
858
+ bbox=bbox,
859
+ properties={},
860
+ geometry=geometry,
861
+ datetime=time_object,
862
+ assets=assets,
863
+ )
864
+ items.append(item)
710
865
  save_items(
711
866
  locations_collection,
712
867
  items,
@@ -19,6 +19,7 @@ from eodash_catalog.endpoints import (
19
19
  handle_collection_only,
20
20
  handle_custom_endpoint,
21
21
  handle_GeoDB_endpoint,
22
+ handle_GeoDB_Features_endpoint,
22
23
  handle_rasdaman_endpoint,
23
24
  handle_raw_source,
24
25
  handle_SH_endpoint,
@@ -241,6 +242,15 @@ def process_collection_file(
241
242
  catalog,
242
243
  options,
243
244
  )
245
+ elif endpoint_config["Name"] == "GeoDB Features":
246
+ collection = handle_GeoDB_Features_endpoint(
247
+ catalog_config,
248
+ endpoint_config,
249
+ collection_config,
250
+ coll_path_rel_to_root_catalog,
251
+ catalog,
252
+ options,
253
+ )
244
254
  elif endpoint_config["Name"] == "VEDA":
245
255
  collection = handle_VEDA_endpoint(
246
256
  catalog_config,
@@ -640,5 +640,4 @@ def make_intervals(datetimes: list[datetime]) -> list[list[datetime]]:
640
640
  prev_interval = datetimes[-1] - datetimes[-2]
641
641
  end = start + prev_interval
642
642
  intervals.append([start, end])
643
- LOGGER.info(intervals)
644
643
  return intervals
File without changes
File without changes