Skip to content

Commit c66da8d

Browse files
committed
bug corrections in s3 bucket reading functionality
1 parent 9b6d96b commit c66da8d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/pyrad_proc/pyrad/io/io_aux.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,6 +2661,8 @@ def get_scan_files_to_merge_s3(basepath, scan_list, radar_name, radar_res,
26612661
aws_secret_access_key=cfg['s3_secret_key'], verify=False)
26622662
response = s3_client.list_objects_v2(Bucket=cfg['bucket'])
26632663

2664+
dayinfo = voltime.strftime("%y%j")
2665+
timeinfo = voltime.strftime("%H%M")
26642666
for scan in scan_list:
26652667
file_id = 'M'
26662668
if radar_name is not None and radar_res is not None:
@@ -3302,7 +3304,6 @@ def get_file_list_s3(datadescriptor, starttimes, endtimes, cfg, scan=None):
33023304
pattern = f'{cfg["s3path"]}*{scan}*'
33033305
else:
33043306
pattern = f'{cfg["s3path"]}{daydir}/*{scan}*'
3305-
pattern = f'{datapath}*{scan}*'
33063307
dayfilelist = []
33073308
for content in response['Contents']:
33083309
if fnmatch.fnmatch(content['Key'], pattern):
@@ -3425,11 +3426,11 @@ def get_file_list_s3(datadescriptor, starttimes, endtimes, cfg, scan=None):
34253426
for filename in t_filelist:
34263427
# we need to download the master file to be able to know the
34273428
# scan coverage
3428-
datapath = f'{basepath}'
3429+
datapath = f'{cfg["datapath"]}'
34293430
if not os.path.isdir(datapath):
34303431
os.makedirs(datapath)
34313432
fname_aux = f'{datapath}{os.path.basename(filename)}'
3432-
s3_client.download_file(cfg['bucket'], fname, fname_aux)
3433+
s3_client.download_file(cfg['bucket'], filename, fname_aux)
34333434
_, tend_sweeps, _, _ = get_sweep_time_coverage(fname_aux)
34343435
for tend in tend_sweeps:
34353436
if starttime <= tend <= endtime:
@@ -3444,7 +3445,7 @@ def get_file_list_s3(datadescriptor, starttimes, endtimes, cfg, scan=None):
34443445
if starttime <= fdatetime <= endtime:
34453446
if filenamestr not in filelist:
34463447
filelist.append(filenamestr)
3447-
3448+
34483449
if not filelist:
34493450
if pattern is not None:
34503451
warn(

0 commit comments

Comments
 (0)