3030 - Viewing position (in progress)
3131"""
3232
33+ import logging
3334from datetime import datetime
3435
3536import geopandas as gpd
3637from sertit .vectors import WGS84
3738
38- from eoreader import cache
39+ from eoreader import EOREADER_NAME , cache
3940from eoreader .stac import GSD , stac_utils
4041from eoreader .stac ._stac_keywords import (
4142 BBOX ,
5455 repr_multiline_str ,
5556)
5657
58+ LOGGER = logging .getLogger (EOREADER_NAME )
59+
5760
5861class 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