@@ -207,7 +207,7 @@ def load_path_from_df(df, variable_name, variable_column='filename_variable',
207207 # Return None if no matching variable is found
208208 return None
209209
210- def download_files (dataset , variables_file_path , create_request_func , get_output_filename_func , monthly_request = False ):
210+ def download_files (dataset , variables_file_path , create_request_func , get_output_filename_func , monthly_request = False , year_request = True ):
211211 """
212212 Download files for the specified variables and years.
213213
@@ -252,7 +252,7 @@ def download_files(dataset, variables_file_path, create_request_func, get_output
252252 logging .info (f"{ path_file } already exists, skipping" )
253253 continue
254254 futures .append (executor .submit (download_single_file , dataset , request , path_file ))
255- else :
255+ elif year_request :
256256 for year in year_list :
257257 request = create_request_func (row , year )
258258 file = get_output_filename_func (row , dataset , year )
@@ -261,6 +261,14 @@ def download_files(dataset, variables_file_path, create_request_func, get_output
261261 logging .info (f"{ path_file } already exists, skipping" )
262262 continue
263263 futures .append (executor .submit (download_single_file , dataset , request , path_file ))
264+ else :
265+ request = create_request_func (row )
266+ file = get_output_filename_func (row , dataset )
267+ path_file = dest_dir / file
268+ if path_file .exists ():
269+ logging .info (f"{ path_file } already exists, skipping" )
270+ continue
271+ futures .append (executor .submit (download_single_file , dataset , request , path_file ))
264272
265273 for future in futures :
266274 try :
0 commit comments