eodash_catalog 0.3.1__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.1 → eodash_catalog-0.3.2}/.bumpversion.cfg +1 -1
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/Dockerfile +1 -1
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/PKG-INFO +1 -1
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/__about__.py +1 -1
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/endpoints.py +30 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/utils.py +27 -20
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/test_geoparquet.py +5 -5
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.dockerignore +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.github/workflows/ci.yml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.github/workflows/python-publish.yml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.gitignore +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.vscode/extensions.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/.vscode/settings.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/LICENSE.txt +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/README.md +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/pyproject.toml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/requirements.txt +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/ruff.toml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/__init__.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/duration.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/generate_indicators.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/sh_endpoint.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/stac_handling.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/src/eodash_catalog/thumbnails.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/__init__.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/test-data/regional_forecast.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/test_generate.py +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-catalogs/testing-json.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-catalogs/testing.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_CROPOMAT1.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_cmems.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_cog.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_geodb.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_geodb_locations.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_geojson.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_locations_processing.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_process.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_projection.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_see_solar_energy.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms_locations.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1_json.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_2.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda_tiles.json +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_wms_no_time.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-indicators/test_indicator.yaml +0 -0
- {eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-layers/baselayers.yaml +0 -0
- {eodash_catalog-0.3.1 → 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,
|
|
@@ -1218,6 +1221,33 @@ def handle_raw_source(
|
|
|
1218
1221
|
# eodash v4 compatibility, adding last referenced style to collection
|
|
1219
1222
|
if style_link:
|
|
1220
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
|
+
|
|
1221
1251
|
else:
|
|
1222
1252
|
LOGGER.warn(f"NO datetimes configured for collection: {collection_config['Name']}!")
|
|
1223
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
|
|
@@ -448,6 +448,29 @@ def update_extents_from_collection_children(collection: Collection):
|
|
|
448
448
|
collection.extent.temporal = TemporalExtent([time_extent])
|
|
449
449
|
|
|
450
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
|
+
|
|
451
474
|
def save_items(
|
|
452
475
|
collection: Collection,
|
|
453
476
|
items: list[Item],
|
|
@@ -497,25 +520,9 @@ def save_items(
|
|
|
497
520
|
output_path = f"{buildcatpath}/{colpath}"
|
|
498
521
|
os.makedirs(output_path, exist_ok=True)
|
|
499
522
|
stacgp.arrow.to_parquet(table, f"{output_path}/items.parquet")
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
media_type="application/vnd.apache.parquet",
|
|
504
|
-
title="GeoParquet Items",
|
|
505
|
-
)
|
|
506
|
-
collection.add_link(gp_link)
|
|
507
|
-
# add extent information to the collection
|
|
508
|
-
min_datetime = pc.min(table["datetime"]).as_py()
|
|
509
|
-
max_datetime = pc.max(table["datetime"]).as_py()
|
|
510
|
-
if not min_datetime:
|
|
511
|
-
# cases when datetime was null
|
|
512
|
-
# fallback to start_datetime
|
|
513
|
-
min_datetime = pc.min(table["start_datetime"]).as_py()
|
|
514
|
-
max_datetime = pc.max(table["start_datetime"]).as_py()
|
|
515
|
-
collection.extent.temporal = TemporalExtent([min_datetime, max_datetime])
|
|
516
|
-
geoms = [wkb.loads(g.as_py()) for g in table["geometry"] if g is not None]
|
|
517
|
-
bbox = sgeom.MultiPolygon(geoms).bounds
|
|
518
|
-
collection.extent.spatial = SpatialExtent([bbox])
|
|
523
|
+
extents = extract_extent_from_geoparquet(table)
|
|
524
|
+
collection.extent.temporal = extents[0]
|
|
525
|
+
collection.extent.spatial = extents[1]
|
|
519
526
|
# Make sure to also reference the geoparquet as asset
|
|
520
527
|
collection.add_asset(
|
|
521
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.1 → 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.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_projection.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_see_solar_energy.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_sh_wms_locations.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1.yaml
RENAMED
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_1_json.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_tif_demo_2.yaml
RENAMED
|
File without changes
|
|
File without changes
|
{eodash_catalog-0.3.1 → eodash_catalog-0.3.2}/tests/testing-collections/test_veda_tiles.json
RENAMED
|
File without changes
|
{eodash_catalog-0.3.1 → 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
|