eodash_catalog 0.0.37__tar.gz → 0.1.1__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.
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.bumpversion.cfg +1 -1
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/PKG-INFO +1 -3
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/__about__.py +1 -1
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/endpoints.py +76 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/generate_indicators.py +5 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/stac_handling.py +2 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/utils.py +47 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.github/workflows/ci.yml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.github/workflows/python-publish.yml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.gitignore +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.vscode/extensions.json +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/.vscode/settings.json +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/LICENSE.txt +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/README.md +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/pyproject.toml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/requirements.txt +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/ruff.toml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/__init__.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/duration.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/sh_endpoint.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/src/eodash_catalog/thumbnails.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/__init__.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/test-data/regional_forecast.json +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/test_generate.py +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-catalogs/testing.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_CROPOMAT1.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_see_solar_energy.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_tif_demo_1.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_tif_demo_2.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_wms_no_time.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-indicators/test_indicator.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-layers/baselayers.yaml +0 -0
- {eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-layers/overlays.yaml +0 -0
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.1
|
|
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-Expression: MIT
|
|
10
|
-
License-File: LICENSE.txt
|
|
11
9
|
Classifier: Development Status :: 4 - Beta
|
|
12
10
|
Classifier: Programming Language :: Python
|
|
13
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -31,12 +31,46 @@ from eodash_catalog.utils import (
|
|
|
31
31
|
generate_veda_cog_link,
|
|
32
32
|
parse_datestring_to_tz_aware_datetime,
|
|
33
33
|
replace_with_env_variables,
|
|
34
|
+
retrieveExtentFromWCS,
|
|
34
35
|
retrieveExtentFromWMSWMTS,
|
|
35
36
|
)
|
|
36
37
|
|
|
37
38
|
LOGGER = get_logger(__name__)
|
|
38
39
|
|
|
39
40
|
|
|
41
|
+
def process_WCS_rasdaman_Endpoint(
|
|
42
|
+
catalog_config: dict, endpoint_config: dict, collection_config: dict, catalog: Catalog
|
|
43
|
+
) -> Collection:
|
|
44
|
+
collection = get_or_create_collection(
|
|
45
|
+
catalog, collection_config["Name"], collection_config, catalog_config, endpoint_config
|
|
46
|
+
)
|
|
47
|
+
bbox, datetimes = retrieveExtentFromWCS(
|
|
48
|
+
endpoint_config["EndPoint"],
|
|
49
|
+
endpoint_config["CoverageId"],
|
|
50
|
+
version=endpoint_config.get("Version", "2.0.1"),
|
|
51
|
+
)
|
|
52
|
+
for dt in datetimes:
|
|
53
|
+
item = Item(
|
|
54
|
+
id=format_datetime_to_isostring_zulu(dt),
|
|
55
|
+
bbox=bbox,
|
|
56
|
+
properties={},
|
|
57
|
+
geometry=None,
|
|
58
|
+
datetime=dt,
|
|
59
|
+
)
|
|
60
|
+
add_visualization_info(item, collection_config, endpoint_config, datetimes=[dt])
|
|
61
|
+
link = collection.add_item(item)
|
|
62
|
+
# bubble up information we want to the link
|
|
63
|
+
link.extra_fields["datetime"] = format_datetime_to_isostring_zulu(dt)
|
|
64
|
+
|
|
65
|
+
if datetimes:
|
|
66
|
+
collection.update_extent_from_items()
|
|
67
|
+
else:
|
|
68
|
+
LOGGER.warn(f"NO datetimes returned for collection: {endpoint_config['CoverageId']}!")
|
|
69
|
+
|
|
70
|
+
add_collection_information(catalog_config, collection, collection_config)
|
|
71
|
+
return collection
|
|
72
|
+
|
|
73
|
+
|
|
40
74
|
def process_STAC_Datacube_Endpoint(
|
|
41
75
|
catalog_config: dict, endpoint_config: dict, collection_config: dict, catalog: Catalog
|
|
42
76
|
) -> Collection:
|
|
@@ -427,6 +461,16 @@ def handle_xcube_endpoint(
|
|
|
427
461
|
return collection
|
|
428
462
|
|
|
429
463
|
|
|
464
|
+
def handle_rasdaman_endpoint(
|
|
465
|
+
catalog_config: dict, endpoint_config: dict, collection_config: dict, catalog: Catalog
|
|
466
|
+
) -> Collection:
|
|
467
|
+
collection = process_WCS_rasdaman_Endpoint(
|
|
468
|
+
catalog_config, endpoint_config, collection_config, catalog
|
|
469
|
+
)
|
|
470
|
+
# add_example_info(collection, collection_config, endpoint_config, catalog_config)
|
|
471
|
+
return collection
|
|
472
|
+
|
|
473
|
+
|
|
430
474
|
def handle_GeoDB_endpoint(
|
|
431
475
|
catalog_config: dict, endpoint_config: dict, collection_config: dict, catalog: Catalog
|
|
432
476
|
) -> Collection:
|
|
@@ -705,6 +749,38 @@ def add_visualization_info(
|
|
|
705
749
|
link,
|
|
706
750
|
)
|
|
707
751
|
stac_object.add_link(link)
|
|
752
|
+
elif endpoint_config["Name"] == "rasdaman":
|
|
753
|
+
extra_fields.update(
|
|
754
|
+
{
|
|
755
|
+
"wms:layers": [endpoint_config["CoverageId"]],
|
|
756
|
+
"role": ["data"],
|
|
757
|
+
}
|
|
758
|
+
)
|
|
759
|
+
dimensions = {}
|
|
760
|
+
if dimensions_config := endpoint_config.get("Dimensions", {}):
|
|
761
|
+
for key, value in dimensions_config.items():
|
|
762
|
+
dimensions[key] = value
|
|
763
|
+
if datetimes is not None:
|
|
764
|
+
dimensions["TIME"] = format_datetime_to_isostring_zulu(datetimes[0])
|
|
765
|
+
if dimensions != {}:
|
|
766
|
+
extra_fields["wms:dimensions"] = dimensions
|
|
767
|
+
if "Styles" in endpoint_config:
|
|
768
|
+
extra_fields["wms:styles"] = endpoint_config["Styles"]
|
|
769
|
+
media_type = endpoint_config.get("MediaType", "image/png")
|
|
770
|
+
endpoint_url = endpoint_config["EndPoint"]
|
|
771
|
+
# custom replacing of all ENV VARS present as template in URL as {VAR}
|
|
772
|
+
link = Link(
|
|
773
|
+
rel="wms",
|
|
774
|
+
target=endpoint_url,
|
|
775
|
+
media_type=media_type,
|
|
776
|
+
title=collection_config["Name"],
|
|
777
|
+
extra_fields=extra_fields,
|
|
778
|
+
)
|
|
779
|
+
add_projection_info(
|
|
780
|
+
endpoint_config,
|
|
781
|
+
link,
|
|
782
|
+
)
|
|
783
|
+
stac_object.add_link(link)
|
|
708
784
|
elif endpoint_config["Name"] == "JAXA_WMTS_PALSAR":
|
|
709
785
|
target_url = "{}".format(endpoint_config.get("EndPoint"))
|
|
710
786
|
# custom time just for this special case as a default for collection wmts
|
|
@@ -21,6 +21,7 @@ from eodash_catalog.endpoints import (
|
|
|
21
21
|
handle_collection_only,
|
|
22
22
|
handle_custom_endpoint,
|
|
23
23
|
handle_GeoDB_endpoint,
|
|
24
|
+
handle_rasdaman_endpoint,
|
|
24
25
|
handle_raw_source,
|
|
25
26
|
handle_SH_endpoint,
|
|
26
27
|
handle_SH_WMS_endpoint,
|
|
@@ -229,6 +230,10 @@ def process_collection_file(
|
|
|
229
230
|
collection = handle_xcube_endpoint(
|
|
230
231
|
catalog_config, endpoint_config, collection_config, catalog
|
|
231
232
|
)
|
|
233
|
+
elif endpoint_config["Name"] == "rasdaman":
|
|
234
|
+
collection = handle_rasdaman_endpoint(
|
|
235
|
+
catalog_config, endpoint_config, collection_config, catalog
|
|
236
|
+
)
|
|
232
237
|
elif endpoint_config["Name"] == "WMS":
|
|
233
238
|
collection = handle_WMS_endpoint(
|
|
234
239
|
catalog_config, endpoint_config, collection_config, catalog
|
|
@@ -11,6 +11,7 @@ from functools import reduce, wraps
|
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
13
|
from dateutil import parser
|
|
14
|
+
from owslib.wcs import WebCoverageService
|
|
14
15
|
from owslib.wms import WebMapService
|
|
15
16
|
from owslib.wmts import WebMapTileService
|
|
16
17
|
from pystac import Catalog, Collection, Item, RelType
|
|
@@ -56,6 +57,52 @@ def create_geojson_from_bbox(bbox: list[float | int]) -> dict:
|
|
|
56
57
|
return feature_collection
|
|
57
58
|
|
|
58
59
|
|
|
60
|
+
def retrieveExtentFromWCS(
|
|
61
|
+
capabilities_url: str,
|
|
62
|
+
coverage: str,
|
|
63
|
+
version: str = "2.0.1",
|
|
64
|
+
) -> tuple[list[float], list[datetime]]:
|
|
65
|
+
times = []
|
|
66
|
+
try:
|
|
67
|
+
service = WebCoverageService(capabilities_url, version)
|
|
68
|
+
if coverage in list(service.contents):
|
|
69
|
+
description = service.getDescribeCoverage(coverage)
|
|
70
|
+
area_val = description.findall(".//{http://www.rasdaman.org}areasOfValidity")
|
|
71
|
+
if len(area_val) == 1:
|
|
72
|
+
areas = area_val[0].getchildren()
|
|
73
|
+
if len(areas) > 1:
|
|
74
|
+
times = [t.get("start") for t in areas]
|
|
75
|
+
# get unique times
|
|
76
|
+
times = reduce(lambda re, x: [*re, x] if x not in re else re, times, [])
|
|
77
|
+
except Exception as e:
|
|
78
|
+
LOGGER.warn("Issue extracting information from service capabilities")
|
|
79
|
+
template = "An exception of type {0} occurred. Arguments:\n{1!r}"
|
|
80
|
+
message = template.format(type(e).__name__, e.args)
|
|
81
|
+
LOGGER.warn(message)
|
|
82
|
+
|
|
83
|
+
bbox = [-180.0, -90.0, 180.0, 90.0]
|
|
84
|
+
owsnmspc = "{http://www.opengis.net/ows/2.0}"
|
|
85
|
+
# somehow this is not parsed from the rasdaman endpoint
|
|
86
|
+
if service and service[coverage].boundingBoxWGS84:
|
|
87
|
+
bbox = [float(x) for x in service[coverage].boundingBoxWGS84]
|
|
88
|
+
elif service:
|
|
89
|
+
# we try to get it ourselves
|
|
90
|
+
wgs84bbox = service.contents[coverage]._elem.findall(".//" + owsnmspc + "WGS84BoundingBox")
|
|
91
|
+
if len(wgs84bbox) == 1:
|
|
92
|
+
lc = wgs84bbox[0].find(".//" + owsnmspc + "LowerCorner").text
|
|
93
|
+
uc = wgs84bbox[0].find(".//" + owsnmspc + "UpperCorner").text
|
|
94
|
+
bbox = [
|
|
95
|
+
float(lc.split()[0]),
|
|
96
|
+
float(lc.split()[1]),
|
|
97
|
+
float(uc.split()[0]),
|
|
98
|
+
float(uc.split()[1]),
|
|
99
|
+
]
|
|
100
|
+
description.findall(".//{http://www.rasdaman.org}areasOfValidity")
|
|
101
|
+
|
|
102
|
+
datetimes = [parse_datestring_to_tz_aware_datetime(time_str) for time_str in times]
|
|
103
|
+
return bbox, datetimes
|
|
104
|
+
|
|
105
|
+
|
|
59
106
|
def retrieveExtentFromWMSWMTS(
|
|
60
107
|
capabilities_url: str, layer: str, version: str = "1.1.1", wmts: bool = False
|
|
61
108
|
) -> tuple[list[float], list[datetime]]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_CROPOMAT1.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_see_solar_energy.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_tif_demo_1.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_tif_demo_2.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.0.37 → eodash_catalog-0.1.1}/tests/testing-collections/test_wms_no_time.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|