2323from sar_pipeline .aws .metadata .stac import BurstH5toStacManager
2424from sar_pipeline .aws .metadata .odc import (
2525 make_static_layer_base_url ,
26- get_collection_number ,
2726)
2827from sar_pipeline .utils .s3upload import push_files_in_folder_to_s3
2928from sar_pipeline .utils .general import log_timing
105104 help = "project folder in the s3 bucket" ,
106105)
107106@click .option (
108- "--collection" ,
107+ "--collection-number " ,
109108 required = True ,
110- type = str ,
111- help = "collection associated with product. e.g. s1_rtc_c1. Must end in 'cX' where X is an "
112- "integer number referring to the collection." ,
109+ type = int ,
110+ help = "The collection number of the product." ,
113111)
114112@click .option (
115113 "--download-folder" ,
149147 is_flag = True ,
150148 default = False ,
151149 help = "If static layers should be linked to RTC_S1 products in the"
152- "STAC metadata. A url to the static layer collection will be added"
150+ "STAC metadata. A url to the static layers will be added"
153151 "to the run config file." ,
154152)
155153@click .option (
159157 help = "S3 bucket containing the RTC_S1_STATIC data that will be linked to the RTC_S1 bursts." ,
160158)
161159@click .option (
162- "--linked-static-layers-collection" ,
160+ "--linked-static-layers-collection-number " ,
163161 required = False ,
164162 type = str ,
165- help = "Collection of RTC_S1_STATIC data that will be linked to the RTC_S1 bursts." ,
163+ help = "Collection number of RTC_S1_STATIC data that will be linked to the RTC_S1 bursts." ,
166164)
167165@click .option (
168166 "--linked-static-layers-s3-project-folder" ,
169167 required = False ,
170168 type = str ,
171- help = "Project folder containing the RTC_S1_STATIC data that will be linked to the RTC_S1 bursts. "
172- "Expected for linked files path is : s3_bucket/s3_project_folder/collection/burst_id/*files" ,
169+ help = "Project folder containing the RTC_S1_STATIC data that will be linked to the RTC_S1 bursts. " ,
173170)
174171@click .option (
175172 "--scene-data-source" ,
@@ -204,15 +201,15 @@ def get_data_for_scene_and_make_run_config(
204201 backscatter_convention ,
205202 s3_bucket ,
206203 s3_project_folder ,
207- collection ,
204+ collection_number ,
208205 download_folder ,
209206 scratch_folder ,
210207 out_folder ,
211208 run_config_save_path ,
212209 make_existing_products ,
213210 link_static_layers ,
214211 linked_static_layers_s3_bucket ,
215- linked_static_layers_collection ,
212+ linked_static_layers_collection_number ,
216213 linked_static_layers_s3_project_folder ,
217214 scene_data_source ,
218215 orbit_data_source ,
@@ -242,10 +239,6 @@ def get_data_for_scene_and_make_run_config(
242239 if backscatter_convention not in ["gamma0" , "sigma0" , "beta0" ]:
243240 raise ValueError ("backscatter_convention must be one of gamma0, sigma0, beta0" )
244241
245- # ensure the collection ends with cX, where X is a positive integer.
246- # Raise error for invalid naming
247- _ = get_collection_number (collection )
248-
249242 # sub-folders for downloads
250243 orbit_folder = download_folder / "orbits"
251244 scene_folder = download_folder / "scenes"
@@ -305,7 +298,7 @@ def get_data_for_scene_and_make_run_config(
305298 burst_polarisations = burst_pols ,
306299 s3_bucket = s3_bucket ,
307300 s3_project_folder = s3_project_folder ,
308- collection = collection ,
301+ collection_number = collection_number ,
309302 make_existing_products = make_existing_products ,
310303 early_exit = True ,
311304 early_exit_code = 100 ,
@@ -322,7 +315,7 @@ def get_data_for_scene_and_make_run_config(
322315 scene = scene ,
323316 burst_id_list = burst_id_list_to_process ,
324317 static_layers_s3_bucket = linked_static_layers_s3_bucket ,
325- static_layers_collection = linked_static_layers_collection ,
318+ static_layers_collection_number = linked_static_layers_collection_number ,
326319 static_layers_s3_project_folder = linked_static_layers_s3_project_folder ,
327320 early_exit_code = 101 ,
328321 )
@@ -493,7 +486,7 @@ def get_data_for_scene_and_make_run_config(
493486 # add the static layer base url
494487 static_layer_base_url = make_static_layer_base_url (
495488 linked_static_layers_s3_bucket ,
496- linked_static_layers_collection ,
489+ linked_static_layers_collection_number ,
497490 linked_static_layers_s3_project_folder ,
498491 )
499492 logger .info (f"static layer base url : { static_layer_base_url } " )
@@ -550,11 +543,10 @@ def get_data_for_scene_and_make_run_config(
550543 help = "Backscatter convention of the product to be made (gamma0, sigma0 or beta0)" ,
551544)
552545@click .option (
553- "--collection" ,
546+ "--collection-number " ,
554547 required = True ,
555- type = str ,
556- help = "collection associated with product. e.g. s1_rtc_c1. Must end in 'cX' where X is an "
557- "integer number referring to the collection." ,
548+ type = int ,
549+ help = "The collection number of the product." ,
558550)
559551@click .option (
560552 "--s3-bucket" , required = True , type = str , help = "The bucket to upload the files"
@@ -605,7 +597,7 @@ def make_rtc_opera_stac_and_upload_bursts(
605597 run_config_path ,
606598 product ,
607599 backscatter_convention ,
608- collection ,
600+ collection_number ,
609601 s3_bucket ,
610602 s3_project_folder ,
611603 skip_upload_to_s3 ,
@@ -615,7 +607,10 @@ def make_rtc_opera_stac_and_upload_bursts(
615607):
616608 """makes STAC metadata for opera-rtc and uploads them to a desired s3 bucket.
617609 The final path in s3 will follow the following pattern:
618- s3_bucket/s3_folder/collection/burst_id/burst_year/burst_month/burst_day/*files
610+ product = RTC_S1:
611+ s3_bucket/s3_folder/odc_product_name/burst_id/burst_year/burst_month/burst_day/*files
612+ product = RTC_S1_STATIC:
613+ s3_bucket/s3_folder/odc_product_name/burst_id/*files
619614 """
620615
621616 # iterate through the burst directory and create STAC metadata
@@ -641,7 +636,7 @@ def make_rtc_opera_stac_and_upload_bursts(
641636 h5_filepath = burst_h5_filepath ,
642637 product = product ,
643638 backscatter_convention = backscatter_convention ,
644- collection = collection ,
639+ collection_number = collection_number ,
645640 s3_bucket = s3_bucket ,
646641 s3_project_folder = s3_project_folder ,
647642 )
@@ -703,7 +698,7 @@ def make_rtc_opera_stac_and_upload_bursts(
703698 burst_polarisations = burst_stac_manager .polarisations ,
704699 s3_bucket = s3_bucket ,
705700 s3_project_folder = s3_project_folder ,
706- collection = collection ,
701+ collection_number = collection_number ,
707702 make_existing_products = make_existing_products ,
708703 early_exit = False , # don't exit early, move to next burst
709704 )
0 commit comments