Skip to content

Commit

Permalink
Merge pull request #532 from EOxServer/stac-register-warn-no-coverage
Browse files Browse the repository at this point in the history
fix: add some info logs in stac ingestion
  • Loading branch information
constantinius committed Aug 11, 2022
2 parents 5ed51cc + ac04a51 commit 09ba036
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion eoxserver/resources/coverages/registration/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,14 @@ def register_stac_product(stac_item, product_type=None, storage=None,

registrator = GDALRegistrator()

# handling coverages
if len(data_assets) == 0:
logger.info(
'No data assets found in STAC item for Product %s' % (
identifier,
)
)

# handling coverages
for asset_name, asset in data_assets.items():
overrides = {}
coverage_type = None
Expand All @@ -312,13 +318,31 @@ def register_stac_product(stac_item, product_type=None, storage=None,
)
break
else:
logger.info(
'''Data asset "%s" was not mapped to any coverage_mapping %s.
Asset will not be added as Coverage to Product %s''' % (
asset_name,
{
coverage_type_name: mapping['assets']
for coverage_type_name, mapping
in coverage_mapping.items()
},
identifier,
)
)
continue

# if no mapping is defined, we try to figure out the coverage type via
# the `eo:bands`
else:
bands = asset.get('eo:bands')
if bands is None:
logger.info(
'''No eo:bands information present in Item.
Skipping data asset %s.''' % (
asset_name,
)
)
continue

if not isinstance(bands, list):
Expand Down

0 comments on commit 09ba036

Please sign in to comment.