2828)
2929from sar_pipeline .utils .s3upload import push_files_in_folder_to_s3
3030from sar_pipeline .utils .general import log_timing
31+ from sar_pipeline .utils .spatial import write_burst_geometries_to_geojson
3132
3233from dem_handler .dem .cop_glo30 import get_cop30_dem_for_bounds
3334from dem_handler .dem .rema import get_rema_dem_for_bounds
171172 help = "Where to download the scene from." ,
172173)
173174@click .option ("--make-folders" , required = False , default = True , help = "Create folders" )
175+ @click .option (
176+ "--save-burst-geometries" ,
177+ required = False ,
178+ default = False ,
179+ is_flag = True ,
180+ help = "Save the burst geometries to a geojson" ,
181+ )
174182@log_timing
175183def get_data_for_scene_and_make_run_config (
176184 scene ,
@@ -194,6 +202,7 @@ def get_data_for_scene_and_make_run_config(
194202 scene_data_source ,
195203 orbit_data_source ,
196204 make_folders ,
205+ save_burst_geometries ,
197206):
198207 """Download the required data for the RTC/opera and create a configuration
199208 file for the run that points to appropriate files and has the required settings
@@ -329,6 +338,13 @@ def get_data_for_scene_and_make_run_config(
329338 burst_geoms_to_process = [
330339 all_scene_burst_info [id_ ]["geometry" ] for id_ in burst_id_list_to_process
331340 ]
341+ # write the geometries to a geojson. Useful for debugging if needed
342+ if save_burst_geometries :
343+ write_burst_geometries_to_geojson (
344+ burst_id_list_to_process ,
345+ burst_geoms_to_process ,
346+ out_folder / f"{ scene } _burst_geoms.json" ,
347+ )
332348 combined_burst_geom = shapely .ops .unary_union (burst_geoms_to_process )
333349 logger .info (f"The scene shape is : { scene_polygon } " )
334350 logger .info (f"The scene bounds are : { scene_polygon .bounds } " )
@@ -595,6 +611,7 @@ def make_rtc_opera_stac_and_upload_bursts(
595611 if link_static_layers and product == "RTC_S1" :
596612 # link to static layer metadata is in the .h5 file
597613 # use this to map assets to the file
614+ logger .info ("Linking static layers to product" )
598615 burst_stac_manager .add_linked_static_layer_assets_and_link ()
599616 stac_filename = "metadata.json"
600617 burst_stac_manager .add_self_link (filename = stac_filename )
@@ -608,7 +625,9 @@ def make_rtc_opera_stac_and_upload_bursts(
608625 burst_stac_manager .item .validate ()
609626 logger .info ("STAC is valid." )
610627 except Exception as e :
611- logger .error (f"STAC validation failed: { e } " )
628+ logger .error (
629+ f"STAC validation failed, correct error or run without --validate-stac flag.\n { e } "
630+ )
612631 raise
613632 else :
614633 logger .warning (
0 commit comments