4141 check_base_dir ,
4242 check_download_protocol ,
4343 check_network ,
44+ check_product ,
4445 check_radar ,
4546 check_start_end_time ,
4647)
@@ -115,13 +116,13 @@ def _select_missing_fpaths(local_fpaths, bucket_fpaths):
115116 return local_fpaths , bucket_fpaths
116117
117118
118- def define_local_filepath (filename , network , radar , base_dir = None ):
119+ def define_local_filepath (filename , network , product , radar , base_dir = None ):
119120 """Define filepath where to save file locally on disk."""
120121 base_dir = get_base_dir (base_dir )
121122 base_dir = check_base_dir (base_dir )
122123 # Get directory pattern
123- directory_pattern = get_directory_pattern (protocol = "local" , network = network )
124- info_dict = get_info_from_filepath (filename , network = network )
124+ directory_pattern = get_directory_pattern (protocol = "local" , network = network , product = product )
125+ info_dict = get_info_from_filepath (filename , network = network , product = product )
125126 time = info_dict ["start_time" ]
126127 # Define local directory path
127128 parser = Parser (directory_pattern )
@@ -133,10 +134,16 @@ def define_local_filepath(filename, network, radar, base_dir=None):
133134 return filepath
134135
135136
136- def _get_local_from_bucket_fpaths (base_dir , network , radar , bucket_fpaths ):
137+ def _get_local_from_bucket_fpaths (base_dir , network , product , radar , bucket_fpaths ):
137138 """Convert cloud bucket filepaths to local storage filepaths."""
138139 fpaths = [
139- define_local_filepath (filename = os .path .basename (fpath ), network = network , radar = radar , base_dir = base_dir )
140+ define_local_filepath (
141+ filename = os .path .basename (fpath ),
142+ network = network ,
143+ product = product ,
144+ radar = radar ,
145+ base_dir = base_dir ,
146+ )
140147 for fpath in bucket_fpaths
141148 ]
142149 return fpaths
@@ -236,6 +243,7 @@ def download_files(
236243 radar ,
237244 start_time ,
238245 end_time ,
246+ product = None ,
239247 n_threads = 20 ,
240248 force_download = False ,
241249 check_data_integrity = True ,
@@ -256,6 +264,11 @@ def download_files(
256264 network : str
257265 The name of the radar network.
258266 See `radar_api.available_network()` for available radar networks.
267+ product: str
268+ The product acronym. The default is None.
269+ It must be specified if for a given network, multiple products are available
270+ through radar_api.
271+ See `radar_api.available_products(network)` for available products.
259272 start_time : datetime.datetime
260273 The start (inclusive) time of the interval period for retrieving the filepaths.
261274 end_time : datetime.datetime
@@ -294,6 +307,7 @@ def download_files(
294307 base_dir = check_base_dir (base_dir )
295308 network = check_network (network )
296309 radar = check_radar (radar = radar , network = network )
310+ product = check_product (network = network , product = product )
297311 start_time , end_time = check_start_end_time (start_time , end_time )
298312
299313 # Initialize timing
@@ -323,6 +337,7 @@ def download_files(
323337 fs_args = fs_args ,
324338 radar = radar ,
325339 network = network ,
340+ product = product ,
326341 start_time = start_time ,
327342 end_time = end_time ,
328343 base_dir = None ,
@@ -339,6 +354,7 @@ def download_files(
339354 base_dir = base_dir ,
340355 network = network ,
341356 radar = radar ,
357+ product = product ,
342358 bucket_fpaths = bucket_fpaths ,
343359 )
344360
0 commit comments