eodash_catalog 0.3.5__py3-none-any.whl → 0.3.7__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.3.5"
4
+ __version__ = "0.3.7"
@@ -1,3 +1,4 @@
1
+ import copy
1
2
  import importlib
2
3
  import io
3
4
  import json
@@ -538,6 +539,7 @@ def handle_rasdaman_endpoint(
538
539
  # add_example_info(collection, collection_config, endpoint_config, catalog_config)
539
540
  return collection
540
541
 
542
+
541
543
  def handle_GeoDB_Features_endpoint(
542
544
  catalog_config: dict,
543
545
  endpoint_config: dict,
@@ -546,7 +548,6 @@ def handle_GeoDB_Features_endpoint(
546
548
  catalog: Catalog,
547
549
  options: Options,
548
550
  ) -> Collection:
549
-
550
551
  # ID of collection is data["Name"] instead of CollectionId to be able to
551
552
  # create more STAC collections from one geoDB table
552
553
  collection = get_or_create_collection(
@@ -581,13 +582,9 @@ def handle_GeoDB_Features_endpoint(
581
582
  datetime(time_object.year, time_object.month, time_object.day).date()
582
583
  )
583
584
  case "month":
584
- unique_datetimes.add(
585
- datetime(time_object.year, time_object.month, 1).date()
586
- )
585
+ unique_datetimes.add(datetime(time_object.year, time_object.month, 1).date())
587
586
  case "year":
588
- unique_datetimes.add(
589
- datetime(time_object.year, 1, 1).date()
590
- )
587
+ unique_datetimes.add(datetime(time_object.year, 1, 1).date())
591
588
  case _:
592
589
  # default to day
593
590
  unique_datetimes.add(
@@ -610,10 +607,11 @@ def handle_GeoDB_Features_endpoint(
610
607
  updated_query = endpoint_config["Query"].replace("{{date_time}}", matching_string)
611
608
  assets = {
612
609
  "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
- )}
610
+ href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['CollectionId']}?{updated_query}",
611
+ media_type="application/geodb+json",
612
+ roles=["data"],
613
+ )
614
+ }
617
615
  item = Item(
618
616
  id=format_datetime_to_isostring_zulu(item_datetime),
619
617
  bbox=endpoint_config.get("OverwriteBBox", [-180, -90, 180, 90]),
@@ -641,13 +639,12 @@ def handle_GeoDB_Features_endpoint(
641
639
  item.add_link(style_link)
642
640
  add_projection_info(endpoint_config, item)
643
641
  items.append(item)
644
-
645
642
  save_items(
646
643
  collection,
647
644
  items,
648
645
  options.outputpath,
649
646
  catalog_config["id"],
650
- f"{coll_path_rel_to_root_catalog}/{collection.id}",
647
+ coll_path_rel_to_root_catalog,
651
648
  options.gp,
652
649
  )
653
650
  add_collection_information(catalog_config, collection, collection_config)
@@ -725,7 +722,33 @@ def handle_GeoDB_endpoint(
725
722
  input_data = []
726
723
  if len(input_data) > 0 or endpoint_config.get("FeatureCollection"):
727
724
  items = []
728
- for v in values:
725
+ content_for_individual_datetimes = values
726
+ if endpoint_config.get("MapTimesCollection"):
727
+ # extract datetimes from another table if configured so and match it based on aoi_id
728
+ # special for E13d
729
+ select = f"?select=time&aoi_id=eq.{key}"
730
+ url = (
731
+ endpoint_config["EndPoint"]
732
+ + endpoint_config["Database"]
733
+ + "_{}".format(endpoint_config["MapTimesCollection"])
734
+ + select
735
+ )
736
+ response = json.loads(requests.get(url).text)
737
+ content_for_individual_datetimes = []
738
+ for response_obj in response:
739
+ time_object = datetime.fromisoformat(response_obj["time"])
740
+ for searched_row in values:
741
+ search_datetime = datetime.fromisoformat(searched_row["time"])
742
+ if (
743
+ search_datetime.month == time_object.month
744
+ and search_datetime.year == time_object.year
745
+ ):
746
+ break
747
+ insert_row = copy.deepcopy(searched_row)
748
+ # overwrite time with one from another collection and save
749
+ insert_row["time"] = response_obj["time"]
750
+ content_for_individual_datetimes.append(insert_row)
751
+ for v in content_for_individual_datetimes:
729
752
  # add items based on inputData fields for each time step available in values
730
753
  first_match: dict = next(
731
754
  (item for item in input_data if item.get("Identifier") == v["input_data"]), None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: eodash_catalog
3
- Version: 0.3.5
3
+ Version: 0.3.7
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,14 +1,14 @@
1
- eodash_catalog/__about__.py,sha256=gHsXXgTiHPfmLt7-0a6FTGSnLZz-WvigY1F818gTV4k,137
1
+ eodash_catalog/__about__.py,sha256=JaxzJ65twSrbZXD5eQncQQZirlgAGhGZNFm-619pdek,137
2
2
  eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
3
3
  eodash_catalog/duration.py,sha256=TBG7v1lCpbYowADK5uJ2M8kPxsvQneFAFi1NIE26dy4,10754
4
- eodash_catalog/endpoints.py,sha256=b9rZ0TUyNYcPU4gJGH1Fz2OvT3DaUqhYQMhzWbv1BV8,59839
4
+ eodash_catalog/endpoints.py,sha256=lxSy9Ai9UNPt5y3qdFzkOUxhU9JnfGLs50CsTNAZjo8,61236
5
5
  eodash_catalog/generate_indicators.py,sha256=BoCOtBZYbJA_vRjkwyUYWuIJH91Ddo9RP7Jwzzf4xhU,22334
6
6
  eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
7
7
  eodash_catalog/stac_handling.py,sha256=xMhUK_gvijs6tL-1ecg28DtWBo4msd5NTYZpYtt7FHo,25877
8
8
  eodash_catalog/thumbnails.py,sha256=oNbWdRC8KTLUC4PbSMlSaiOeLXfkIpa0j-sOZdn1RGU,2262
9
9
  eodash_catalog/utils.py,sha256=X40eQNRq8kh7ZATofX12V9EtUpMRdTTfkozBdqkKMJU,23746
10
- eodash_catalog-0.3.5.dist-info/METADATA,sha256=CbHXrC__UkZFpdR6Sis2Ki9Eo71ELJ62frMYnydI48A,3019
11
- eodash_catalog-0.3.5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
- eodash_catalog-0.3.5.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
- eodash_catalog-0.3.5.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
- eodash_catalog-0.3.5.dist-info/RECORD,,
10
+ eodash_catalog-0.3.7.dist-info/METADATA,sha256=x8sCCZ71Q1ht5VrbShTTn_UjHpJoAEaredRg7el_Qf0,3019
11
+ eodash_catalog-0.3.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
12
+ eodash_catalog-0.3.7.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
13
+ eodash_catalog-0.3.7.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
14
+ eodash_catalog-0.3.7.dist-info/RECORD,,