Skip to content

Commit b3d14c8

Browse files
committed
Add debug logs for STAC Item creation
1 parent 5d324a7 commit b3d14c8

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

eoreader/stac/stac_extensions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def add_to_item(self, item) -> None:
129129
raise ImportError(
130130
"You need to install 'pystac[validation]' to export your product to a STAC Item!"
131131
) from exc
132+
132133
# Add the EO extension
133134
eo_ext = EOExtension.ext(item, add_if_missing=True)
134135

eoreader/stac/stac_item.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
- Viewing position (in progress)
3131
"""
3232

33+
import logging
3334
from datetime import datetime
3435

3536
import geopandas as gpd
3637
from sertit.vectors import WGS84
3738

38-
from eoreader import cache
39+
from eoreader import EOREADER_NAME, cache
3940
from eoreader.stac import GSD, stac_utils
4041
from eoreader.stac._stac_keywords import (
4142
BBOX,
@@ -54,6 +55,8 @@
5455
repr_multiline_str,
5556
)
5657

58+
LOGGER = logging.getLogger(EOREADER_NAME)
59+
5760

5861
class StacItem:
5962
"""
@@ -106,12 +109,16 @@ def __init__(self, prod, **kwargs):
106109
@cache
107110
def geometry_fct(self) -> gpd.GeoDataFrame:
108111
if self._prod.is_ortho:
112+
LOGGER.debug(
113+
f"Compute footprint for STAC Item for {self._prod.condensed_name}"
114+
)
109115
return self._prod.footprint().to_crs(WGS84)
110116
else:
111117
return self.bbox_fct()
112118

113119
@cache
114120
def bbox_fct(self) -> gpd.GeoDataFrame:
121+
LOGGER.debug(f"Compute extent for STAC Item for {self._prod.condensed_name}")
115122
return self._prod.extent().to_crs(WGS84)
116123

117124
@cache
@@ -124,6 +131,7 @@ def create_item(self):
124131
) from exc
125132

126133
# Item creation
134+
LOGGER.debug(f"Creating STAC Item for {self._prod.condensed_name}")
127135
item = pystac.Item(
128136
id=self.id,
129137
datetime=self.datetime,
@@ -135,6 +143,7 @@ def create_item(self):
135143
# Add assets
136144
# TODO: manage S3 paths
137145
# TODO: relative path?
146+
LOGGER.debug(f"Add quicklook to STAC Item for {self._prod.condensed_name}")
138147
thumbnail_path = self._prod.get_quicklook_path()
139148
if thumbnail_path:
140149
item.add_asset(
@@ -145,12 +154,15 @@ def create_item(self):
145154
)
146155

147156
# Add EO extension
157+
LOGGER.debug(f"Add EO extension to STAC Item for {self._prod.condensed_name}")
148158
self.eo.add_to_item(item)
149159

150160
# Add the PROJ extension
161+
LOGGER.debug(f"Add PROJ extension to STAC Item for {self._prod.condensed_name}")
151162
self.proj.add_to_item(item)
152163

153164
# Add the View extension
165+
LOGGER.debug(f"Add VIEW extension to STAC Item for {self._prod.condensed_name}")
154166
self.view.add_to_item(item)
155167

156168
stac_utils.fill_common_mtd(
@@ -161,6 +173,7 @@ def create_item(self):
161173
# let's check the validator to make sure we've specified everything correctly.
162174
# The validation logic will take into account the new extensions
163175
# that have been enabled and validate against the proper schemas for those extensions
176+
LOGGER.debug(f"Validate STAC Item for {self._prod.condensed_name}")
164177
item.validate()
165178

166179
return item

0 commit comments

Comments
 (0)