eodash_catalog 0.3.0__tar.gz → 0.3.2__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.3.0 → eodash_catalog-0.3.2}/.bumpversion.cfg +1 -1
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/Dockerfile +1 -1
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/PKG-INFO +1 -1
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/__about__.py +1 -1
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/endpoints.py +35 -1
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/utils.py +33 -22
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/test_geoparquet.py +5 -5
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.dockerignore +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.github/workflows/ci.yml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.github/workflows/python-publish.yml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.gitignore +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.vscode/extensions.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/.vscode/settings.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/LICENSE.txt +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/README.md +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/pyproject.toml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/requirements.txt +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/ruff.toml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/__init__.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/duration.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/generate_indicators.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/sh_endpoint.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/stac_handling.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/src/eodash_catalog/thumbnails.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/__init__.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/test-data/regional_forecast.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/test_generate.py +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-catalogs/testing-json.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-catalogs/testing.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_CROPOMAT1.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_cmems.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_cog.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_geodb.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_geodb_locations.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_geojson.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_locations_processing.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_process.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_projection.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_see_solar_energy.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms_locations.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1_json.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_2.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda_tiles.json +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_wms_no_time.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-indicators/test_indicator.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-layers/baselayers.yaml +0 -0
- {eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-layers/overlays.yaml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: eodash_catalog
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
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,5 @@
|
|
|
1
1
|
import importlib
|
|
2
|
+
import io
|
|
2
3
|
import json
|
|
3
4
|
import os
|
|
4
5
|
import sys
|
|
@@ -8,6 +9,7 @@ from datetime import datetime, timedelta
|
|
|
8
9
|
from itertools import groupby
|
|
9
10
|
from operator import itemgetter
|
|
10
11
|
|
|
12
|
+
import pyarrow.parquet as pq
|
|
11
13
|
import requests
|
|
12
14
|
from pystac import Asset, Catalog, Collection, Item, Link, SpatialExtent, Summaries, TemporalExtent
|
|
13
15
|
from pystac_client import Client
|
|
@@ -28,6 +30,7 @@ from eodash_catalog.thumbnails import generate_thumbnail
|
|
|
28
30
|
from eodash_catalog.utils import (
|
|
29
31
|
Options,
|
|
30
32
|
create_geometry_from_bbox,
|
|
33
|
+
extract_extent_from_geoparquet,
|
|
31
34
|
filter_time_entries,
|
|
32
35
|
format_datetime_to_isostring_zulu,
|
|
33
36
|
generate_veda_cog_link,
|
|
@@ -830,7 +833,11 @@ def generate_veda_tiles_link(endpoint_config: dict, item: str | None) -> str:
|
|
|
830
833
|
if endpoint_config.get("NoData"):
|
|
831
834
|
no_data = "&no_data={}".format(endpoint_config["NoData"])
|
|
832
835
|
item = item if item else "{item}"
|
|
833
|
-
|
|
836
|
+
target_url_base = endpoint_config["EndPoint"].replace("/stac/", "")
|
|
837
|
+
target_url = (
|
|
838
|
+
f"{target_url_base}/raster/collections/{collection}/items/{item}"
|
|
839
|
+
f"/tiles/WebMercatorQuad/{{z}}/{{x}}/{{y}}?{assets}{color_formula}{no_data}"
|
|
840
|
+
)
|
|
834
841
|
return target_url
|
|
835
842
|
|
|
836
843
|
|
|
@@ -1214,6 +1221,33 @@ def handle_raw_source(
|
|
|
1214
1221
|
# eodash v4 compatibility, adding last referenced style to collection
|
|
1215
1222
|
if style_link:
|
|
1216
1223
|
collection.add_link(style_link)
|
|
1224
|
+
elif endpoint_config.get("ParquetSource"):
|
|
1225
|
+
# if parquet source is provided, download it and create items from it
|
|
1226
|
+
parquet_source = endpoint_config["ParquetSource"]
|
|
1227
|
+
if parquet_source.startswith("http"):
|
|
1228
|
+
# download parquet file
|
|
1229
|
+
parquet_file = requests.get(parquet_source)
|
|
1230
|
+
if parquet_file.status_code != 200:
|
|
1231
|
+
LOGGER.error(f"Failed to download parquet file from {parquet_source}")
|
|
1232
|
+
return collection
|
|
1233
|
+
try:
|
|
1234
|
+
table = pq.read_table(io.BytesIO(parquet_file.content))
|
|
1235
|
+
except Exception as e:
|
|
1236
|
+
LOGGER.error(f"Failed to read parquet file: {e}")
|
|
1237
|
+
return collection
|
|
1238
|
+
extents = extract_extent_from_geoparquet(table)
|
|
1239
|
+
collection.extent.temporal = extents[0]
|
|
1240
|
+
collection.extent.spatial = extents[1]
|
|
1241
|
+
collection.add_asset(
|
|
1242
|
+
"geoparquet",
|
|
1243
|
+
Asset(
|
|
1244
|
+
href=parquet_source,
|
|
1245
|
+
media_type="application/vnd.apache.parquet",
|
|
1246
|
+
title="GeoParquet Items",
|
|
1247
|
+
roles=["collection-mirror"],
|
|
1248
|
+
),
|
|
1249
|
+
)
|
|
1250
|
+
|
|
1217
1251
|
else:
|
|
1218
1252
|
LOGGER.warn(f"NO datetimes configured for collection: {collection_config['Name']}!")
|
|
1219
1253
|
|
|
@@ -18,7 +18,7 @@ from dateutil import parser
|
|
|
18
18
|
from owslib.wcs import WebCoverageService
|
|
19
19
|
from owslib.wms import WebMapService
|
|
20
20
|
from owslib.wmts import WebMapTileService
|
|
21
|
-
from pystac import Asset, Catalog, Collection, Item,
|
|
21
|
+
from pystac import Asset, Catalog, Collection, Item, RelType, SpatialExtent, TemporalExtent
|
|
22
22
|
from pytz import timezone as pytztimezone
|
|
23
23
|
from shapely import geometry as sgeom
|
|
24
24
|
from shapely import wkb
|
|
@@ -290,8 +290,12 @@ def generate_veda_cog_link(endpoint_config: dict, file_url: str | None) -> str:
|
|
|
290
290
|
)
|
|
291
291
|
|
|
292
292
|
file_url = f"url={file_url}&" if file_url else ""
|
|
293
|
-
|
|
294
|
-
target_url =
|
|
293
|
+
target_url_base = endpoint_config["EndPoint"].replace("/stac/", "")
|
|
294
|
+
target_url = (
|
|
295
|
+
f"{target_url_base}/raster/cog/tiles/WebMercatorQuad/{{z}}/{{x}}/{{y}}?"
|
|
296
|
+
f"{file_url}resampling_method=nearest"
|
|
297
|
+
f"{bidx}{colormap}{colormap_name}{rescale}{Nodata}"
|
|
298
|
+
)
|
|
295
299
|
return target_url
|
|
296
300
|
|
|
297
301
|
|
|
@@ -444,6 +448,29 @@ def update_extents_from_collection_children(collection: Collection):
|
|
|
444
448
|
collection.extent.temporal = TemporalExtent([time_extent])
|
|
445
449
|
|
|
446
450
|
|
|
451
|
+
def extract_extent_from_geoparquet(table) -> tuple[TemporalExtent, SpatialExtent]:
|
|
452
|
+
"""
|
|
453
|
+
Extract spatial and temporal extents from a GeoParquet file.
|
|
454
|
+
Args:
|
|
455
|
+
table (pyarrow.Table): The table containing the GeoParquet data.
|
|
456
|
+
Returns:
|
|
457
|
+
tuple: A tuple containing spatial and temporal extents.
|
|
458
|
+
"""
|
|
459
|
+
# add extent information to the collection
|
|
460
|
+
min_datetime = pc.min(table["datetime"]).as_py()
|
|
461
|
+
max_datetime = pc.max(table["datetime"]).as_py()
|
|
462
|
+
if not min_datetime:
|
|
463
|
+
# cases when datetime was null
|
|
464
|
+
# fallback to start_datetime
|
|
465
|
+
min_datetime = pc.min(table["start_datetime"]).as_py()
|
|
466
|
+
max_datetime = pc.max(table["start_datetime"]).as_py()
|
|
467
|
+
temporal = TemporalExtent([min_datetime, max_datetime])
|
|
468
|
+
geoms = [wkb.loads(g.as_py()) for g in table["geometry"] if g is not None]
|
|
469
|
+
bbox = sgeom.MultiPolygon(geoms).bounds
|
|
470
|
+
spatial = SpatialExtent([bbox])
|
|
471
|
+
return [temporal, spatial]
|
|
472
|
+
|
|
473
|
+
|
|
447
474
|
def save_items(
|
|
448
475
|
collection: Collection,
|
|
449
476
|
items: list[Item],
|
|
@@ -493,25 +520,9 @@ def save_items(
|
|
|
493
520
|
output_path = f"{buildcatpath}/{colpath}"
|
|
494
521
|
os.makedirs(output_path, exist_ok=True)
|
|
495
522
|
stacgp.arrow.to_parquet(table, f"{output_path}/items.parquet")
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
media_type="application/vnd.apache.parquet",
|
|
500
|
-
title="GeoParquet Items",
|
|
501
|
-
)
|
|
502
|
-
collection.add_link(gp_link)
|
|
503
|
-
# add extent information to the collection
|
|
504
|
-
min_datetime = pc.min(table["datetime"]).as_py()
|
|
505
|
-
max_datetime = pc.max(table["datetime"]).as_py()
|
|
506
|
-
if not min_datetime:
|
|
507
|
-
# cases when datetime was null
|
|
508
|
-
# fallback to start_datetime
|
|
509
|
-
min_datetime = pc.min(table["start_datetime"]).as_py()
|
|
510
|
-
max_datetime = pc.max(table["start_datetime"]).as_py()
|
|
511
|
-
collection.extent.temporal = TemporalExtent([min_datetime, max_datetime])
|
|
512
|
-
geoms = [wkb.loads(g.as_py()) for g in table["geometry"] if g is not None]
|
|
513
|
-
bbox = sgeom.MultiPolygon(geoms).bounds
|
|
514
|
-
collection.extent.spatial = SpatialExtent([bbox])
|
|
523
|
+
extents = extract_extent_from_geoparquet(table)
|
|
524
|
+
collection.extent.temporal = extents[0]
|
|
525
|
+
collection.extent.spatial = extents[1]
|
|
515
526
|
# Make sure to also reference the geoparquet as asset
|
|
516
527
|
collection.add_asset(
|
|
517
528
|
"geoparquet",
|
|
@@ -45,11 +45,11 @@ def test_geoparquet_geojson_items(catalog_output_folder):
|
|
|
45
45
|
|
|
46
46
|
with open(os.path.join(child_collection_path, "collection.json")) as fp:
|
|
47
47
|
collection_json = json.load(fp)
|
|
48
|
-
|
|
49
|
-
assert
|
|
50
|
-
|
|
51
|
-
assert
|
|
52
|
-
items_path = os.path.join(child_collection_path,
|
|
48
|
+
# check if parquet source is present in assets
|
|
49
|
+
assert "geoparquet" in collection_json["assets"]
|
|
50
|
+
parquet_asset = collection_json["assets"]["geoparquet"]
|
|
51
|
+
assert parquet_asset["type"] == "application/vnd.apache.parquet"
|
|
52
|
+
items_path = os.path.join(child_collection_path, parquet_asset["href"].split("/")[-1])
|
|
53
53
|
assert os.path.exists(items_path)
|
|
54
54
|
|
|
55
55
|
with open(items_path, "rb") as fp:
|
|
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
|
|
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.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_geodb_locations.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_projection.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_see_solar_energy.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms_locations.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1_json.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_2.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda_tiles.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.0 → eodash_catalog-0.3.2}/tests/testing-collections/test_wms_no_time.yaml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|