eodash_catalog 0.3.6__py3-none-any.whl → 0.3.8__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.
- eodash_catalog/__about__.py +1 -1
- eodash_catalog/endpoints.py +36 -12
- eodash_catalog/stac_handling.py +7 -4
- {eodash_catalog-0.3.6.dist-info → eodash_catalog-0.3.8.dist-info}/METADATA +1 -1
- {eodash_catalog-0.3.6.dist-info → eodash_catalog-0.3.8.dist-info}/RECORD +8 -8
- {eodash_catalog-0.3.6.dist-info → eodash_catalog-0.3.8.dist-info}/WHEEL +0 -0
- {eodash_catalog-0.3.6.dist-info → eodash_catalog-0.3.8.dist-info}/entry_points.txt +0 -0
- {eodash_catalog-0.3.6.dist-info → eodash_catalog-0.3.8.dist-info}/licenses/LICENSE.txt +0 -0
eodash_catalog/__about__.py
CHANGED
eodash_catalog/endpoints.py
CHANGED
|
@@ -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
|
-
|
|
614
|
-
|
|
615
|
-
|
|
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]),
|
|
@@ -724,7 +722,33 @@ def handle_GeoDB_endpoint(
|
|
|
724
722
|
input_data = []
|
|
725
723
|
if len(input_data) > 0 or endpoint_config.get("FeatureCollection"):
|
|
726
724
|
items = []
|
|
727
|
-
|
|
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:
|
|
728
752
|
# add items based on inputData fields for each time step available in values
|
|
729
753
|
first_match: dict = next(
|
|
730
754
|
(item for item in input_data if item.get("Identifier") == v["input_data"]), None
|
eodash_catalog/stac_handling.py
CHANGED
|
@@ -307,18 +307,21 @@ def add_collection_information(
|
|
|
307
307
|
),
|
|
308
308
|
)
|
|
309
309
|
if collection_config.get("Image"):
|
|
310
|
+
# Check if absolute URL or relative path
|
|
311
|
+
if collection_config["Image"].startswith("http"):
|
|
312
|
+
image_url = collection_config["Image"]
|
|
313
|
+
else:
|
|
314
|
+
image_url = f'{catalog_config["assets_endpoint"]}/{collection_config["Image"]}'
|
|
310
315
|
collection.add_asset(
|
|
311
316
|
"thumbnail",
|
|
312
317
|
Asset(
|
|
313
|
-
href=
|
|
318
|
+
href=image_url,
|
|
314
319
|
media_type="image/png",
|
|
315
320
|
roles=["thumbnail"],
|
|
316
321
|
),
|
|
317
322
|
)
|
|
318
323
|
# Bubble up thumbnail to extra fields
|
|
319
|
-
collection.extra_fields["thumbnail"] = (
|
|
320
|
-
f'{catalog_config["assets_endpoint"]}/' f'{collection_config["Image"]}'
|
|
321
|
-
)
|
|
324
|
+
collection.extra_fields["thumbnail"] = (image_url)
|
|
322
325
|
# Add extra fields to collection if available
|
|
323
326
|
add_extra_fields(collection, collection_config, is_root_collection)
|
|
324
327
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.8
|
|
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=
|
|
1
|
+
eodash_catalog/__about__.py,sha256=uyon-G635Vi1osZVVTkD59AUqEeBubsU0833nzclrvA,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=
|
|
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
|
-
eodash_catalog/stac_handling.py,sha256=
|
|
7
|
+
eodash_catalog/stac_handling.py,sha256=ZBk4AXtBNZ0Trr_oszhFGo8ypbGu3ox3KqfIVpc7ZuQ,25999
|
|
8
8
|
eodash_catalog/thumbnails.py,sha256=oNbWdRC8KTLUC4PbSMlSaiOeLXfkIpa0j-sOZdn1RGU,2262
|
|
9
9
|
eodash_catalog/utils.py,sha256=X40eQNRq8kh7ZATofX12V9EtUpMRdTTfkozBdqkKMJU,23746
|
|
10
|
-
eodash_catalog-0.3.
|
|
11
|
-
eodash_catalog-0.3.
|
|
12
|
-
eodash_catalog-0.3.
|
|
13
|
-
eodash_catalog-0.3.
|
|
14
|
-
eodash_catalog-0.3.
|
|
10
|
+
eodash_catalog-0.3.8.dist-info/METADATA,sha256=uJ2tsCynZliVkLmaUj7TgQuyMccup-Dc4hdnSvYSHh0,3019
|
|
11
|
+
eodash_catalog-0.3.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
eodash_catalog-0.3.8.dist-info/entry_points.txt,sha256=kuUQrDG1PtYd8kPjf5XM6H_NtQd9Ozwl0jjiGtAvZSM,87
|
|
13
|
+
eodash_catalog-0.3.8.dist-info/licenses/LICENSE.txt,sha256=oJCW5zQxnFD-J0hGz6Zh5Lkpdk1oAndmWhseTmV224E,1107
|
|
14
|
+
eodash_catalog-0.3.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|