eodash_catalog 0.3.3__py3-none-any.whl → 0.3.5__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.
- eodash_catalog/__about__.py +1 -1
- eodash_catalog/endpoints.py +158 -2
- eodash_catalog/generate_indicators.py +10 -0
- eodash_catalog/utils.py +0 -1
- {eodash_catalog-0.3.3.dist-info → eodash_catalog-0.3.5.dist-info}/METADATA +1 -1
- eodash_catalog-0.3.5.dist-info/RECORD +14 -0
- eodash_catalog-0.3.3.dist-info/RECORD +0 -14
- {eodash_catalog-0.3.3.dist-info → eodash_catalog-0.3.5.dist-info}/WHEEL +0 -0
- {eodash_catalog-0.3.3.dist-info → eodash_catalog-0.3.5.dist-info}/entry_points.txt +0 -0
- {eodash_catalog-0.3.3.dist-info → eodash_catalog-0.3.5.dist-info}/licenses/LICENSE.txt +0 -0
eodash_catalog/__about__.py
CHANGED
eodash_catalog/endpoints.py
CHANGED
|
@@ -538,6 +538,121 @@ 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
|
+
add_collection_information(catalog_config, collection, collection_config)
|
|
654
|
+
return collection
|
|
655
|
+
|
|
541
656
|
|
|
542
657
|
def handle_GeoDB_endpoint(
|
|
543
658
|
catalog_config: dict,
|
|
@@ -605,7 +720,10 @@ def handle_GeoDB_endpoint(
|
|
|
605
720
|
locations_collection = get_or_create_collection(
|
|
606
721
|
collection, key, sc_config, catalog_config, endpoint_config
|
|
607
722
|
)
|
|
608
|
-
if
|
|
723
|
+
# check if input data is none
|
|
724
|
+
if input_data is None:
|
|
725
|
+
input_data = []
|
|
726
|
+
if len(input_data) > 0 or endpoint_config.get("FeatureCollection"):
|
|
609
727
|
items = []
|
|
610
728
|
for v in values:
|
|
611
729
|
# add items based on inputData fields for each time step available in values
|
|
@@ -636,14 +754,36 @@ def handle_GeoDB_endpoint(
|
|
|
636
754
|
bbox = shapely_geometry.bounds
|
|
637
755
|
else:
|
|
638
756
|
geometry = create_geometry_from_bbox(bbox)
|
|
757
|
+
|
|
758
|
+
assets = {"dummy_asset": Asset(href="")}
|
|
759
|
+
if endpoint_config.get("FeatureCollection"):
|
|
760
|
+
assets["geodbfeatures"] = Asset(
|
|
761
|
+
href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['FeatureCollection']}?aoi_id=eq.{v['aoi_id']}&time=eq.{v['time']}",
|
|
762
|
+
media_type="application/geodb+json",
|
|
763
|
+
roles=["data"],
|
|
764
|
+
)
|
|
639
765
|
item = Item(
|
|
640
766
|
id=v["time"],
|
|
641
767
|
bbox=bbox,
|
|
642
768
|
properties={},
|
|
643
769
|
geometry=geometry,
|
|
644
770
|
datetime=time_object,
|
|
645
|
-
assets=
|
|
771
|
+
assets=assets,
|
|
646
772
|
)
|
|
773
|
+
# make sure to also add Style link if FeatureCollection and Style has been provided
|
|
774
|
+
if endpoint_config.get("FeatureCollection") and endpoint_config.get("Style"):
|
|
775
|
+
ep_st = endpoint_config.get("Style")
|
|
776
|
+
style_link = Link(
|
|
777
|
+
rel="style",
|
|
778
|
+
target=ep_st
|
|
779
|
+
if ep_st.startswith("http")
|
|
780
|
+
else f"{catalog_config['assets_endpoint']}/{ep_st}",
|
|
781
|
+
media_type="text/vector-styles",
|
|
782
|
+
extra_fields={
|
|
783
|
+
"asset:keys": list(assets),
|
|
784
|
+
},
|
|
785
|
+
)
|
|
786
|
+
item.add_link(style_link)
|
|
647
787
|
if first_match:
|
|
648
788
|
match first_match["Type"]:
|
|
649
789
|
case "WMS":
|
|
@@ -707,6 +847,22 @@ def handle_GeoDB_endpoint(
|
|
|
707
847
|
)
|
|
708
848
|
item.add_link(link)
|
|
709
849
|
items.append(item)
|
|
850
|
+
elif endpoint_config.get("FeatureCollection"):
|
|
851
|
+
# no input data match found, just add the item with asset only
|
|
852
|
+
assets["geodbfeatures"] = Asset(
|
|
853
|
+
href=f"{endpoint_config['EndPoint']}{endpoint_config['Database']}_{endpoint_config['FeatureCollection']}?aoi_id=eq.{v['aoi_id']}&time=eq.{v['time']}",
|
|
854
|
+
media_type="application/geodb+json",
|
|
855
|
+
roles=["data"],
|
|
856
|
+
)
|
|
857
|
+
item = Item(
|
|
858
|
+
id=v["time"],
|
|
859
|
+
bbox=bbox,
|
|
860
|
+
properties={},
|
|
861
|
+
geometry=geometry,
|
|
862
|
+
datetime=time_object,
|
|
863
|
+
assets=assets,
|
|
864
|
+
)
|
|
865
|
+
items.append(item)
|
|
710
866
|
save_items(
|
|
711
867
|
locations_collection,
|
|
712
868
|
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,
|
eodash_catalog/utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.5
|
|
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
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
eodash_catalog/__about__.py,sha256=gHsXXgTiHPfmLt7-0a6FTGSnLZz-WvigY1F818gTV4k,137
|
|
2
|
+
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
+
eodash_catalog/duration.py,sha256=TBG7v1lCpbYowADK5uJ2M8kPxsvQneFAFi1NIE26dy4,10754
|
|
4
|
+
eodash_catalog/endpoints.py,sha256=b9rZ0TUyNYcPU4gJGH1Fz2OvT3DaUqhYQMhzWbv1BV8,59839
|
|
5
|
+
eodash_catalog/generate_indicators.py,sha256=BoCOtBZYbJA_vRjkwyUYWuIJH91Ddo9RP7Jwzzf4xhU,22334
|
|
6
|
+
eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
|
|
7
|
+
eodash_catalog/stac_handling.py,sha256=xMhUK_gvijs6tL-1ecg28DtWBo4msd5NTYZpYtt7FHo,25877
|
|
8
|
+
eodash_catalog/thumbnails.py,sha256=oNbWdRC8KTLUC4PbSMlSaiOeLXfkIpa0j-sOZdn1RGU,2262
|
|
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,,
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
eodash_catalog/__about__.py,sha256=jakR3FNEOvU2GrvtecX6moFoNPby5Ok50p6_6JcZoEQ,137
|
|
2
|
-
eodash_catalog/__init__.py,sha256=_W_9emPYf6FUqc0P8L2SmADx6hGSd7PlQV3yRmCk5uM,115
|
|
3
|
-
eodash_catalog/duration.py,sha256=TBG7v1lCpbYowADK5uJ2M8kPxsvQneFAFi1NIE26dy4,10754
|
|
4
|
-
eodash_catalog/endpoints.py,sha256=uI7aapRHQ1eDYQYKlrMdLHi_6aitBS3jutrou2HDWJY,53183
|
|
5
|
-
eodash_catalog/generate_indicators.py,sha256=FPeiZm9TE4PpbTyH6UMegQ7HwaARzO91IrLtzFjFSF0,21900
|
|
6
|
-
eodash_catalog/sh_endpoint.py,sha256=XjZsZJ5jfJZLQenSTqUhiUZ5YAu9M9nv2KL1Qv3Be-I,1219
|
|
7
|
-
eodash_catalog/stac_handling.py,sha256=xMhUK_gvijs6tL-1ecg28DtWBo4msd5NTYZpYtt7FHo,25877
|
|
8
|
-
eodash_catalog/thumbnails.py,sha256=oNbWdRC8KTLUC4PbSMlSaiOeLXfkIpa0j-sOZdn1RGU,2262
|
|
9
|
-
eodash_catalog/utils.py,sha256=C-HQK6IYMNAd3Vfgq9KOqsBlJu-jtnZTcsHGp4kj7Y0,23773
|
|
10
|
-
eodash_catalog-0.3.3.dist-info/METADATA,sha256=H1Npnw-SZ3hAerwBs6ml0fscgSP9MkMDbVTryhPq7kM,3019
|
|
11
|
-
eodash_catalog-0.3.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
-
eodash_catalog-0.3.3.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
-
eodash_catalog-0.3.3.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
-
eodash_catalog-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|